[llvm-commits] CVS: llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp
Misha Brukman
brukman at cs.uiuc.edu
Fri Nov 7 15:08:02 PST 2003
Changes in directory llvm/lib/Target/Sparc:
SparcV9CodeEmitter.cpp updated: 1.40 -> 1.41
---
Log message:
Implement branching to a PC-relative constant (not a BasicBlock).
---
Diffs of the changes: (+7 -7)
Index: llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp
diff -u llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp:1.40 llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp:1.41
--- llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp:1.40 Fri Nov 7 12:06:26 2003
+++ llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp Fri Nov 7 15:07:30 2003
@@ -593,8 +593,13 @@
unsigned* CurrPC = (unsigned*)(intptr_t)MCE.getCurrentPCValue();
BBRefs.push_back(std::make_pair(BB, std::make_pair(CurrPC, &MI)));
} else if (const Constant *C = dyn_cast<Constant>(V)) {
- std::cerr << "ERROR: constants should not appear in PcRel:" << MO << "\n";
- abort();
+ if (const ConstantInt *CI = dyn_cast<ConstantInt>(C)) {
+ rv = CI->getRawValue() - MCE.getCurrentPCValue();
+ } else {
+ std::cerr << "Cannot have non-integral const in instruction: "
+ << *C;
+ abort();
+ }
} else if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) {
// same as MO.isGlobalAddress()
DEBUG(std::cerr << "GlobalValue: ");
@@ -797,11 +802,6 @@
// Delayed resolution...
return
(void*)(intptr_t)TheJITResolver->getLazyResolver(cast<Function>(V));
-
- } else if (Constant *C = ConstantPointerRef::get(V)) {
- // no longer applicable
- std::cerr << "Unhandled Constant: " << *C << "\n";
- abort();
} else {
std::cerr << "Unhandled global: " << *V << "\n";
abort();
More information about the llvm-commits
mailing list