diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-20 06:45:39 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-20 06:45:39 +0000 |
commit | 5eaa54e210256a939f15e918303197916c992aee (patch) | |
tree | b4eb2cec38d8e1ea8086a76e67df7e550b44310d /lib/MC | |
parent | 1658202529cf371e7e5f1a46d9ef80def5b3c3e0 (diff) | |
download | llvm-5eaa54e210256a939f15e918303197916c992aee.tar.gz llvm-5eaa54e210256a939f15e918303197916c992aee.tar.bz2 llvm-5eaa54e210256a939f15e918303197916c992aee.tar.xz |
make mcasmstreamer handle expanding 8 byte integer constants to
4-byte constants if .quad isn't supported. Switch a bunch of
methods used by the dwarf writer to use OutStreamer.EmitIntValue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93987 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r-- | lib/MC/MCAsmStreamer.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp index 2348909589..1121232808 100644 --- a/lib/MC/MCAsmStreamer.cpp +++ b/lib/MC/MCAsmStreamer.cpp @@ -198,14 +198,24 @@ void MCAsmStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) { void MCAsmStreamer::EmitIntValue(uint64_t Value, unsigned Size, unsigned AddrSpace) { assert(CurSection && "Cannot emit contents before setting section!"); - // Need target hooks to know how to print this. const char *Directive = 0; switch (Size) { default: break; case 1: Directive = MAI.getData8bitsDirective(AddrSpace); break; case 2: Directive = MAI.getData16bitsDirective(AddrSpace); break; case 4: Directive = MAI.getData32bitsDirective(AddrSpace); break; - case 8: Directive = MAI.getData64bitsDirective(AddrSpace); break; + case 8: + Directive = MAI.getData64bitsDirective(AddrSpace); + // If the target doesn't support 64-bit data, emit as two 32-bit halves. + if (Directive) break; + if (isLittleEndian()) { + EmitIntValue((uint32_t)(Value >> 0 ), 4, AddrSpace); + EmitIntValue((uint32_t)(Value >> 32), 4, AddrSpace); + } else { + EmitIntValue((uint32_t)(Value >> 32), 4, AddrSpace); + EmitIntValue((uint32_t)(Value >> 0 ), 4, AddrSpace); + } + return; } assert(Directive && "Invalid size for machine code value!"); @@ -215,7 +225,6 @@ void MCAsmStreamer::EmitIntValue(uint64_t Value, unsigned Size, void MCAsmStreamer::EmitValue(const MCExpr *Value, unsigned Size, unsigned AddrSpace) { assert(CurSection && "Cannot emit contents before setting section!"); - // Need target hooks to know how to print this. const char *Directive = 0; switch (Size) { default: break; |