diff options
author | Misha Brukman <brukman+llvm@gmail.com> | 2003-06-06 04:41:22 +0000 |
---|---|---|
committer | Misha Brukman <brukman+llvm@gmail.com> | 2003-06-06 04:41:22 +0000 |
commit | de07be3b783456da18faa53f90d2f33a2ad4de7a (patch) | |
tree | 315f4c692676fc48c82eaf576b1a9ac2832903d5 /lib/Target/SparcV9/SparcV9CodeEmitter.cpp | |
parent | 302de590017e64f65e810e722eaedb67205cb30e (diff) | |
download | external_llvm-de07be3b783456da18faa53f90d2f33a2ad4de7a.zip external_llvm-de07be3b783456da18faa53f90d2f33a2ad4de7a.tar.gz external_llvm-de07be3b783456da18faa53f90d2f33a2ad4de7a.tar.bz2 |
Fixed a bunch of test cases in test/Regression/Jello which could not get the
address of a floating-point (allocated via ConstantPool) correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6647 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SparcV9/SparcV9CodeEmitter.cpp')
-rw-r--r-- | lib/Target/SparcV9/SparcV9CodeEmitter.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/Target/SparcV9/SparcV9CodeEmitter.cpp b/lib/Target/SparcV9/SparcV9CodeEmitter.cpp index ee6d2f3..f5ca2c3 100644 --- a/lib/Target/SparcV9/SparcV9CodeEmitter.cpp +++ b/lib/Target/SparcV9/SparcV9CodeEmitter.cpp @@ -22,7 +22,7 @@ bool UltraSparc::addPassesToEmitMachineCode(PassManager &PM, MachineCodeEmitter &MCE) { MachineCodeEmitter *M = &MCE; - DEBUG(MachineCodeEmitter::createFilePrinterEmitter(MCE)); + DEBUG(M = MachineCodeEmitter::createFilePrinterEmitter(MCE)); PM.add(new SparcV9CodeEmitter(*this, *M)); PM.add(createMachineCodeDestructionPass()); // Free stuff no longer needed return false; @@ -443,8 +443,19 @@ int64_t SparcV9CodeEmitter::getMachineOpValue(MachineInstr &MI, DEBUG(std::cerr << "already generated: 0x" << std::hex << rv << "\n"); } } else { - DEBUG(std::cerr << "not a function: " << *GV << "\n"); rv = (int64_t)MCE.getGlobalValueAddress(GV); + if (rv == 0) { + if (Constant *C = ConstantPointerRef::get(GV)) { + if (ConstantMap.find(C) != ConstantMap.end()) { + rv = MCE.getConstantPoolEntryAddress(ConstantMap[C]); + } else { + std::cerr << "Constant: 0x" << std::hex << &*C << std::dec + << ", " << *V << " not found in ConstantMap!\n"; + abort(); + } + } + } + DEBUG(std::cerr << "Global addr: " << rv << "\n"); } // The real target of the call is Addr = PC + (rv * 4) // So undo that: give the instruction (Addr - PC) / 4 |