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