// Generates code to compute and push the address of a named variable. // vname is the program phrase that names this variable. // currentLevel is the routine level where the vname occurs. // frameSize is the anticipated size of the local stack frame when // the variable is addressed at run-time. void EncodeFetchAddress(Vname vname, Frame frame) { var baseObject = vname.Visit(this, frame) as AddressableEntity; // If indexed = true, code will have been generated to load an index // value. baseObject.EncodeFetchAddress(_emitter, frame, vname); }
public override void EncodeFetchAddress(Emitter emitter, Frame frame, Vname vname) { emitter.Emit(OpCode.LOADA, 0, frame.DisplayRegister(Address), Address.Displacement + vname.Offset); if (vname.IsIndexed) { emitter.Emit(OpCode.CALL, Register.SB, Register.PB, Primitive.ADD); } }
// Generates code to fetch the value of a named constant or variable // and push it on to the stack. // currentLevel is the routine level where the vname occurs. // frameSize is the anticipated size of the local stack frame when // the constant or variable is fetched at run-time. // valSize is the size of the constant or variable's value. void EncodeFetch(Vname vname, Frame frame, int valSize) { IFetchableEntity baseObject = vname.Visit(this, frame); // If indexed = true, code will have been generated to load an index // value. if (valSize > 255) { _errorReporter.ReportRestriction("can't load values larger than 255 words"); valSize = 255; // to allow code generation to continue } baseObject.EncodeFetch(_emitter, frame, valSize, vname); }
public void EncodeFetch(Emitter emitter, Frame frame, int size, Vname vname) { if (vname.IsIndexed) { emitter.Emit(OpCode.LOADA, 0, frame.DisplayRegister(_address), _address.Displacement + vname.Offset); emitter.Emit(OpCode.CALL, Register.SB, Register.PB, Primitive.ADD); emitter.Emit(OpCode.LOADI, size, 0, 0); } else { emitter.Emit(OpCode.LOAD, size, frame.DisplayRegister(_address), _address.Displacement + vname.Offset); } }
public override void EncodeStore(Emitter emitter, Frame frame, int size, Vname vname) { if (vname.IsIndexed) { emitter.Emit(OpCode.LOADA, 0, frame.DisplayRegister(Address), Address.Displacement + vname.Offset); emitter.Emit(OpCode.CALL, Register.SB, Register.PB, Primitive.ADD); emitter.Emit(OpCode.STOREI, size, 0, 0); } else { emitter.Emit(OpCode.STORE, size, frame.DisplayRegister(Address), Address.Displacement + vname.Offset); } }
public override void EncodeFetchAddress(Emitter emitter, Frame frame, Vname vname) { emitter.Emit(OpCode.LOAD, Machine.AddressSize, frame.DisplayRegister(_address), _address.Displacement); if (vname.IsIndexed) { emitter.Emit(OpCode.CALL, Register.SB, Register.PB, Primitive.ADD); } int offset = vname.Offset; if (offset != 0) { emitter.Emit(OpCode.LOADL, offset); emitter.Emit(OpCode.CALL, Register.SB, Register.PB, Primitive.ADD); } }
public abstract void EncodeAssign(Emitter emitter, Frame frame, int size, Vname vname);
public VarActualParameter(Vname vname, SourcePosition position) : base(position) { _vname = vname; }
public void EncodeFetch(Emitter emitter, Frame frame, int size, Vname vname) { // presumably offset = 0 and indexed = false emitter.Emit(OpCode.LOADL, 0, 0, _value); }
public override void EncodeFetch(Emitter emitter, Frame frame, int size, Vname vname) { emitter.Emit(OpCode.LOAD, Machine.AddressSize, frame.DisplayRegister(_address), _address.Displacement); emitter.Emit(OpCode.LOADI, size); }
public AssignCommand(Vname vname, Expression expression, SourcePosition position) : base(position) { _vname = vname; _expression = expression; }
public VnameExpression(Vname vname, SourcePosition position) : base(position) { _vname = vname; }
public override void EncodeFetchAddress(Emitter emitter, Frame frame, Vname vname) { emitter.Emit(OpCode.LOADA, Size, frame.DisplayRegister(Address), Address.Displacement); }
public override void EncodeAssign(Emitter emitter, Frame frame, int size, Vname vname) { emitter.Emit(OpCode.STORE, size, frame.DisplayRegister(Address), Address.Displacement); }
public abstract void EncodeFetchAddress(Emitter emitter, Frame frame, Vname vname);
public abstract void EncodeFetch(Emitter emitter, Frame frame, int size, Vname vname);
public void EncodeFetch(Emitter emitter, Frame frame, int size, Vname vname) { emitter.Emit(OpCode.LOADL, 0, 0, _value); //emitter.Emit(xxxxxx, 0, 0, _value); }