mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-27 04:18:42 +00:00
Allow BuildMI that helps automate construction of SSA information
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4443 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
1 parent
b752e9a2ae
commit
9cc361579b
2 files changed
+22
-5
No files matched your search
@@ -372,10 +372,11 @@ public:
|
|||||||
|
|
||||||
/// addRegOperand - Add a symbolic virtual register reference...
|
/// addRegOperand - Add a symbolic virtual register reference...
|
||||||
///
|
///
|
||||||
void addRegOperand(int reg) {
|
void addRegOperand(int reg, bool isDef = false) {
|
||||||
assert(!OperandsComplete() &&
|
assert(!OperandsComplete() &&
|
||||||
"Trying to add an operand to a machine instr that is already done!");
|
"Trying to add an operand to a machine instr that is already done!");
|
||||||
operands.push_back(MachineOperand(reg, MachineOperand::MO_VirtualRegister));
|
operands.push_back(MachineOperand(reg, MachineOperand::MO_VirtualRegister,
|
||||||
|
isDef));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// addPCDispOperand - Add a PC relative displacement operand to the MI
|
/// addPCDispOperand - Add a PC relative displacement operand to the MI
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ struct MachineInstrBuilder {
|
|||||||
|
|
||||||
/// addReg - Add a new virtual register operand...
|
/// addReg - Add a new virtual register operand...
|
||||||
///
|
///
|
||||||
MachineInstrBuilder &addReg(int RegNo) {
|
MachineInstrBuilder &addReg(int RegNo, bool isDef = false) {
|
||||||
MI->addRegOperand(RegNo);
|
MI->addRegOperand(RegNo, isDef);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,15 +72,31 @@ struct MachineInstrBuilder {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// BuildMI - Builder interface. Specify how to create the initial instruction
|
/// BuildMI - Builder interface. Specify how to create the initial instruction
|
||||||
/// itself.
|
/// itself. NumOperands is the number of operands to the machine instruction to
|
||||||
|
/// allow for memory efficient representation of machine instructions.
|
||||||
///
|
///
|
||||||
inline MachineInstrBuilder BuildMI(MachineOpCode Opcode, unsigned NumOperands) {
|
inline MachineInstrBuilder BuildMI(MachineOpCode Opcode, unsigned NumOperands) {
|
||||||
return MachineInstrBuilder(new MachineInstr(Opcode, NumOperands, true, true));
|
return MachineInstrBuilder(new MachineInstr(Opcode, NumOperands, true, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// BuildMI - This version of the builder inserts the built MachineInstr into
|
||||||
|
/// the specified MachineBasicBlock.
|
||||||
|
///
|
||||||
inline MachineInstrBuilder BuildMI(MachineBasicBlock *BB, MachineOpCode Opcode,
|
inline MachineInstrBuilder BuildMI(MachineBasicBlock *BB, MachineOpCode Opcode,
|
||||||
unsigned NumOperands) {
|
unsigned NumOperands) {
|
||||||
return MachineInstrBuilder(new MachineInstr(BB, Opcode, NumOperands));
|
return MachineInstrBuilder(new MachineInstr(BB, Opcode, NumOperands));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// BuildMI - This version of the builder inserts the built MachineInstr into
|
||||||
|
/// the specified MachineBasicBlock, and also sets up the first "operand" as a
|
||||||
|
/// destination virtual register. NumOperands is the number of additional add*
|
||||||
|
/// calls that are expected, it does not include the destination register.
|
||||||
|
///
|
||||||
|
inline MachineInstrBuilder BuildMI(MachineBasicBlock *BB, MachineOpCode Opcode,
|
||||||
|
unsigned NumOperands, unsigned DestReg) {
|
||||||
|
return MachineInstrBuilder(new MachineInstr(BB, Opcode,
|
||||||
|
NumOperands+1)).addReg(DestReg,
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Reference in new issue
Block a user