mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-27 13:57:52 +00:00
AMDGPU: Use generic helper for skipping over allocas
This commit is contained in:
parent
d8cef4f8fa
commit
aa7e09ebd3
@ -40,21 +40,6 @@ public:
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
// skip allocas
|
||||
static BasicBlock::iterator getInsertPt(BasicBlock &BB) {
|
||||
BasicBlock::iterator InsPt = BB.getFirstInsertionPt();
|
||||
for (BasicBlock::iterator E = BB.end(); InsPt != E; ++InsPt) {
|
||||
AllocaInst *AI = dyn_cast<AllocaInst>(&*InsPt);
|
||||
|
||||
// If this is a dynamic alloca, the value may depend on the loaded kernargs,
|
||||
// so loads will need to be inserted before it.
|
||||
if (!AI || !AI->isStaticAlloca())
|
||||
break;
|
||||
}
|
||||
|
||||
return InsPt;
|
||||
}
|
||||
|
||||
bool AMDGPULowerKernelArguments::runOnFunction(Function &F) {
|
||||
CallingConv::ID CC = F.getCallingConv();
|
||||
if (CC != CallingConv::AMDGPU_KERNEL || F.arg_empty())
|
||||
@ -67,7 +52,7 @@ bool AMDGPULowerKernelArguments::runOnFunction(Function &F) {
|
||||
LLVMContext &Ctx = F.getParent()->getContext();
|
||||
const DataLayout &DL = F.getParent()->getDataLayout();
|
||||
BasicBlock &EntryBlock = *F.begin();
|
||||
IRBuilder<> Builder(&*getInsertPt(EntryBlock));
|
||||
IRBuilder<> Builder(&*EntryBlock.getFirstNonPHIOrDbgOrAlloca());
|
||||
|
||||
const Align KernArgBaseAlign(16); // FIXME: Increase if necessary
|
||||
const uint64_t BaseOffset = ST.getExplicitKernelArgOffset();
|
||||
|
Loading…
x
Reference in New Issue
Block a user