forked from OSchip/llvm-project
[IRTranslator] Update getOrCreateBB API to use references.
A null basic block is invalid, so just pass a reference. llvm-svn: 263260
This commit is contained in:
parent
68c1061049
commit
53237a9e64
|
@ -114,7 +114,9 @@ private:
|
|||
/// Get the sequence of VRegs for that \p Val.
|
||||
unsigned getOrCreateVReg(const Value *Val);
|
||||
|
||||
MachineBasicBlock &getOrCreateBB(const BasicBlock *BB);
|
||||
/// Get the MachineBasicBlock that represents \p BB.
|
||||
/// If such basic block does not exist, it is created.
|
||||
MachineBasicBlock &getOrCreateBB(const BasicBlock &BB);
|
||||
|
||||
public:
|
||||
// Ctor, nothing fancy.
|
||||
|
|
|
@ -51,8 +51,8 @@ unsigned IRTranslator::getOrCreateVReg(const Value *Val) {
|
|||
return ValReg;
|
||||
}
|
||||
|
||||
MachineBasicBlock &IRTranslator::getOrCreateBB(const BasicBlock *BB) {
|
||||
MachineBasicBlock *&MBB = BBToMBB[BB];
|
||||
MachineBasicBlock &IRTranslator::getOrCreateBB(const BasicBlock &BB) {
|
||||
MachineBasicBlock *&MBB = BBToMBB[&BB];
|
||||
if (!MBB) {
|
||||
MachineFunction &MF = MIRBuilder.getMF();
|
||||
MBB = MF.CreateMachineBasicBlock();
|
||||
|
@ -111,7 +111,7 @@ bool IRTranslator::runOnMachineFunction(MachineFunction &MF) {
|
|||
MIRBuilder.setFunction(MF);
|
||||
MRI = &MF.getRegInfo();
|
||||
// Setup the arguments.
|
||||
MachineBasicBlock &MBB = getOrCreateBB(&F.front());
|
||||
MachineBasicBlock &MBB = getOrCreateBB(F.front());
|
||||
MIRBuilder.setBasicBlock(MBB);
|
||||
SmallVector<unsigned, 8> VRegArgs;
|
||||
for (const Argument &Arg: F.args())
|
||||
|
@ -122,7 +122,7 @@ bool IRTranslator::runOnMachineFunction(MachineFunction &MF) {
|
|||
report_fatal_error("Unable to lower arguments");
|
||||
|
||||
for (const BasicBlock &BB: F) {
|
||||
MachineBasicBlock &MBB = getOrCreateBB(&BB);
|
||||
MachineBasicBlock &MBB = getOrCreateBB(BB);
|
||||
MIRBuilder.setBasicBlock(MBB);
|
||||
for (const Instruction &Inst: BB) {
|
||||
bool Succeeded = translate(Inst);
|
||||
|
|
Loading…
Reference in New Issue