• Home
  • Raw
  • Download

Lines Matching refs:llvm

53 class RSForEachExpandPass : public llvm::ModulePass {
57 llvm::Module *M;
58 llvm::LLVMContext *C;
65 uint32_t getRootSignature(llvm::Function *F) { in getRootSignature()
66 const llvm::NamedMDNode *ExportForEachMetadata = in getRootSignature()
70 llvm::SmallVector<llvm::Type*, 8> RootArgTys; in getRootSignature()
71 for (llvm::Function::arg_iterator B = F->arg_begin(), in getRootSignature()
92 llvm::MDNode *SigNode = ExportForEachMetadata->getOperand(0); in getRootSignature()
94 llvm::Value *SigVal = SigNode->getOperand(0); in getRootSignature()
95 if (SigVal->getValueID() == llvm::Value::MDStringVal) { in getRootSignature()
96 llvm::StringRef SigString = in getRootSignature()
97 static_cast<llvm::MDString*>(SigVal)->getString(); in getRootSignature()
120 llvm::Value *getStepValue(llvm::DataLayout *DL, llvm::Type *T, in getStepValue()
121 llvm::Value *OrigStep) { in getStepValue()
125 llvm::PointerType *PT = llvm::dyn_cast<llvm::PointerType>(T); in getStepValue()
126 llvm::Type *VoidPtrTy = llvm::Type::getInt8PtrTy(*C); in getStepValue()
128 llvm::Type *ET = PT->getElementType(); in getStepValue()
130 llvm::Type *Int32Ty = llvm::Type::getInt32Ty(*C); in getStepValue()
131 return llvm::ConstantInt::get(Int32Ty, ETSize); in getStepValue()
142 llvm::Type *getForeachStubTy() { in getForeachStubTy()
143 llvm::Type *VoidPtrTy = llvm::Type::getInt8PtrTy(*C); in getForeachStubTy()
144 llvm::Type *Int32Ty = llvm::Type::getInt32Ty(*C); in getForeachStubTy()
145 llvm::Type *SizeTy = Int32Ty; in getForeachStubTy()
161 llvm::SmallVector<llvm::Type*, 9> StructTys; in getForeachStubTy()
171 StructTys.push_back(llvm::ArrayType::get(Int32Ty, 16)); // uint32_t ar[16] in getForeachStubTy()
173 return llvm::StructType::create(StructTys, "RsForEachStubParamStruct"); in getForeachStubTy()
183 llvm::Function *createEmptyExpandedFunction(llvm::StringRef OldName) { in createEmptyExpandedFunction()
184 llvm::Type *ForEachStubPtrTy = getForeachStubTy()->getPointerTo(); in createEmptyExpandedFunction()
185 llvm::Type *Int32Ty = llvm::Type::getInt32Ty(*C); in createEmptyExpandedFunction()
187 llvm::SmallVector<llvm::Type*, 8> ParamTys; in createEmptyExpandedFunction()
194 llvm::FunctionType *FT = in createEmptyExpandedFunction()
195 llvm::FunctionType::get(llvm::Type::getVoidTy(*C), ParamTys, false); in createEmptyExpandedFunction()
196 llvm::Function *F = in createEmptyExpandedFunction()
197 llvm::Function::Create(FT, llvm::GlobalValue::ExternalLinkage, in createEmptyExpandedFunction()
200 llvm::Function::arg_iterator AI = F->arg_begin(); in createEmptyExpandedFunction()
215 llvm::BasicBlock *Begin = llvm::BasicBlock::Create(*C, "Begin", F); in createEmptyExpandedFunction()
216 llvm::IRBuilder<> Builder(Begin); in createEmptyExpandedFunction()
239 llvm::BasicBlock *createLoop(llvm::IRBuilder<> &Builder, in createLoop()
240 llvm::Value *LowerBound, in createLoop()
241 llvm::Value *UpperBound, in createLoop()
242 llvm::PHINode **LoopIV) { in createLoop()
245 llvm::BasicBlock *CondBB, *AfterBB, *HeaderBB; in createLoop()
246 llvm::Value *Cond, *IVNext; in createLoop()
247 llvm::PHINode *IV; in createLoop()
250 AfterBB = llvm::SplitBlock(CondBB, Builder.GetInsertPoint(), this); in createLoop()
251 HeaderBB = llvm::BasicBlock::Create(*C, "Loop", CondBB->getParent()); in createLoop()
292 bool ExpandFunction(llvm::Function *F, uint32_t Signature) { in ExpandFunction()
304 llvm::DataLayout DL(M); in ExpandFunction()
306 llvm::Function *ExpandedFunc = createEmptyExpandedFunction(F->getName()); in ExpandFunction()
309 llvm::SmallVector<llvm::Argument*, 8> ArgVec; in ExpandFunction()
310 for (llvm::Function::arg_iterator B = ExpandedFunc->arg_begin(), in ExpandFunction()
322 llvm::Value *Arg_p = ArgVec[0]; in ExpandFunction()
323 llvm::Value *Arg_x1 = ArgVec[1]; in ExpandFunction()
324 llvm::Value *Arg_x2 = ArgVec[2]; in ExpandFunction()
325 llvm::Value *Arg_instep = ArgVec[3]; in ExpandFunction()
326 llvm::Value *Arg_outstep = ArgVec[4]; in ExpandFunction()
328 llvm::Value *InStep = NULL; in ExpandFunction()
329 llvm::Value *OutStep = NULL; in ExpandFunction()
332 llvm::IRBuilder<> Builder(ExpandedFunc->getEntryBlock().begin()); in ExpandFunction()
336 llvm::Function::arg_iterator Args = F->arg_begin(); in ExpandFunction()
338 llvm::Type *InTy = NULL; in ExpandFunction()
339 llvm::Value *InBasePtr = NULL; in ExpandFunction()
348 llvm::Type *OutTy = NULL; in ExpandFunction()
349 llvm::Value *OutBasePtr = NULL; in ExpandFunction()
358 llvm::Value *UsrData = NULL; in ExpandFunction()
360 llvm::Type *UsrDataTy = Args->getType(); in ExpandFunction()
371 llvm::Value *Y = NULL; in ExpandFunction()
379 llvm::PHINode *IV; in ExpandFunction()
383 llvm::SmallVector<llvm::Value*, 8> RootArgs; in ExpandFunction()
385 llvm::Value *InPtr = NULL; in ExpandFunction()
386 llvm::Value *OutPtr = NULL; in ExpandFunction()
397 llvm::Value *OutOffset = Builder.CreateSub(IV, Arg_x1); in ExpandFunction()
403 llvm::Value *InOffset = Builder.CreateSub(IV, Arg_x1); in ExpandFunction()
421 llvm::Value *X = IV; in ExpandFunction()
437 bool ExpandKernel(llvm::Function *F, uint32_t Signature) { in ExpandKernel()
442 llvm::DataLayout DL(M); in ExpandKernel()
444 llvm::Function *ExpandedFunc = createEmptyExpandedFunction(F->getName()); in ExpandKernel()
447 llvm::SmallVector<llvm::Argument*, 8> ArgVec; in ExpandKernel()
448 for (llvm::Function::arg_iterator B = ExpandedFunc->arg_begin(), in ExpandKernel()
460 llvm::Value *Arg_p = ArgVec[0]; in ExpandKernel()
461 llvm::Value *Arg_x1 = ArgVec[1]; in ExpandKernel()
462 llvm::Value *Arg_x2 = ArgVec[2]; in ExpandKernel()
463 llvm::Value *Arg_instep = ArgVec[3]; in ExpandKernel()
464 llvm::Value *Arg_outstep = ArgVec[4]; in ExpandKernel()
466 llvm::Value *InStep = NULL; in ExpandKernel()
467 llvm::Value *OutStep = NULL; in ExpandKernel()
470 llvm::IRBuilder<> Builder(ExpandedFunc->getEntryBlock().begin()); in ExpandKernel()
473 llvm::MDNode *TBAARenderScript, *TBAAAllocation, *TBAAPointer; in ExpandKernel()
475 llvm::MDBuilder MDHelper(*C); in ExpandKernel()
482 llvm::Function::arg_iterator Args = F->arg_begin(); in ExpandKernel()
484 llvm::Type *OutTy = NULL; in ExpandKernel()
486 llvm::LoadInst *OutBasePtr = NULL; in ExpandKernel()
488 llvm::Type *OutBaseTy = F->getReturnType(); in ExpandKernel()
503 llvm::Type *InBaseTy = NULL; in ExpandKernel()
504 llvm::Type *InTy = NULL; in ExpandKernel()
505 llvm::LoadInst *InBasePtr = NULL; in ExpandKernel()
524 llvm::Value *Y = NULL; in ExpandKernel()
532 llvm::PHINode *IV; in ExpandKernel()
536 llvm::SmallVector<llvm::Value*, 8> RootArgs; in ExpandKernel()
538 llvm::Value *InPtr = NULL; in ExpandKernel()
539 llvm::Value *OutPtr = NULL; in ExpandKernel()
550 llvm::Value *OutOffset = Builder.CreateSub(IV, Arg_x1); in ExpandKernel()
556 llvm::Value *InOffset = Builder.CreateSub(IV, Arg_x1); in ExpandKernel()
567 llvm::LoadInst *In = Builder.CreateLoad(InPtr, "In"); in ExpandKernel()
572 llvm::Value *X = IV; in ExpandKernel()
581 llvm::Value *RetVal = Builder.CreateCall(F, RootArgs); in ExpandKernel()
584 llvm::StoreInst *Store = Builder.CreateStore(RetVal, OutPtr); in ExpandKernel()
601 bool allocPointersExposed(llvm::Module &M) { in allocPointersExposed()
638 llvm::Function *F = M.getFunction(*FI); in allocPointersExposed()
662 void connectRenderScriptTBAAMetadata(llvm::Module &M) { in connectRenderScriptTBAAMetadata()
663 llvm::MDBuilder MDHelper(*C); in connectRenderScriptTBAAMetadata()
664 llvm::MDNode *TBAARenderScript = MDHelper.createTBAARoot("RenderScript TBAA"); in connectRenderScriptTBAAMetadata()
666 llvm::MDNode *TBAARoot = MDHelper.createTBAARoot("Simple C/C++ TBAA"); in connectRenderScriptTBAAMetadata()
667 llvm::MDNode *TBAAMergedRS = MDHelper.createTBAANode("RenderScript", TBAARoot); in connectRenderScriptTBAAMetadata()
672 virtual bool runOnModule(llvm::Module &M) { in runOnModule()
684 llvm::Function *kernel = M.getFunction(name); in runOnModule()
688 kernel->setLinkage(llvm::GlobalValue::InternalLinkage); in runOnModule()
691 kernel->setLinkage(llvm::GlobalValue::InternalLinkage); in runOnModule()
719 llvm::ModulePass *