コード例 #1
0
        public override Register GenCode()
        {
            var targetRegister = RegisterAllocator.GetNextRegister();

            Console.WriteLine("mov r{0}, {1}", targetRegister.GetIndex(), _val);
            return(targetRegister);
        }
コード例 #2
0
        public override Register GenCode()
        {
            var firstRegister  = _left.GenCode();
            var secondRegister = _right.GenCode();
            var targetRegister = RegisterAllocator.GetNextRegister();

            Console.WriteLine("add r{0}, r{1}, r{2}", targetRegister.GetIndex(), firstRegister.GetIndex(),
                              secondRegister.GetIndex());
            return(targetRegister);
        }