mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-27 04:18:42 +00:00
* Make MachineOperand ctors private, so MachineOperand can only be created
by MachineInstr. * Add a bunch of new methods to allow incremental addition of operands to the machine instr instance. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4356 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
1 parent
1c7907e896
commit
413746e983
2 files changed
+109
-31
No files matched your search
@@ -11,41 +11,42 @@ using std::cerr;
|
||||
// Constructor for instructions with fixed #operands (nearly all)
|
||||
MachineInstr::MachineInstr(MachineOpCode _opCode,
|
||||
OpCodeMask _opCodeMask)
|
||||
: opCode(_opCode),
|
||||
opCodeMask(_opCodeMask),
|
||||
operands(TargetInstrDescriptors[_opCode].numOperands)
|
||||
{
|
||||
: opCode(_opCode), opCodeMask(_opCodeMask),
|
||||
operands(TargetInstrDescriptors[_opCode].numOperands, MachineOperand()) {
|
||||
assert(TargetInstrDescriptors[_opCode].numOperands >= 0);
|
||||
}
|
||||
|
||||
// Constructor for instructions with variable #operands
|
||||
MachineInstr::MachineInstr(MachineOpCode _opCode,
|
||||
unsigned numOperands,
|
||||
OpCodeMask _opCodeMask)
|
||||
: opCode(_opCode),
|
||||
opCodeMask(_opCodeMask),
|
||||
operands(numOperands)
|
||||
{
|
||||
MachineInstr::MachineInstr(MachineOpCode OpCode, unsigned numOperands,
|
||||
OpCodeMask OpCodeMask)
|
||||
: opCode(OpCode), opCodeMask(OpCodeMask),
|
||||
operands(numOperands, MachineOperand()) {
|
||||
}
|
||||
|
||||
// OperandComplete - Return true if it's illegal to add a new operand
|
||||
bool MachineInstr::OperandsComplete() const {
|
||||
int NumOperands = TargetInstrDescriptors[opCode].numOperands;
|
||||
if (NumOperands >= 0 && operands.size() >= (unsigned)NumOperands)
|
||||
return true; // Broken!
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Support for replacing opcode and operands of a MachineInstr in place.
|
||||
// This only resets the size of the operand vector and initializes it.
|
||||
// The new operands must be set explicitly later.
|
||||
//
|
||||
void
|
||||
MachineInstr::replace(MachineOpCode _opCode,
|
||||
unsigned numOperands,
|
||||
OpCodeMask _opCodeMask)
|
||||
{
|
||||
opCode = _opCode;
|
||||
opCodeMask = _opCodeMask;
|
||||
void MachineInstr::replace(MachineOpCode Opcode, unsigned numOperands,
|
||||
OpCodeMask Mask) {
|
||||
opCode = Opcode;
|
||||
opCodeMask = Mask;
|
||||
operands.clear();
|
||||
operands.resize(numOperands);
|
||||
operands.resize(numOperands, MachineOperand());
|
||||
}
|
||||
|
||||
void
|
||||
MachineInstr::SetMachineOperandVal(unsigned int i,
|
||||
MachineInstr::SetMachineOperandVal(unsigned i,
|
||||
MachineOperand::MachineOperandType opType,
|
||||
Value* V,
|
||||
bool isdef,
|
||||
|
||||
Reference in new issue
Block a user