summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-10-14 23:06:10 +0000
committerDan Gohman <gohman@apple.com>2010-10-14 23:06:10 +0000
commit947c9af77497a67a6ee079e3afd1ec82059b5186 (patch)
treeb8d202729b8d3190fd5739df3d3608e61c1f5403 /clang/lib/CodeGen/CodeGenModule.cpp
parent0f58561907985a879d90b210a2a32fac1d5518c8 (diff)
downloadbcm5719-llvm-947c9af77497a67a6ee079e3afd1ec82059b5186.tar.gz
bcm5719-llvm-947c9af77497a67a6ee079e3afd1ec82059b5186.zip
Experimental TBAA support.
This enables metadata generation by default, however the TBAA pass in the optimizer is still disabled for now. llvm-svn: 116536
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 805a82747da..660564d6fcb 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -14,6 +14,7 @@
#include "CodeGenModule.h"
#include "CGDebugInfo.h"
#include "CodeGenFunction.h"
+#include "CodeGenTBAA.h"
#include "CGCall.h"
#include "CGCXXABI.h"
#include "CGObjCRuntime.h"
@@ -62,6 +63,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO,
TheTargetData(TD), TheTargetCodeGenInfo(0), Diags(diags),
ABI(createCXXABI(*this)),
Types(C, M, TD, getTargetCodeGenInfo().getABIInfo(), ABI),
+ TBAA(0),
VTables(*this), Runtime(0),
CFConstantStringClassRef(0), NSConstantStringClassRef(0),
VMContext(M.getContext()),
@@ -79,6 +81,10 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO,
else
Runtime = CreateMacObjCRuntime(*this);
+ // Enable TBAA unless it's suppressed.
+ if (!CodeGenOpts.RelaxedAliasing && CodeGenOpts.OptimizationLevel > 0)
+ TBAA = new CodeGenTBAA(Context, VMContext, getLangOptions());
+
// If debug info generation is enabled, create the CGDebugInfo object.
DebugInfo = CodeGenOpts.DebugInfo ? new CGDebugInfo(*this) : 0;
}
@@ -116,6 +122,17 @@ void CodeGenModule::Release() {
EmitDeclMetadata();
}
+llvm::MDNode *CodeGenModule::getTBAAInfo(QualType QTy) {
+ if (!TBAA)
+ return 0;
+ return TBAA->getTBAAInfo(QTy);
+}
+
+void CodeGenModule::DecorateInstruction(llvm::Instruction *Inst,
+ llvm::MDNode *TBAAInfo) {
+ Inst->setMetadata(llvm::LLVMContext::MD_tbaa, TBAAInfo);
+}
+
bool CodeGenModule::isTargetDarwin() const {
return getContext().Target.getTriple().getOS() == llvm::Triple::Darwin;
}
OpenPOWER on IntegriCloud