git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121472 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2010-12-10 07:40:14 +00:00
Родитель 85fe1560b0
Коммит 7872d48c61
1 изменённых файлов: 14 добавлений и 3 удалений

Просмотреть файл

@ -44,8 +44,11 @@
#include "llvm/Support/Signals.h" #include "llvm/Support/Signals.h"
#include "llvm/Support/system_error.h" #include "llvm/Support/system_error.h"
#include "llvm/Target/TargetAsmBackend.h" #include "llvm/Target/TargetAsmBackend.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetAsmParser.h" #include "llvm/Target/TargetAsmParser.h"
#include "llvm/Target/TargetData.h" #include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegistry.h" #include "llvm/Target/TargetRegistry.h"
#include "llvm/Target/TargetSelect.h" #include "llvm/Target/TargetSelect.h"
@ -245,7 +248,6 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, Diagnostic &Diags) {
OwningPtr<MCAsmInfo> MAI(TheTarget->createAsmInfo(Opts.Triple)); OwningPtr<MCAsmInfo> MAI(TheTarget->createAsmInfo(Opts.Triple));
assert(MAI && "Unable to create target asm info!"); assert(MAI && "Unable to create target asm info!");
MCContext Ctx(*MAI);
bool IsBinary = Opts.OutputType == AssemblerInvocation::FT_Obj; bool IsBinary = Opts.OutputType == AssemblerInvocation::FT_Obj;
formatted_raw_ostream *Out = GetOutputStream(Opts, Diags, IsBinary); formatted_raw_ostream *Out = GetOutputStream(Opts, Diags, IsBinary);
if (!Out) if (!Out)
@ -258,16 +260,25 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, Diagnostic &Diags) {
return false; return false;
} }
const TargetAsmInfo *tai = new TargetAsmInfo(*TM);
MCContext Ctx(*MAI, tai);
OwningPtr<MCStreamer> Str; OwningPtr<MCStreamer> Str;
const TargetLoweringObjectFile &TLOF =
TM->getTargetLowering()->getObjFileLowering();
const_cast<TargetLoweringObjectFile&>(TLOF).Initialize(Ctx, *TM);
if (Opts.OutputType == AssemblerInvocation::FT_Asm) { if (Opts.OutputType == AssemblerInvocation::FT_Asm) {
MCInstPrinter *IP = MCInstPrinter *IP =
TheTarget->createMCInstPrinter(Opts.OutputAsmVariant, *MAI); TheTarget->createMCInstPrinter(Opts.OutputAsmVariant, *MAI);
MCCodeEmitter *CE = 0; MCCodeEmitter *CE = 0;
if (Opts.ShowEncoding) if (Opts.ShowEncoding)
CE = TheTarget->createCodeEmitter(*TM, Ctx); CE = TheTarget->createCodeEmitter(*TM, Ctx);
Str.reset(createAsmStreamer(Ctx, *Out,TM->getTargetData()->isLittleEndian(), Str.reset(TheTarget->createAsmStreamer(Ctx, *Out, /*asmverbose*/true,
/*asmverbose*/true, IP, CE, Opts.ShowInst)); /*useLoc*/ true, IP, CE,
Opts.ShowInst));
} else if (Opts.OutputType == AssemblerInvocation::FT_Null) { } else if (Opts.OutputType == AssemblerInvocation::FT_Null) {
Str.reset(createNullStreamer(Ctx)); Str.reset(createNullStreamer(Ctx));
} else { } else {