aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/ARM/ARMCodeEmitter.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-11-11 22:19:31 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-11-11 22:19:31 +0000
commitcb5201f3b2d7147471d33cb2ddd94c5e011055e2 (patch)
treecc57acdee5477d6bb1e40912517dd69c05cc53cf /lib/Target/ARM/ARMCodeEmitter.cpp
parent80fe8737eb0c563d5d518434672a600492486d93 (diff)
Handle floating point constpool_entry's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59087 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMCodeEmitter.cpp')
-rw-r--r--lib/Target/ARM/ARMCodeEmitter.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/Target/ARM/ARMCodeEmitter.cpp b/lib/Target/ARM/ARMCodeEmitter.cpp
index 2288ad1d37..08372cefd6 100644
--- a/lib/Target/ARM/ARMCodeEmitter.cpp
+++ b/lib/Target/ARM/ARMCodeEmitter.cpp
@@ -75,6 +75,8 @@ namespace {
void emitWordLE(unsigned Binary);
+ void emitDWordLE(uint64_t Binary);
+
void emitConstPoolInstruction(const MachineInstr &MI);
void emitMOVi2piecesInstruction(const MachineInstr &MI);
@@ -281,6 +283,16 @@ void ARMCodeEmitter::emitWordLE(unsigned Binary) {
MCE.emitWordLE(Binary);
}
+void ARMCodeEmitter::emitDWordLE(uint64_t Binary) {
+#ifndef NDEBUG
+ DOUT << " 0x" << std::hex << std::setw(8) << std::setfill('0')
+ << (unsigned)Binary << std::dec << "\n";
+ DOUT << " 0x" << std::hex << std::setw(8) << std::setfill('0')
+ << (unsigned)(Binary >> 32) << std::dec << "\n";
+#endif
+ MCE.emitDWordLE(Binary);
+}
+
void ARMCodeEmitter::emitInstruction(const MachineInstr &MI) {
DOUT << "JIT: " << (void*)MCE.getCurrentPCValue() << ":\t" << MI;
@@ -385,12 +397,21 @@ void ARMCodeEmitter::emitConstPoolInstruction(const MachineInstr &MI) {
if (GlobalValue *GV = dyn_cast<GlobalValue>(CV)) {
emitGlobalAddress(GV, ARM::reloc_arm_absolute, false);
emitWordLE(0);
- } else {
- assert(CV->getType()->isInteger() &&
- "Not expecting non-integer constpool entries yet!");
- const ConstantInt *CI = dyn_cast<ConstantInt>(CV);
+ } else if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
uint32_t Val = *(uint32_t*)CI->getValue().getRawData();
emitWordLE(Val);
+ } else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(CV)) {
+ if (CFP->getType() == Type::FloatTy)
+ emitWordLE(CFP->getValueAPF().bitcastToAPInt().getZExtValue());
+ else if (CFP->getType() == Type::DoubleTy)
+ emitDWordLE(CFP->getValueAPF().bitcastToAPInt().getZExtValue());
+ else {
+ assert(0 && "Unable to handle this constantpool entry!");
+ abort();
+ }
+ } else {
+ assert(0 && "Unable to handle this constantpool entry!");
+ abort();
}
}
}