@Override public void VisitAndNode(GtAndNode Node) { /*local*/ int TargetReg = this.AllocRegister(); /*local*/ int EndLabel = this.NewLabel(); Node.LeftNode.Accept(this); this.VisitingBuilder.Append("NMOV " + "REG" + TargetReg + ", REG" + this.PopRegister() + "\n"); this.VisitingBuilder.Append("JMPF " + "L" + EndLabel + ", REG" + TargetReg + "\n"); Node.RightNode.Accept(this); this.VisitingBuilder.Append("NMOV " + "REG" + TargetReg + ", REG" + this.PopRegister() + "\n"); this.VisitingBuilder.Append("L" + EndLabel + ":\n"); this.PushRegister(TargetReg); }
@Override public void VisitBinaryNode(GtBinaryNode Node) { /*local*/ int TargetReg = this.ReserveRegister(2 /*ArgumentSize*/ + CallParameters); /*local*/ int CallReg = TargetReg - ReturnIndex + ThisIndex; Node.LeftNode.Accept(this); this.VisitingBuilder.Append( "NMOV " + "REG" + (CallReg + 1) + ", REG" + this.PopRegister() + "\n"); Node.RightNode.Accept(this); this.VisitingBuilder.Append( "NMOV " + "REG" + (CallReg + 2) + ", REG" + this.PopRegister() + "\n"); /*local*/ String Op = Node.Token.ParsedText; // Node.NativeName this.VisitingBuilder.Append( "NSET " + "REG" + (CallReg + MethodIndex) + ", METHOD\"" + Op + "\"\n"); this.VisitingBuilder.Append("CALL " + "REG" + CallReg + ", " + 2 /*ArgumentSize*/ + "\n"); this.PushRegister(TargetReg); this.FreeRegister(TargetReg + 1); }