diff options
-rw-r--r-- | include/llvm/MC/MCStreamer.h | 2 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 3 | ||||
-rw-r--r-- | lib/MC/MCAsmStreamer.cpp | 11 | ||||
-rw-r--r-- | tools/llvm-mc/llvm-mc.cpp | 5 |
4 files changed, 15 insertions, 6 deletions
diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h index f1680a9..acd84f6 100644 --- a/include/llvm/MC/MCStreamer.h +++ b/include/llvm/MC/MCStreamer.h @@ -235,7 +235,7 @@ namespace llvm { /// assembly for the native target, suitable for compiling with a native /// assembler. MCStreamer *createAsmStreamer(MCContext &Ctx, raw_ostream &OS, - const MCAsmInfo &MAI, + const MCAsmInfo &MAI, bool isLittleEndian, MCInstPrinter *InstPrint = 0, MCCodeEmitter *CE = 0); diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index e230aff..d439fb6 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -58,7 +58,8 @@ AsmPrinter::AsmPrinter(formatted_raw_ostream &o, TargetMachine &tm, OutContext(*new MCContext()), // FIXME: Pass instprinter to streamer. - OutStreamer(*createAsmStreamer(OutContext, O, *T, 0)), + OutStreamer(*createAsmStreamer(OutContext, O, *T, + TM.getTargetData()->isLittleEndian(), 0)), LastMI(0), LastFn(0), Counter(~0U), PrevDLT(NULL) { DW = 0; MMI = 0; diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp index a126b52..2348909 100644 --- a/lib/MC/MCAsmStreamer.cpp +++ b/lib/MC/MCAsmStreamer.cpp @@ -28,15 +28,19 @@ namespace { class MCAsmStreamer : public MCStreamer { raw_ostream &OS; const MCAsmInfo &MAI; + bool IsLittleEndian; MCInstPrinter *InstPrinter; MCCodeEmitter *Emitter; public: MCAsmStreamer(MCContext &Context, raw_ostream &_OS, const MCAsmInfo &tai, - MCInstPrinter *_Printer, MCCodeEmitter *_Emitter) + bool isLittleEndian, MCInstPrinter *_Printer, + MCCodeEmitter *_Emitter) : MCStreamer(Context), OS(_OS), MAI(tai), InstPrinter(_Printer), Emitter(_Emitter) {} ~MCAsmStreamer() {} + bool isLittleEndian() const { return IsLittleEndian; } + /// @name MCStreamer Interface /// @{ @@ -337,7 +341,8 @@ void MCAsmStreamer::Finish() { } MCStreamer *llvm::createAsmStreamer(MCContext &Context, raw_ostream &OS, - const MCAsmInfo &MAI, MCInstPrinter *IP, + const MCAsmInfo &MAI, bool isLittleEndian, + MCInstPrinter *IP, MCCodeEmitter *CE) { - return new MCAsmStreamer(Context, OS, MAI, IP, CE); + return new MCAsmStreamer(Context, OS, MAI, isLittleEndian, IP, CE); } diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index 30cdfba..c9d08ec 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -28,6 +28,7 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/System/Signals.h" #include "llvm/Target/TargetAsmParser.h" +#include "llvm/Target/TargetData.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/Target/TargetMachine.h" // FIXME. #include "llvm/Target/TargetSelect.h" @@ -263,7 +264,9 @@ static int AssembleInput(const char *ProgName) { IP.reset(TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *Out)); if (ShowEncoding) CE.reset(TheTarget->createCodeEmitter(*TM)); - Str.reset(createAsmStreamer(Ctx, *Out, *MAI, IP.get(), CE.get())); + Str.reset(createAsmStreamer(Ctx, *Out, *MAI, + TM->getTargetData()->isLittleEndian(), + IP.get(), CE.get())); } else { assert(FileType == OFT_ObjectFile && "Invalid file type!"); CE.reset(TheTarget->createCodeEmitter(*TM)); |