From: Evan Cheng Date: Mon, 11 Jul 2011 04:24:19 +0000 (+0000) Subject: Match createCodeEmitter change. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=74e1332a94e7c0214f8c2b7c7684a38ebd3f84a5;p=clang Match createCodeEmitter change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134885 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/driver/cc1as_main.cpp b/tools/driver/cc1as_main.cpp index 10da402544..dd18ea75c2 100644 --- a/tools/driver/cc1as_main.cpp +++ b/tools/driver/cc1as_main.cpp @@ -29,6 +29,7 @@ #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCContext.h" +#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSubtargetInfo.h" #include "llvm/Support/CommandLine.h" @@ -48,11 +49,13 @@ #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetAsmParser.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/Target/TargetSelect.h" +#include "llvm/Target/TargetSubtargetInfo.h" using namespace clang; using namespace clang::driver; using namespace llvm; @@ -280,6 +283,8 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, Diagnostic &Diags) { TM->getTargetLowering()->getObjFileLowering(); const_cast(TLOF).Initialize(Ctx, *TM); + const MCSubtargetInfo &STI = TM->getSubtarget(); + // FIXME: There is a bit of code duplication with addPassesToEmitFile. if (Opts.OutputType == AssemblerInvocation::FT_Asm) { MCInstPrinter *IP = @@ -287,7 +292,7 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, Diagnostic &Diags) { MCCodeEmitter *CE = 0; TargetAsmBackend *TAB = 0; if (Opts.ShowEncoding) { - CE = TheTarget->createCodeEmitter(*TM, Ctx); + CE = TheTarget->createCodeEmitter(*TM->getInstrInfo(), STI, Ctx); TAB = TheTarget->createAsmBackend(Opts.Triple); } Str.reset(TheTarget->createAsmStreamer(Ctx, *Out, /*asmverbose*/true, @@ -299,7 +304,8 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, Diagnostic &Diags) { } else { assert(Opts.OutputType == AssemblerInvocation::FT_Obj && "Invalid file type!"); - MCCodeEmitter *CE = TheTarget->createCodeEmitter(*TM, Ctx); + MCCodeEmitter *CE = TheTarget->createCodeEmitter(*TM->getInstrInfo(), + STI, Ctx); TargetAsmBackend *TAB = TheTarget->createAsmBackend(Opts.Triple); Str.reset(TheTarget->createObjectStreamer(Opts.Triple, Ctx, *TAB, *Out, CE, Opts.RelaxAll, @@ -309,11 +315,8 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, Diagnostic &Diags) { OwningPtr Parser(createMCAsmParser(*TheTarget, SrcMgr, Ctx, *Str.get(), *MAI)); - OwningPtr - STI(TheTarget->createMCSubtargetInfo(TM->getTargetTriple(), - TM->getTargetCPU(), - TM->getTargetFeatureString())); - OwningPtr TAP(TheTarget->createAsmParser(*STI, *Parser)); + OwningPtr + TAP(TheTarget->createAsmParser(const_cast(STI), *Parser)); if (!TAP) { Diags.Report(diag::err_target_unknown_triple) << Opts.Triple; return false; @@ -353,6 +356,7 @@ int cc1as_main(const char **ArgBegin, const char **ArgEnd, InitializeAllTargetInfos(); // FIXME: We shouldn't need to initialize the Target(Machine)s. InitializeAllTargets(); + InitializeAllMCInstrInfos(); InitializeAllMCSubtargetInfos(); InitializeAllAsmPrinters(); InitializeAllAsmParsers();