net.sf.farrago.fennel.calc
Class CalcProgramBuilder.InstructionDef
java.lang.Object
net.sf.farrago.fennel.calc.CalcProgramBuilder.InstructionDef
- Direct Known Subclasses:
- CalcProgramBuilder.BoolInstructionDef, CalcProgramBuilder.BoolNativeInstructionDef, CalcProgramBuilder.ComparisonInstructionDef, CalcProgramBuilder.ExtInstrDef, CalcProgramBuilder.IntegralNativeInstructionDef, CalcProgramBuilder.JumpInstructionDef, CalcProgramBuilder.NativeInstructionDef, CalcProgramBuilder.PointerBoolInstructionDef
- Enclosing class:
- CalcProgramBuilder
static class CalcProgramBuilder.InstructionDef
- extends Object
Definition for an instruction. An instruction can only do one thing --
add itself to a program -- so this class is basically just a functor. The
concrete derived class must provide a name, and implement the add(CalcProgramBuilder, List)
method.
name
public final String name
regCount
protected final int regCount
CalcProgramBuilder.InstructionDef
CalcProgramBuilder.InstructionDef(String name,
int regCount)
add
final void add(CalcProgramBuilder builder,
List<CalcReg> registers)
- Convenience method which converts the register list into an array and
calls the
add(CalcProgramBuilder,CalcReg[])
method.
add
void add(CalcProgramBuilder builder,
CalcProgramBuilder.Operand... operands)
- Adds this instruction with a set of operands to a program.
The default implementation casts each operand to a CalcReg
, and calls add(CalcProgramBuilder, CalcReg[])
. If
this instruction's operands are not registers, override this method.
- Parameters:
builder
- Program builderoperands
- Operands
addInternal
protected final void addInternal(CalcProgramBuilder builder,
CalcProgramBuilder.Operand[] regs)
add
void add(CalcProgramBuilder builder,
CalcReg... regs)
- Adds this instruction to a program.
toString
public String toString()
- Overrides:
toString
in class Object