summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2010-09-15 18:47:08 +0000
committerJim Grosbach <grosbach@apple.com>2010-09-15 18:47:08 +0000
commit7bbf3fd0d682aa9c2eb39bc1352f5a513b8251b1 (patch)
tree2dec778cc2d06252482ee8c8e89a4431a28bf69e /llvm/lib
parent970aed92c09e7b804bad502fc882fb0d69fc5517 (diff)
downloadbcm5719-llvm-7bbf3fd0d682aa9c2eb39bc1352f5a513b8251b1.tar.gz
bcm5719-llvm-7bbf3fd0d682aa9c2eb39bc1352f5a513b8251b1.zip
Add support for floating point immediates to MC instruction printing. ARM
VFP instructions use it for loading some constants, so implement that handling. Not thrilled with adding a member to MCOperand, but not sure there's much of a better option that's not pretty fragile (like putting a double in the union instead and just assuming that's good enough). Suggestions welcome... llvm-svn: 113996
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/ARM/ARMMCInstLower.cpp4
-rw-r--r--llvm/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp4
2 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/ARMMCInstLower.cpp b/llvm/lib/Target/ARM/ARMMCInstLower.cpp
index 41af0889d78..b26d327e363 100644
--- a/llvm/lib/Target/ARM/ARMMCInstLower.cpp
+++ b/llvm/lib/Target/ARM/ARMMCInstLower.cpp
@@ -16,6 +16,7 @@
#include "ARMMCInstLower.h"
//#include "llvm/CodeGen/MachineModuleInfoImpls.h"
#include "llvm/CodeGen/AsmPrinter.h"
+#include "llvm/Constants.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
@@ -155,6 +156,9 @@ void ARMMCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
MCOp = LowerSymbolOperand(MO, Printer.GetBlockAddressSymbol(
MO.getBlockAddress()));
break;
+ case MachineOperand::MO_FPImmediate:
+ MCOp = MCOperand::CreateFPImm(MO.getFPImm()->getValueAPF());
+ break;
}
OutMI.addOperand(MCOp);
diff --git a/llvm/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp b/llvm/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp
index 000108a7cc7..344273f72bb 100644
--- a/llvm/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp
+++ b/llvm/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp
@@ -729,12 +729,12 @@ void ARMInstPrinter::printT2AddrModeSoRegOperand(const MCInst *MI,
void ARMInstPrinter::printVFPf32ImmOperand(const MCInst *MI, unsigned OpNum,
raw_ostream &O) {
- O << '#' << MI->getOperand(OpNum).getImm();
+ O << '#' << MI->getOperand(OpNum).getFPImm().convertToFloat();
}
void ARMInstPrinter::printVFPf64ImmOperand(const MCInst *MI, unsigned OpNum,
raw_ostream &O) {
- O << '#' << MI->getOperand(OpNum).getImm();
+ O << '#' << MI->getOperand(OpNum).getFPImm().convertToDouble();
}
void ARMInstPrinter::printNEONModImmOperand(const MCInst *MI, unsigned OpNum,
OpenPOWER on IntegriCloud