From c9fe644675503894e9e76e8ecd8e6519426548de Mon Sep 17 00:00:00 2001 From: John McCall Date: Thu, 4 Mar 2010 00:23:29 +0000 Subject: Create a TargetMachine whenever we create a CodeGenAction. The codegen of some builtins will rely on target knowledge. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97693 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CodeGenModule.h') diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index ac8332647b..8b9a0f29c7 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -38,6 +38,7 @@ namespace llvm { class Function; class GlobalValue; class TargetData; + class TargetMachine; class FunctionType; class LLVMContext; } @@ -86,6 +87,7 @@ class CodeGenModule : public BlockModule { const LangOptions &Features; const CodeGenOptions &CodeGenOpts; llvm::Module &TheModule; + const llvm::TargetMachine &TheTargetMachine; const llvm::TargetData &TheTargetData; mutable const TargetCodeGenInfo *TheTargetCodeGenInfo; Diagnostic &Diags; @@ -168,7 +170,8 @@ class CodeGenModule : public BlockModule { llvm::LLVMContext &VMContext; public: CodeGenModule(ASTContext &C, const CodeGenOptions &CodeGenOpts, - llvm::Module &M, const llvm::TargetData &TD, Diagnostic &Diags); + llvm::Module &M, const llvm::TargetMachine &TM, + const llvm::TargetData &TD, Diagnostic &Diags); ~CodeGenModule(); @@ -198,6 +201,9 @@ public: const llvm::TargetData &getTargetData() const { return TheTargetData; } llvm::LLVMContext &getLLVMContext() { return VMContext; } const TargetCodeGenInfo &getTargetCodeGenInfo() const; + const llvm::TargetMachine &getTargetMachine() const { + return TheTargetMachine; + } /// getDeclVisibilityMode - Compute the visibility of the decl \arg D. LangOptions::VisibilityMode getDeclVisibilityMode(const Decl *D) const; -- cgit v1.2.3-70-g09d2