diff options
author | Justin Bogner <mail@justinbogner.com> | 2014-01-06 22:27:43 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2014-01-06 22:27:43 +0000 |
commit | e0e019f6a2d76e140221d9c10159a444839e2563 (patch) | |
tree | e17e8b4c7d49c80b85dae49d6a0de39b9b3dd2f5 /lib/CodeGen/CodeGenModule.cpp | |
parent | f4c386bdd1f95c0ee746a5baac574bf9723cc5de (diff) | |
download | clang-e0e019f6a2d76e140221d9c10159a444839e2563.tar.gz clang-e0e019f6a2d76e140221d9c10159a444839e2563.tar.bz2 clang-e0e019f6a2d76e140221d9c10159a444839e2563.tar.xz |
CodeGen: Initial instrumentation based PGO implementation
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198640 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 7baef23b11..b482677f62 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -20,6 +20,7 @@ #include "CGOpenCLRuntime.h" #include "CodeGenFunction.h" #include "CodeGenTBAA.h" +#include "CodeGenPGO.h" #include "TargetInfo.h" #include "clang/AST/ASTContext.h" #include "clang/AST/CharUnits.h" @@ -77,7 +78,8 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO, ABI(createCXXABI(*this)), VMContext(M.getContext()), TBAA(0), TheTargetCodeGenInfo(0), Types(*this), VTables(*this), ObjCRuntime(0), OpenCLRuntime(0), CUDARuntime(0), DebugInfo(0), ARCData(0), - NoObjCARCExceptionsMetadata(0), RRData(0), CFConstantStringClassRef(0), + NoObjCARCExceptionsMetadata(0), RRData(0), PGOData(0), + CFConstantStringClassRef(0), ConstantStringClassRef(0), NSConstantStringType(0), NSConcreteGlobalBlock(0), NSConcreteStackBlock(0), BlockObjectAssign(0), BlockObjectDispose(0), BlockDescriptorType(0), GenericBlockLiteralType(0), @@ -131,6 +133,9 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO, if (C.getLangOpts().ObjCAutoRefCount) ARCData = new ARCEntrypoints(); RRData = new RREntrypoints(); + + if (!CodeGenOpts.InstrProfileInput.empty()) + PGOData = new PGOProfileData(*this, CodeGenOpts.InstrProfileInput); } CodeGenModule::~CodeGenModule() { @@ -2181,6 +2186,10 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD, AddGlobalDtor(Fn, DA->getPriority()); if (D->hasAttr<AnnotateAttr>()) AddGlobalAnnotations(D, Fn); + + llvm::Function *PGOInit = CodeGenPGO::emitInitialization(*this); + if (PGOInit) + AddGlobalCtor(PGOInit, 0); } void CodeGenModule::EmitAliasDefinition(GlobalDecl GD) { |