From b725d270dbf2b9d7e5dc8099c243a19c6fbb4849 Mon Sep 17 00:00:00 2001 From: Alexander Musman Date: Thu, 22 May 2014 08:54:05 +0000 Subject: This patch adds a helper class (CGLoopInfo) for marking memory instructions with llvm.mem.parallel_loop_access metadata. It also adds a simple initial version of codegen for pragma omp simd (it will change in the future to support all the clauses). Differential revision: http://reviews.llvm.org/D3644 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209411 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenFunction.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CodeGenFunction.cpp') diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 1369c5786a..7de619e915 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -35,7 +35,8 @@ using namespace CodeGen; CodeGenFunction::CodeGenFunction(CodeGenModule &cgm, bool suppressNewContext) : CodeGenTypeCache(cgm), CGM(cgm), Target(cgm.getTarget()), - Builder(cgm.getModule().getContext()), CapturedStmtInfo(nullptr), + Builder(cgm.getModule().getContext(), llvm::ConstantFolder(), + CGBuilderInserterTy(this)), CapturedStmtInfo(nullptr), SanitizePerformTypeCheck(CGM.getSanOpts().Null | CGM.getSanOpts().Alignment | CGM.getSanOpts().ObjectSize | @@ -1644,3 +1645,30 @@ llvm::Value *CodeGenFunction::EmitFieldAnnotations(const FieldDecl *D, } CodeGenFunction::CGCapturedStmtInfo::~CGCapturedStmtInfo() { } + +void CodeGenFunction::InsertHelper(llvm::Instruction *I, + const llvm::Twine &Name, + llvm::BasicBlock *BB, + llvm::BasicBlock::iterator InsertPt) const { + LoopStack.InsertHelper(I); +} + +template +void CGBuilderInserter::InsertHelper( + llvm::Instruction *I, const llvm::Twine &Name, llvm::BasicBlock *BB, + llvm::BasicBlock::iterator InsertPt) const { + llvm::IRBuilderDefaultInserter::InsertHelper(I, Name, BB, + InsertPt); + if (CGF) + CGF->InsertHelper(I, Name, BB, InsertPt); +} + +#ifdef NDEBUG +#define PreserveNames false +#else +#define PreserveNames true +#endif +template void CGBuilderInserter::InsertHelper( + llvm::Instruction *I, const llvm::Twine &Name, llvm::BasicBlock *BB, + llvm::BasicBlock::iterator InsertPt) const; +#undef PreserveNames -- cgit v1.2.3