Allow machine instructions with variable numbers of arguments.

This is used only by Phi for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vikram S. Adve 2001-07-31 21:49:28 +00:00
parent 0a229ed79a
commit 1885da4f49
2 changed files with 17 additions and 1 deletions

View File

@ -217,6 +217,9 @@ public:
public:
/*ctor*/ MachineInstr (MachineOpCode _opCode,
OpCodeMask _opCodeMask = 0x0);
/*ctor*/ MachineInstr (MachineOpCode _opCode,
unsigned numOperands,
OpCodeMask _opCodeMask = 0x0);
inline ~MachineInstr () {}
const MachineOpCode getOpCode () const;
@ -260,12 +263,14 @@ MachineInstr::getNumOperands() const
inline MachineOperand&
MachineInstr::getOperand(unsigned int i)
{
assert(i < operands.size() && "getOperand() out of range!");
return operands[i];
}
inline const MachineOperand&
MachineInstr::getOperand(unsigned int i) const
{
assert(i < operands.size() && "getOperand() out of range!");
return operands[i];
}

View File

@ -19,12 +19,23 @@
//************************ Class Implementations **************************/
// Constructor for instructions with fixed #operands (nearly all)
MachineInstr::MachineInstr(MachineOpCode _opCode,
OpCodeMask _opCodeMask)
: opCode(_opCode),
opCodeMask(_opCodeMask),
operands(TargetInstrDescriptors[_opCode].numOperands)
{
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)
{
}