From e8949b3083db08225395ac9443e9752aa337eaa1 Mon Sep 17 00:00:00 2001 From: Brian Gaeke Date: Wed, 19 May 2004 21:30:01 +0000 Subject: [PATCH] Minor simplification: eliminate a dyn_cast. Fix a typo in a debug message. llvm-svn: 13607 --- llvm/lib/Target/SparcV9/SparcV9CodeEmitter.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/llvm/lib/Target/SparcV9/SparcV9CodeEmitter.cpp b/llvm/lib/Target/SparcV9/SparcV9CodeEmitter.cpp index fcdbb7cbfd22..6606d8d64600 100644 --- a/llvm/lib/Target/SparcV9/SparcV9CodeEmitter.cpp +++ b/llvm/lib/Target/SparcV9/SparcV9CodeEmitter.cpp @@ -596,14 +596,9 @@ int64_t SparcV9CodeEmitter::getMachineOpValue(MachineInstr &MI, DEBUG(std::cerr << "Saving reference to BB (VReg)\n"); 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(V)) { - if (const ConstantInt *CI = dyn_cast(C)) { - rv = CI->getRawValue() - MCE.getCurrentPCValue(); - } else { - std::cerr << "Cannot have non-integral const in instruction: " - << *C; - abort(); - } + } else if (const ConstantInt *CI = dyn_cast(V)) { + // Make constant PC-relative by subtracting the PC from it. + rv = CI->getRawValue() - MCE.getCurrentPCValue(); } else if (GlobalValue *GV = dyn_cast(V)) { // same as MO.isGlobalAddress() DEBUG(std::cerr << "GlobalValue: "); @@ -777,7 +772,7 @@ void SparcV9CodeEmitter::emitBasicBlock(MachineBasicBlock &MBB) { if (binCode == (1 << 30)) { // this is an invalid call: the addr is out of bounds. that means a code // sequence has already been emitted, and this is a no-op - DEBUG(std::cerr << "Call supressed: already emitted far call.\n"); + DEBUG(std::cerr << "Call suppressed: already emitted far call.\n"); } else { emitWord(binCode); }