.addReg (ArgReg);
}
- BuildMI (BB, V8::CALL, 1).addPCDisp (I.getOperand (0));
+ BuildMI (BB, V8::CALL, 1).addGlobalAddress(I.getCalledFunction (), true);
if (I.getType () == Type::VoidTy)
return;
unsigned DestReg = getReg (I);
BasicBlock *takenSucc = I.getSuccessor (0);
if (!I.isConditional()) { // Unconditional branch?
if (I.getSuccessor(0) != NextBB)
- BuildMI (BB, V8::BA, 1).addPCDisp (takenSucc);
+ BuildMI (BB, V8::BA, 1).addMBB (MBBMap[takenSucc]);
return;
}
BuildMI (BB, V8::CMPri, 2).addSImm (0).addReg (CondReg);
if (notTakenSucc == NextBB) {
if (takenSucc != NextBB)
- BuildMI (BB, V8::BNE, 1).addPCDisp (takenSucc);
+ BuildMI (BB, V8::BNE, 1).addMBB (MBBMap[takenSucc]);
} else {
- BuildMI (BB, V8::BE, 1).addPCDisp (notTakenSucc);
+ BuildMI (BB, V8::BE, 1).addMBB (MBBMap[notTakenSucc]);
if (takenSucc != NextBB)
- BuildMI (BB, V8::BA, 1).addPCDisp (takenSucc);
+ BuildMI (BB, V8::BA, 1).addMBB (MBBMap[takenSucc]);
}
}
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
// Print a label for the basic block.
- O << ".LBB" << NumberForBB[I->getBasicBlock()] << ":\t! "
- << I->getBasicBlock()->getName() << "\n";
+ O << ".LBB" << Mang->getValueName(MF.getFunction ())
+ << "_" << I->getNumber () << ":\t! "
+ << I->getBasicBlock ()->getName () << "\n";
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
II != E; ++II) {
// Print the assembly for the instruction.
case MachineOperand::MO_UnextendedImmed:
O << (int)MO.getImmedValue();
break;
- case MachineOperand::MO_PCRelativeDisp: {
- if (isa<GlobalValue> (MO.getVRegValue ())) {
- O << Mang->getValueName (MO.getVRegValue ());
- break;
- }
- assert (isa<BasicBlock> (MO.getVRegValue ())
- && "Trying to look up something which is not a BB in the NumberForBB map");
- ValueMapTy::const_iterator i = NumberForBB.find(MO.getVRegValue());
- assert (i != NumberForBB.end()
- && "Could not find a BB in the NumberForBB map!");
- O << ".LBB" << i->second << " ! PC rel: " << MO.getVRegValue()->getName();
- break;
+ case MachineOperand::MO_MachineBasicBlock: {
+ MachineBasicBlock *MBBOp = MO.getMachineBasicBlock();
+ O << ".LBB" << Mang->getValueName(MBBOp->getParent()->getFunction())
+ << "_" << MBBOp->getNumber () << "\t! "
+ << MBBOp->getBasicBlock ()->getName ();
+ return;
}
+ case MachineOperand::MO_PCRelativeDisp:
+ std::cerr << "Shouldn't use addPCDisp() when building SparcV8 MachineInstrs";
+ abort ();
+ return;
case MachineOperand::MO_GlobalAddress:
O << Mang->getValueName(MO.getGlobal());
break;
.addReg (ArgReg);
}
- BuildMI (BB, V8::CALL, 1).addPCDisp (I.getOperand (0));
+ BuildMI (BB, V8::CALL, 1).addGlobalAddress(I.getCalledFunction (), true);
if (I.getType () == Type::VoidTy)
return;
unsigned DestReg = getReg (I);
BasicBlock *takenSucc = I.getSuccessor (0);
if (!I.isConditional()) { // Unconditional branch?
if (I.getSuccessor(0) != NextBB)
- BuildMI (BB, V8::BA, 1).addPCDisp (takenSucc);
+ BuildMI (BB, V8::BA, 1).addMBB (MBBMap[takenSucc]);
return;
}
BuildMI (BB, V8::CMPri, 2).addSImm (0).addReg (CondReg);
if (notTakenSucc == NextBB) {
if (takenSucc != NextBB)
- BuildMI (BB, V8::BNE, 1).addPCDisp (takenSucc);
+ BuildMI (BB, V8::BNE, 1).addMBB (MBBMap[takenSucc]);
} else {
- BuildMI (BB, V8::BE, 1).addPCDisp (notTakenSucc);
+ BuildMI (BB, V8::BE, 1).addMBB (MBBMap[notTakenSucc]);
if (takenSucc != NextBB)
- BuildMI (BB, V8::BA, 1).addPCDisp (takenSucc);
+ BuildMI (BB, V8::BA, 1).addMBB (MBBMap[takenSucc]);
}
}
.addReg (ArgReg);
}
- BuildMI (BB, V8::CALL, 1).addPCDisp (I.getOperand (0));
+ BuildMI (BB, V8::CALL, 1).addGlobalAddress(I.getCalledFunction (), true);
if (I.getType () == Type::VoidTy)
return;
unsigned DestReg = getReg (I);
BasicBlock *takenSucc = I.getSuccessor (0);
if (!I.isConditional()) { // Unconditional branch?
if (I.getSuccessor(0) != NextBB)
- BuildMI (BB, V8::BA, 1).addPCDisp (takenSucc);
+ BuildMI (BB, V8::BA, 1).addMBB (MBBMap[takenSucc]);
return;
}
BuildMI (BB, V8::CMPri, 2).addSImm (0).addReg (CondReg);
if (notTakenSucc == NextBB) {
if (takenSucc != NextBB)
- BuildMI (BB, V8::BNE, 1).addPCDisp (takenSucc);
+ BuildMI (BB, V8::BNE, 1).addMBB (MBBMap[takenSucc]);
} else {
- BuildMI (BB, V8::BE, 1).addPCDisp (notTakenSucc);
+ BuildMI (BB, V8::BE, 1).addMBB (MBBMap[notTakenSucc]);
if (takenSucc != NextBB)
- BuildMI (BB, V8::BA, 1).addPCDisp (takenSucc);
+ BuildMI (BB, V8::BA, 1).addMBB (MBBMap[takenSucc]);
}
}
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
// Print a label for the basic block.
- O << ".LBB" << NumberForBB[I->getBasicBlock()] << ":\t! "
- << I->getBasicBlock()->getName() << "\n";
+ O << ".LBB" << Mang->getValueName(MF.getFunction ())
+ << "_" << I->getNumber () << ":\t! "
+ << I->getBasicBlock ()->getName () << "\n";
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
II != E; ++II) {
// Print the assembly for the instruction.
case MachineOperand::MO_UnextendedImmed:
O << (int)MO.getImmedValue();
break;
- case MachineOperand::MO_PCRelativeDisp: {
- if (isa<GlobalValue> (MO.getVRegValue ())) {
- O << Mang->getValueName (MO.getVRegValue ());
- break;
- }
- assert (isa<BasicBlock> (MO.getVRegValue ())
- && "Trying to look up something which is not a BB in the NumberForBB map");
- ValueMapTy::const_iterator i = NumberForBB.find(MO.getVRegValue());
- assert (i != NumberForBB.end()
- && "Could not find a BB in the NumberForBB map!");
- O << ".LBB" << i->second << " ! PC rel: " << MO.getVRegValue()->getName();
- break;
+ case MachineOperand::MO_MachineBasicBlock: {
+ MachineBasicBlock *MBBOp = MO.getMachineBasicBlock();
+ O << ".LBB" << Mang->getValueName(MBBOp->getParent()->getFunction())
+ << "_" << MBBOp->getNumber () << "\t! "
+ << MBBOp->getBasicBlock ()->getName ();
+ return;
}
+ case MachineOperand::MO_PCRelativeDisp:
+ std::cerr << "Shouldn't use addPCDisp() when building SparcV8 MachineInstrs";
+ abort ();
+ return;
case MachineOperand::MO_GlobalAddress:
O << Mang->getValueName(MO.getGlobal());
break;
.addReg (ArgReg);
}
- BuildMI (BB, V8::CALL, 1).addPCDisp (I.getOperand (0));
+ BuildMI (BB, V8::CALL, 1).addGlobalAddress(I.getCalledFunction (), true);
if (I.getType () == Type::VoidTy)
return;
unsigned DestReg = getReg (I);
BasicBlock *takenSucc = I.getSuccessor (0);
if (!I.isConditional()) { // Unconditional branch?
if (I.getSuccessor(0) != NextBB)
- BuildMI (BB, V8::BA, 1).addPCDisp (takenSucc);
+ BuildMI (BB, V8::BA, 1).addMBB (MBBMap[takenSucc]);
return;
}
BuildMI (BB, V8::CMPri, 2).addSImm (0).addReg (CondReg);
if (notTakenSucc == NextBB) {
if (takenSucc != NextBB)
- BuildMI (BB, V8::BNE, 1).addPCDisp (takenSucc);
+ BuildMI (BB, V8::BNE, 1).addMBB (MBBMap[takenSucc]);
} else {
- BuildMI (BB, V8::BE, 1).addPCDisp (notTakenSucc);
+ BuildMI (BB, V8::BE, 1).addMBB (MBBMap[notTakenSucc]);
if (takenSucc != NextBB)
- BuildMI (BB, V8::BA, 1).addPCDisp (takenSucc);
+ BuildMI (BB, V8::BA, 1).addMBB (MBBMap[takenSucc]);
}
}