[llvm-commits] [llvm] r93987 - in /llvm/trunk/lib: CodeGen/AsmPrinter/AsmPrinter.cpp MC/MCAsmStreamer.cpp
Chris Lattner
sabre at nondot.org
Tue Jan 19 22:45:39 PST 2010
Author: lattner
Date: Wed Jan 20 00:45:39 2010
New Revision: 93987
URL: http://llvm.org/viewvc/llvm-project?rev=93987&view=rev
Log:
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.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/lib/MC/MCAsmStreamer.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=93987&r1=93986&r2=93987&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Jan 20 00:45:39 2010
@@ -784,39 +784,25 @@
/// EmitInt8 - Emit a byte directive and value.
///
void AsmPrinter::EmitInt8(int Value) const {
- O << MAI->getData8bitsDirective();
- PrintHex(Value & 0xFF);
+ OutStreamer.EmitIntValue(Value, 1, 0/*addrspace*/);
}
/// EmitInt16 - Emit a short directive and value.
///
void AsmPrinter::EmitInt16(int Value) const {
- O << MAI->getData16bitsDirective();
- PrintHex(Value & 0xFFFF);
+ OutStreamer.EmitIntValue(Value, 2, 0/*addrspace*/);
}
/// EmitInt32 - Emit a long directive and value.
///
void AsmPrinter::EmitInt32(int Value) const {
- O << MAI->getData32bitsDirective();
- PrintHex(Value);
+ OutStreamer.EmitIntValue(Value, 4, 0/*addrspace*/);
}
/// EmitInt64 - Emit a long long directive and value.
///
void AsmPrinter::EmitInt64(uint64_t Value) const {
- if (MAI->getData64bitsDirective()) {
- O << MAI->getData64bitsDirective();
- PrintHex(Value);
- } else {
- if (TM.getTargetData()->isBigEndian()) {
- EmitInt32(unsigned(Value >> 32)); O << '\n';
- EmitInt32(unsigned(Value));
- } else {
- EmitInt32(unsigned(Value)); O << '\n';
- EmitInt32(unsigned(Value >> 32));
- }
- }
+ OutStreamer.EmitIntValue(Value, 8, 0/*addrspace*/);
}
/// toOctal - Convert the low order bits of X into an octal digit.
Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=93987&r1=93986&r2=93987&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Wed Jan 20 00:45:39 2010
@@ -198,14 +198,24 @@
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::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;
More information about the llvm-commits
mailing list