コード例 #1
0
        public Call(Label p, int n)
        {
            TAC ic = new TAC(Operator.CALL, Constant.Create(n), p);

            pos = tuples.Count;
            tuples.Add(ic);
        }
コード例 #2
0
        public Return()
        {
            TAC ic = new TAC(Operator.RETURN, null, null);

            pos = tuples.Count;
            tuples.Add(ic);
        }
コード例 #3
0
        public RetVal(Address x)
        // return x
        {
            TAC ic = new TAC(Operator.RETVAL, x, null);

            pos = tuples.Count;
            tuples.Add(ic);
        }
コード例 #4
0
        public IfTrue(Address x, Label L)
        // if x goto L
        {
            TAC ic = new TAC(Operator.IFTRUE, x, L);

            pos = tuples.Count;
            tuples.Add(ic);
        }
コード例 #5
0
        public Param(Address x)
        // param x
        {
            TAC ic = new TAC(Operator.PARAM, x, null);

            pos = tuples.Count;
            tuples.Add(ic);
        }
コード例 #6
0
        public IfFalse(Address x, Label L)
        // ifFalse x goto L
        {
            TAC ic = new TAC(Operator.IFFALSE, x, L);

            pos = tuples.Count;
            tuples.Add(ic);
        }
コード例 #7
0
        public ToMemory(Address x, Address y)
        // *x = y
        {
            TAC ic = new TAC(Operator.TOMEMORY, x, y);

            pos = tuples.Count;
            tuples.Add(ic);
        }
コード例 #8
0
        public Goto(Label L)
        // goto L
        {
            TAC ic = new TAC(Operator.GOTO, null, L);

            pos = tuples.Count;
            tuples.Add(ic);
        }
コード例 #9
0
        public Unary(Operator op, Address x, Address y)
        // x = op y
        {
            TAC ic = new TAC(op, x, y);

            pos = tuples.Count;
            tuples.Add(ic);
            target = ic.Arg1;
        }
コード例 #10
0
        public FromMemory(Address x, Address y)
        // x = *y
        {
            TAC ic = new TAC(Operator.FROMMEMORY, x, y);

            pos = tuples.Count;
            tuples.Add(ic);
            target = ic.Arg1;
        }
コード例 #11
0
        public AddressOf(Address x, Address y)
        // x = &y
        {
            TAC ic = new TAC(Operator.ADDRESS, x, y);

            pos = tuples.Count;
            tuples.Add(ic);
            target = ic.Arg1;
        }
コード例 #12
0
        public IfExp(Operator oprel, Address x, Address y, Label L)
        // if x oprel y goto L ===> tmp := x oprel y, if tmp goto L
        {
            TAC ic;

            ic  = new TAC(Operator.IFEXP, null, L);
            pos = tuples.Count;
            tuples.Add(ic);
            ic = new TAC(oprel, x, y);
            tuples.Add(ic);
        }
コード例 #13
0
        public Binary(Operator op, Address x, Address y, Address z)
        {
            TAC ic;

            ic  = new TAC(op, y, z);
            pos = tuples.Count;
            tuples.Add(ic);
            ic = new TAC(Operator.CONTINUE, null, x);
            tuples.Add(ic);
            target = ic.Arg2;
        }
コード例 #14
0
        public ToArray(Address x, Address i, Address y)
        // x[i] = y ===> tmp = x[i], *tmp = y
        {
            TAC ic;

            ic  = new TAC(Operator.TOARRAY, x, i);
            pos = tuples.Count;
            tuples.Add(ic);
            ic = new TAC(Operator.CONTINUE, y, null);
            tuples.Add(ic);
        }
コード例 #15
0
        public FromArray(Address x, Address i, Address y)
        // x = y[i] ===> tmp = y[i], x = tmp
        {
            TAC ic;

            ic  = new TAC(Operator.FROMARRAY, y, i);
            pos = tuples.Count;
            tuples.Add(ic);
            ic = new TAC(Operator.CONTINUE, x, null);
            tuples.Add(ic);
            target = ic.Arg1;
        }
コード例 #16
0
        public Copy(Address x, Address y)
        // x = y
        {
            TAC ic = new TAC(Operator.COPY, x, y);

            pos = tuples.Count;
            if (tuples != null)
            {
                tuples.Add(ic);
            }
            else
            {
                pos = -1;
            }
            target = ic.Arg1;
        }