Small cleanup: allocate storage for the full mask in the FunctionEmitContext constructor
This commit is contained in:
11
ctx.cpp
11
ctx.cpp
@@ -171,8 +171,11 @@ FunctionEmitContext::FunctionEmitContext(Function *func, Symbol *funSym,
|
||||
|
||||
internalMaskPointer = AllocaInst(LLVMTypes::MaskType, "internal_mask_memory");
|
||||
StoreInst(LLVMMaskAllOn, internalMaskPointer);
|
||||
|
||||
functionMaskValue = LLVMMaskAllOn;
|
||||
fullMaskPointer = NULL;
|
||||
|
||||
fullMaskPointer = AllocaInst(LLVMTypes::MaskType, "full_mask_memory");
|
||||
StoreInst(LLVMMaskAllOn, fullMaskPointer);
|
||||
|
||||
loopMask = NULL;
|
||||
breakLanesPtr = continueLanesPtr = NULL;
|
||||
@@ -286,9 +289,9 @@ FunctionEmitContext::GetFullMask() {
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FunctionEmitContext::SetMaskPointer(llvm::Value *p) {
|
||||
fullMaskPointer = p;
|
||||
llvm::Value *
|
||||
FunctionEmitContext::GetFullMaskPointer() {
|
||||
return fullMaskPointer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
6
ctx.h
6
ctx.h
@@ -98,9 +98,9 @@ public:
|
||||
the function entry mask and the internal mask. */
|
||||
llvm::Value *GetFullMask();
|
||||
|
||||
/** Provides the alloca'd pointer to memory to store the full function
|
||||
mask. This is only used to wire up the __mask builtin variable. */
|
||||
void SetMaskPointer(llvm::Value *p);
|
||||
/** Returns a pointer to storage in memory that stores the current full
|
||||
mask. */
|
||||
llvm::Value *GetFullMaskPointer();
|
||||
|
||||
/** Provides the value of the mask at function entry */
|
||||
void SetFunctionMask(llvm::Value *val);
|
||||
|
||||
7
func.cpp
7
func.cpp
@@ -189,10 +189,9 @@ lCopyInTaskParameter(int i, llvm::Value *structArgPtr, const std::vector<Symbol
|
||||
void
|
||||
Function::emitCode(FunctionEmitContext *ctx, llvm::Function *function,
|
||||
SourcePos firstStmtPos) {
|
||||
llvm::Value *maskPtr = ctx->AllocaInst(LLVMTypes::MaskType, "mask_memory");
|
||||
ctx->StoreInst(LLVMMaskAllOn, maskPtr);
|
||||
maskSymbol->storagePtr = maskPtr;
|
||||
ctx->SetMaskPointer(maskPtr);
|
||||
// Connect the __mask builtin to the location in memory that stores its
|
||||
// value
|
||||
maskSymbol->storagePtr = ctx->GetFullMaskPointer();
|
||||
|
||||
// add debugging info for __mask, programIndex, ...
|
||||
maskSymbol->pos = firstStmtPos;
|
||||
|
||||
Reference in New Issue
Block a user