Beispiel #1
0
        public override Reg CGenValue(CGenState state)
        {
            Reg ret = this.Expr.CGenValue(state);

            switch (ret)
            {
            case Reg.EAX:
                state.NEG(Reg.EAX);
                return(Reg.EAX);

            case Reg.ST0:
                state.FCHS();
                return(Reg.ST0);

            default:
                throw new InvalidProgramException();
            }
        }
        public override Reg CGenValue(Env env, CGenState state)
        {
            Reg ret = expr.CGenValue(env, state);
            switch (ret) {
                case Reg.EAX:
                    state.NEG(Reg.EAX);
                    return Reg.EAX;

                case Reg.ST0:
                    state.FCHS();
                    return Reg.ST0;

                default:
                    throw new InvalidProgramException();
            }
        }