aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2003-06-01 22:08:29 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2003-06-01 22:08:29 +0000
commit63b99f91c9d89eea387a53df42bcc9d35d3bce21 (patch)
tree7fb1bc8aaea21a0c6ec805967542583e2f4ca40b /lib
parent76e3dc798b3593fa334b3f2790762aa9ce8d6a6e (diff)
downloadexternal_llvm-63b99f91c9d89eea387a53df42bcc9d35d3bce21.zip
external_llvm-63b99f91c9d89eea387a53df42bcc9d35d3bce21.tar.gz
external_llvm-63b99f91c9d89eea387a53df42bcc9d35d3bce21.tar.bz2
Fix induction variable name clash in for loops, in finishFunction().
Modify new MachineOperand so that its flags match the old MachineOperand's flags, for the flags that matter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6513 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/ExecutionEngine/JIT/SparcEmitter.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/ExecutionEngine/JIT/SparcEmitter.cpp b/lib/ExecutionEngine/JIT/SparcEmitter.cpp
index 0620930..a9547ac 100644
--- a/lib/ExecutionEngine/JIT/SparcEmitter.cpp
+++ b/lib/ExecutionEngine/JIT/SparcEmitter.cpp
@@ -98,16 +98,21 @@ void SparcEmitter::finishFunction(MachineFunction &F) {
unsigned *Ref = BBRefs[i].second.first;
MachineInstr *MI = BBRefs[i].second.second;
std::cerr << "attempting to resolve BB: " << i << "\n";
- for (unsigned i=0, e = MI->getNumOperands(); i != e; ++i) {
- MachineOperand &op = MI->getOperand(i);
+ for (unsigned ii = 0, ee = MI->getNumOperands(); ii != ee; ++ii) {
+ MachineOperand &op = MI->getOperand(ii);
if (op.isPCRelativeDisp()) {
// the instruction's branch target is made such that it branches to
// PC + (br target * 4), so undo that arithmetic here:
// Location is the target of the branch
// Ref is the location of the instruction, and hence the PC
unsigned branchTarget = (Location - (long)Ref) >> 2;
- MI->SetMachineOperandConst(i, MachineOperand::MO_SignExtendedImmed,
+ MI->SetMachineOperandConst(ii, MachineOperand::MO_SignExtendedImmed,
branchTarget);
+ // Copy the flags.
+ if (op.opLoBits32()) { MI->setOperandLo32(ii); }
+ else if (op.opHiBits32()) { MI->setOperandHi32(ii); }
+ else if (op.opLoBits64()) { MI->setOperandLo64(ii); }
+ else if (op.opHiBits64()) { MI->setOperandHi64(ii); }
std::cerr << "Rewrote BB ref: ";
unsigned fixedInstr = SparcV9CodeEmitter::getBinaryCodeForInstr(*MI);
*Ref = fixedInstr;