GetOperand() public méthode

public GetOperand ( TargetUsage usage, Intermediate semantics = Intermediate.OperandSemantics.None, ushort offset ) : Intermediate.Operand
usage TargetUsage
semantics Intermediate
offset ushort
Résultat Intermediate.Operand
Exemple #1
0
 public override Intermediate.IRNode Emit(CompileContext context, Model.Scope scope, Target target)
 {
     var r = new TransientNode();
     if (_struct.size == 0) throw new InternalError("Struct size not yet determined");
     r.AddInstruction(Instructions.SET, target.GetOperand(TargetUsage.Push),
         Constant((ushort)_struct.size));
     return r;
 }
Exemple #2
0
        public override Intermediate.IRNode Emit(CompileContext context, Model.Scope scope, Target target)
        {
            var r = new TransientNode();

            if (member == null)
            {
                context.ReportError(this, "Member was not resolved.");
                return r;
            }

            Target objectTarget = target;
            if (target.target == Targets.Stack)
                objectTarget = Target.Register(context.AllocateRegister());

            r.AddChild(Child(0).Emit(context, scope, objectTarget));
            if (member.isArray)
            {
                if (target != objectTarget)
                    r.AddInstruction(Instructions.SET, target.GetOperand(TargetUsage.Push), objectTarget.GetOperand(TargetUsage.Pop));
                r.AddInstruction(Instructions.ADD, target.GetOperand(TargetUsage.Peek), Constant((ushort)member.offset));
            }
            else
            {
                if (member.offset == 0)
                    r.AddInstruction(Instructions.SET,
                        target.GetOperand(TargetUsage.Push),
                        objectTarget.GetOperand(TargetUsage.Pop, Intermediate.OperandSemantics.Dereference));
                else
                    r.AddInstruction(Instructions.SET,
                        target.GetOperand(TargetUsage.Push),
                        objectTarget.GetOperand(TargetUsage.Pop,
                            Intermediate.OperandSemantics.Dereference | Intermediate.OperandSemantics.Offset,
                            (ushort)member.offset));
            }

            return r;
        }
Exemple #3
0
 public override Intermediate.IRNode Emit(CompileContext context, Model.Scope scope, Target target)
 {
     var r = new Intermediate.TransientNode();
     r.AddInstruction(Instructions.SET, target.GetOperand(TargetUsage.Push), Label(staticLabel));
     return r;
 }