diff options
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 9 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenAction.cpp | 40 | ||||
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 22 | ||||
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.h | 9 |
4 files changed, 16 insertions, 64 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index cd238112ed1..f809c009ce1 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -14,7 +14,6 @@ #include "CGDebugInfo.h" #include "CodeGenModule.h" #include "CodeGenFunction.h" -#include "TargetInfo.h" #include "clang/AST/StmtVisitor.h" #include "clang/Basic/PrettyStackTrace.h" #include "clang/Basic/TargetInfo.h" @@ -1136,8 +1135,8 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { } } if (const llvm::Type* AdjTy = - getTargetHooks().adjustInlineAsmType(*this, OutputConstraint, - ResultRegTypes.back())) + Target.adjustInlineAsmType(OutputConstraint, ResultRegTypes.back(), + getLLVMContext())) ResultRegTypes.back() = AdjTy; } else { ArgTypes.push_back(Dest.getAddress()->getType()); @@ -1208,8 +1207,8 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { } } if (const llvm::Type* AdjTy = - getTargetHooks().adjustInlineAsmType(*this, InputConstraint, - Arg->getType())) + Target.adjustInlineAsmType(InputConstraint, Arg->getType(), + getLLVMContext())) Arg = Builder.CreateBitCast(Arg, AdjTy); ArgTypes.push_back(Arg->getType()); diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp index a24bbc480c1..69ac995a468 100644 --- a/clang/lib/CodeGen/CodeGenAction.cpp +++ b/clang/lib/CodeGen/CodeGenAction.cpp @@ -224,15 +224,9 @@ void BackendConsumer::InlineAsmDiagHandler2(const llvm::SMDiagnostic &D, // -CodeGenAction::CodeGenAction(unsigned _Act, LLVMContext *_VMContext) - : Act(_Act), VMContext(_VMContext ? _VMContext : new LLVMContext), - OwnsVMContext(!_VMContext) {} - -CodeGenAction::~CodeGenAction() { - TheModule.reset(); - if (OwnsVMContext) - delete VMContext; -} +CodeGenAction::CodeGenAction(unsigned _Act) : Act(_Act) {} + +CodeGenAction::~CodeGenAction() {} bool CodeGenAction::hasIRSupport() const { return true; } @@ -249,11 +243,6 @@ llvm::Module *CodeGenAction::takeModule() { return TheModule.take(); } -llvm::LLVMContext *CodeGenAction::takeLLVMContext() { - OwnsVMContext = false; - return VMContext; -} - static raw_ostream *GetOutputStream(CompilerInstance &CI, llvm::StringRef InFile, BackendAction Action) { @@ -286,7 +275,7 @@ ASTConsumer *CodeGenAction::CreateASTConsumer(CompilerInstance &CI, new BackendConsumer(BA, CI.getDiagnostics(), CI.getCodeGenOpts(), CI.getTargetOpts(), CI.getFrontendOpts().ShowTimers, InFile, OS.take(), - *VMContext); + CI.getLLVMContext()); return BEConsumer; } @@ -312,7 +301,7 @@ void CodeGenAction::ExecuteAction() { getCurrentFile().c_str()); llvm::SMDiagnostic Err; - TheModule.reset(ParseIR(MainFileCopy, Err, *VMContext)); + TheModule.reset(ParseIR(MainFileCopy, Err, CI.getLLVMContext())); if (!TheModule) { // Translate from the diagnostic info to the SourceManager location. SourceLocation Loc = SM.getLocation( @@ -343,20 +332,15 @@ void CodeGenAction::ExecuteAction() { // -EmitAssemblyAction::EmitAssemblyAction(llvm::LLVMContext *_VMContext) - : CodeGenAction(Backend_EmitAssembly, _VMContext) {} +EmitAssemblyAction::EmitAssemblyAction() + : CodeGenAction(Backend_EmitAssembly) {} -EmitBCAction::EmitBCAction(llvm::LLVMContext *_VMContext) - : CodeGenAction(Backend_EmitBC, _VMContext) {} +EmitBCAction::EmitBCAction() : CodeGenAction(Backend_EmitBC) {} -EmitLLVMAction::EmitLLVMAction(llvm::LLVMContext *_VMContext) - : CodeGenAction(Backend_EmitLL, _VMContext) {} +EmitLLVMAction::EmitLLVMAction() : CodeGenAction(Backend_EmitLL) {} -EmitLLVMOnlyAction::EmitLLVMOnlyAction(llvm::LLVMContext *_VMContext) - : CodeGenAction(Backend_EmitNothing, _VMContext) {} +EmitLLVMOnlyAction::EmitLLVMOnlyAction() : CodeGenAction(Backend_EmitNothing) {} -EmitCodeGenOnlyAction::EmitCodeGenOnlyAction(llvm::LLVMContext *_VMContext) - : CodeGenAction(Backend_EmitMCNull, _VMContext) {} +EmitCodeGenOnlyAction::EmitCodeGenOnlyAction() : CodeGenAction(Backend_EmitMCNull) {} -EmitObjAction::EmitObjAction(llvm::LLVMContext *_VMContext) - : CodeGenAction(Backend_EmitObj, _VMContext) {} +EmitObjAction::EmitObjAction() : CodeGenAction(Backend_EmitObj) {} diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index f95aab07442..881a7ee4d04 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -355,14 +355,6 @@ bool UseX86_MMXType(const llvm::Type *IRType) { IRType->getScalarSizeInBits() != 64; } -static const llvm::Type* X86AdjustInlineAsmType(CodeGen::CodeGenFunction &CGF, - llvm::StringRef Constraint, - const llvm::Type* Ty) { - if (Constraint=="y" && UseX86_MMXType(Ty)) - return llvm::Type::getX86_MMXTy(CGF.getLLVMContext()); - return Ty; -} - //===----------------------------------------------------------------------===// // X86-32 ABI Implementation //===----------------------------------------------------------------------===// @@ -423,13 +415,6 @@ public: bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF, llvm::Value *Address) const; - - const llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF, - llvm::StringRef Constraint, - const llvm::Type* Ty) const { - return X86AdjustInlineAsmType(CGF, Constraint, Ty); - } - }; } @@ -910,13 +895,6 @@ public: return false; } - - const llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF, - llvm::StringRef Constraint, - const llvm::Type* Ty) const { - return X86AdjustInlineAsmType(CGF, Constraint, Ty); - } - }; class WinX86_64TargetCodeGenInfo : public TargetCodeGenInfo { diff --git a/clang/lib/CodeGen/TargetInfo.h b/clang/lib/CodeGen/TargetInfo.h index 4f59eb619e9..9d4cf161030 100644 --- a/clang/lib/CodeGen/TargetInfo.h +++ b/clang/lib/CodeGen/TargetInfo.h @@ -15,11 +15,8 @@ #ifndef CLANG_CODEGEN_TARGETINFO_H #define CLANG_CODEGEN_TARGETINFO_H -#include "llvm/ADT/StringRef.h" - namespace llvm { class GlobalValue; - class Type; class Value; } @@ -105,12 +102,6 @@ namespace clang { llvm::Value *Address) const { return Address; } - - virtual const llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF, - llvm::StringRef Constraint, - const llvm::Type* Ty) const { - return Ty; - } }; } |