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

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

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

            pos = tuples.Count;
            tuples.Add(ic);
        }
Example #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);
        }
Example #5
0
        public Param(Address x)
        // param x
        {
            TAC ic = new TAC(Operator.PARAM, x, null);

            pos = tuples.Count;
            tuples.Add(ic);
        }
Example #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);
        }
Example #7
0
        public ToMemory(Address x, Address y)
        // *x = y
        {
            TAC ic = new TAC(Operator.TOMEMORY, x, y);

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

            pos = tuples.Count;
            tuples.Add(ic);
        }
Example #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;
        }
Example #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;
        }
Example #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;
        }
Example #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);
        }
Example #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;
        }
Example #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);
        }
Example #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;
        }
Example #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;
        }