Remove trailing whitespace

This commit is contained in:
2017-05-09 23:01:40 -04:00
parent 7bb1741b9a
commit 871af918ad
2 changed files with 20 additions and 20 deletions

30
ctx.cpp
View File

@@ -631,7 +631,7 @@ FunctionEmitContext::EndIf() {
breakLanes, "|break_lanes"); breakLanes, "|break_lanes");
} }
llvm::Value *notBreakOrContinue = llvm::Value *notBreakOrContinue =
BinaryOperator(llvm::Instruction::Xor, BinaryOperator(llvm::Instruction::Xor,
bcLanes, LLVMMaskAllOn, bcLanes, LLVMMaskAllOn,
"!(break|continue)_lanes"); "!(break|continue)_lanes");
@@ -942,7 +942,7 @@ FunctionEmitContext::jumpIfAllLoopLanesAreDone(llvm::BasicBlock *target) {
finishedLanes = BinaryOperator(llvm::Instruction::Or, finishedLanes, finishedLanes = BinaryOperator(llvm::Instruction::Or, finishedLanes,
continued, "returned|breaked|continued"); continued, "returned|breaked|continued");
} }
finishedLanes = BinaryOperator(llvm::Instruction::And, finishedLanes = BinaryOperator(llvm::Instruction::And,
finishedLanes, GetFunctionMask(), finishedLanes, GetFunctionMask(),
"finished&func"); "finished&func");
@@ -1446,7 +1446,7 @@ FunctionEmitContext::None(llvm::Value *mask) {
llvm::Value * llvm::Value *
FunctionEmitContext::LaneMask(llvm::Value *v) { FunctionEmitContext::LaneMask(llvm::Value *v) {
#ifdef ISPC_NVPTX_ENABLED #ifdef ISPC_NVPTX_ENABLED
/* this makes mandelbrot example slower with "nvptx" target. /* this makes mandelbrot example slower with "nvptx" target.
* Needs further investigation. */ * Needs further investigation. */
const char *__movmsk = g->target->getISA() == Target::NVPTX ? "__movmsk_ptx" : "__movmsk"; const char *__movmsk = g->target->getISA() == Target::NVPTX ? "__movmsk_ptx" : "__movmsk";
#else #else
@@ -1494,7 +1494,7 @@ FunctionEmitContext::Insert(llvm::Value *vector, llvm::Value *lane, llvm::Value
std::string funcName = "__insert"; std::string funcName = "__insert";
assert(lAppendInsertExtractName(vector, funcName)); assert(lAppendInsertExtractName(vector, funcName));
assert(lane->getType() == LLVMTypes::Int32Type); assert(lane->getType() == LLVMTypes::Int32Type);
llvm::Function *func = m->module->getFunction(funcName.c_str()); llvm::Function *func = m->module->getFunction(funcName.c_str());
assert(func != NULL); assert(func != NULL);
std::vector<llvm::Value *> args; std::vector<llvm::Value *> args;
@@ -1511,7 +1511,7 @@ FunctionEmitContext::Extract(llvm::Value *vector, llvm::Value *lane)
std::string funcName = "__extract"; std::string funcName = "__extract";
assert(lAppendInsertExtractName(vector, funcName)); assert(lAppendInsertExtractName(vector, funcName));
assert(lane->getType() == LLVMTypes::Int32Type); assert(lane->getType() == LLVMTypes::Int32Type);
llvm::Function *func = m->module->getFunction(funcName.c_str()); llvm::Function *func = m->module->getFunction(funcName.c_str());
assert(func != NULL); assert(func != NULL);
std::vector<llvm::Value *> args; std::vector<llvm::Value *> args;
@@ -2823,7 +2823,7 @@ FunctionEmitContext::loadUniformFromSOA(llvm::Value *ptr, llvm::Value *mask,
llvm::Value * llvm::Value *
FunctionEmitContext::LoadInst(llvm::Value *ptr, llvm::Value *mask, FunctionEmitContext::LoadInst(llvm::Value *ptr, llvm::Value *mask,
const Type *ptrRefType, const char *name, const Type *ptrRefType, const char *name,
bool one_elem) { bool one_elem) {
if (ptr == NULL) { if (ptr == NULL) {
AssertPos(currentPos, m->errorCount > 0); AssertPos(currentPos, m->errorCount > 0);
@@ -3285,8 +3285,8 @@ FunctionEmitContext::scatter(llvm::Value *value, llvm::Value *ptr,
const PointerType *pt = CastType<PointerType>(valueType); const PointerType *pt = CastType<PointerType>(valueType);
// And everything should be a pointer or atomic (or enum) from here on out... // And everything should be a pointer or atomic (or enum) from here on out...
AssertPos(currentPos, AssertPos(currentPos,
pt != NULL pt != NULL
|| CastType<AtomicType>(valueType) != NULL || CastType<AtomicType>(valueType) != NULL
|| CastType<EnumType>(valueType) != NULL); || CastType<EnumType>(valueType) != NULL);
@@ -3887,7 +3887,7 @@ FunctionEmitContext::LaunchInst(llvm::Value *callee,
llvm::Function *F = llvm::dyn_cast<llvm::Function>(callee); llvm::Function *F = llvm::dyn_cast<llvm::Function>(callee);
const unsigned int nArgs = F->arg_size(); const unsigned int nArgs = F->arg_size();
llvm::Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end(); llvm::Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end();
for (; I != E; ++I) for (; I != E; ++I)
argTypes.push_back(I->getType()); argTypes.push_back(I->getType());
llvm::Type *st = llvm::StructType::get(*g->ctx, argTypes); llvm::Type *st = llvm::StructType::get(*g->ctx, argTypes);
llvm::StructType *argStructType = static_cast<llvm::StructType *>(st); llvm::StructType *argStructType = static_cast<llvm::StructType *>(st);
@@ -3908,24 +3908,24 @@ FunctionEmitContext::LaunchInst(llvm::Value *callee,
llvm::BasicBlock* if_true = CreateBasicBlock("if_true"); llvm::BasicBlock* if_true = CreateBasicBlock("if_true");
llvm::BasicBlock* if_false = CreateBasicBlock("if_false"); llvm::BasicBlock* if_false = CreateBasicBlock("if_false");
/* check if the pointer returned by ISPCAlloc is not NULL /* check if the pointer returned by ISPCAlloc is not NULL
* -------------- * --------------
* this is a workaround for not checking the value of programIndex * this is a workaround for not checking the value of programIndex
* because ISPCAlloc will return NULL pointer for all programIndex > 0 * because ISPCAlloc will return NULL pointer for all programIndex > 0
* of course, if ISPAlloc fails to get parameter buffer, the pointer for programIndex = 0 * of course, if ISPAlloc fails to get parameter buffer, the pointer for programIndex = 0
* will also be NULL * will also be NULL
* This check must be added, and also rewrite the code to make it less opaque * This check must be added, and also rewrite the code to make it less opaque
*/ */
llvm::Value* cmp1 = CmpInst(llvm::Instruction::ICmp, llvm::CmpInst::ICMP_NE, voidi64, LLVMInt64(0), "cmp1"); llvm::Value* cmp1 = CmpInst(llvm::Instruction::ICmp, llvm::CmpInst::ICMP_NE, voidi64, LLVMInt64(0), "cmp1");
BranchInst(if_true, if_false, cmp1); BranchInst(if_true, if_false, cmp1);
/**********************/ /**********************/
bblock = if_true; bblock = if_true;
// label_if_then block: // label_if_then block:
llvm::Type *pt = llvm::PointerType::getUnqual(st); llvm::Type *pt = llvm::PointerType::getUnqual(st);
llvm::Value *argmem = BitCastInst(voidmem, pt); llvm::Value *argmem = BitCastInst(voidmem, pt);
for (unsigned int i = 0; i < argVals.size(); ++i) for (unsigned int i = 0; i < argVals.size(); ++i)
{ {
llvm::Value *ptr = AddElementOffset(argmem, i, NULL, "funarg"); llvm::Value *ptr = AddElementOffset(argmem, i, NULL, "funarg");
// don't need to do masked store here, I think // don't need to do masked store here, I think
@@ -4027,7 +4027,7 @@ FunctionEmitContext::LaunchInst(llvm::Value *callee,
void void
FunctionEmitContext::SyncInst() { FunctionEmitContext::SyncInst() {
#ifdef ISPC_NVPTX_ENABLED #ifdef ISPC_NVPTX_ENABLED
if (g->target->getISA() == Target::NVPTX) if (g->target->getISA() == Target::NVPTX)
{ {
llvm::Value *launchGroupHandle = LoadInst(launchGroupHandlePtr); llvm::Value *launchGroupHandle = LoadInst(launchGroupHandlePtr);

10
ctx.h
View File

@@ -195,10 +195,10 @@ public:
'continue' statement when going through the loop body in the 'continue' statement when going through the loop body in the
previous iteration. */ previous iteration. */
void RestoreContinuedLanes(); void RestoreContinuedLanes();
/** This method is called by code emitting IR for a loop. It clears /** This method is called by code emitting IR for a loop. It clears
any lanes that contained a break since the mask has been updated to take any lanes that contained a break since the mask has been updated to take
them into account. This is necessary as all the bail out checks for them into account. This is necessary as all the bail out checks for
breaks are meant to only deal with lanes breaking on the current iteration. breaks are meant to only deal with lanes breaking on the current iteration.
*/ */
void ClearBreakLanes(); void ClearBreakLanes();
@@ -312,7 +312,7 @@ public:
llvm::Value* Insert(llvm::Value *vector, llvm::Value *lane, llvm::Value *scalar); llvm::Value* Insert(llvm::Value *vector, llvm::Value *lane, llvm::Value *scalar);
/** Issues a call to __extract_int8/int16/int32/int64/float/double */ /** Issues a call to __extract_int8/int16/int32/int64/float/double */
llvm::Value* Extract(llvm::Value *vector, llvm::Value *lane); llvm::Value* Extract(llvm::Value *vector, llvm::Value *lane);
#endif #endif
/** Given a string, create an anonymous global variable to hold its /** Given a string, create an anonymous global variable to hold its
value and return the pointer to the string. */ value and return the pointer to the string. */
@@ -481,7 +481,7 @@ public:
pointer values given by the lvalue. If the lvalue is not varying, pointer values given by the lvalue. If the lvalue is not varying,
then both the mask pointer and the type pointer may be NULL. */ then both the mask pointer and the type pointer may be NULL. */
llvm::Value *LoadInst(llvm::Value *ptr, llvm::Value *mask, llvm::Value *LoadInst(llvm::Value *ptr, llvm::Value *mask,
const Type *ptrType, const char *name = NULL, const Type *ptrType, const char *name = NULL,
bool one_elem = false); bool one_elem = false);
llvm::Value *LoadInst(llvm::Value *ptr, const char *name = NULL); llvm::Value *LoadInst(llvm::Value *ptr, const char *name = NULL);