diff options
author | Bill Wendling <isanbard@gmail.com> | 2011-01-26 20:57:43 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2011-01-26 20:57:43 +0000 |
commit | 5a13d4fa8f707e5e141561aaf310fc494a830e39 (patch) | |
tree | 8322b0eb5950929bbcab9f10f12bace42f0ca3a7 /llvm/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp | |
parent | a52713096d31eb73af5c1b420abbb6c9aad5880c (diff) | |
download | bcm5719-llvm-5a13d4fa8f707e5e141561aaf310fc494a830e39.tar.gz bcm5719-llvm-5a13d4fa8f707e5e141561aaf310fc494a830e39.zip |
Add support for printing out floating point values from the ARM assembly
parser. The parser will always give us a binary representation of the floating
point number.
llvm-svn: 124318
Diffstat (limited to 'llvm/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp b/llvm/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp index 820c2e6ca6f..941c69d14ea 100644 --- a/llvm/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp +++ b/llvm/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp @@ -673,12 +673,37 @@ void ARMInstPrinter::printT2AddrModeSoRegOperand(const MCInst *MI, void ARMInstPrinter::printVFPf32ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O) { - O << '#' << (float)MI->getOperand(OpNum).getFPImm(); + const MCOperand &MO = MI->getOperand(OpNum); + O << '#'; + if (MO.isFPImm()) { + O << (float)MO.getFPImm(); + } else { + union { + uint32_t I; + float F; + } FPUnion; + + FPUnion.I = MO.getImm(); + O << FPUnion.F; + } } void ARMInstPrinter::printVFPf64ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O) { - O << '#' << MI->getOperand(OpNum).getFPImm(); + const MCOperand &MO = MI->getOperand(OpNum); + O << '#'; + if (MO.isFPImm()) { + O << MO.getFPImm(); + } else { + // We expect the binary encoding of a floating point number here. + union { + uint64_t I; + double D; + } FPUnion; + + FPUnion.I = MO.getImm(); + O << FPUnion.D; + } } void ARMInstPrinter::printNEONModImmOperand(const MCInst *MI, unsigned OpNum, |