예제 #1
0
 public CompilerFunctionEnd(Compiler compiler, CompilerFunction function)
     : base(compiler)
 {
     Contract.Requires(compiler != null);
     Contract.Requires(function != null);
     _function = function;
 }
예제 #2
0
        public CompilerFunctionReturn(Compiler compiler, CompilerFunction function, Operand first, Operand second)
            : base(compiler)
        {
            Contract.Requires(compiler != null);
            Contract.Requires(function != null);

            _function = function;
            _first = first;
            _second = second;
        }
예제 #3
0
        public CompilerFunctionCall(Compiler compiler, CompilerFunction caller, Operand target, CallingConvention callingConvention, VariableType[] arguments, VariableType returnValue)
            : base(compiler)
        {
            Contract.Requires(arguments != null);

            _caller = caller;
            _target = target;

            _functionPrototype = new FunctionDeclaration(callingConvention, arguments, returnValue);
            if (arguments != null && arguments.Length > 0)
                _args = new Operand[arguments.Length];
        }
예제 #4
0
        public CompilerFunctionCall(Compiler compiler, CompilerFunction caller, Operand target, CallingConvention callingConvention, Type delegateType)
            : base(compiler)
        {
            Contract.Requires(compiler != null);
            Contract.Requires(caller != null);

            _caller = caller;
            _target = target;

            _functionPrototype = new FunctionDeclaration(callingConvention, delegateType);
            if (_functionPrototype.Arguments != null && _functionPrototype.Arguments.Length > 0)
                _args = new Operand[_functionPrototype.Arguments.Length];
        }
예제 #5
0
        public CompilerVar(CompilerFunction scope, int id, VariableType type, int size, string name)
        {
            if (scope == null)
                throw new ArgumentNullException("scope");
            Contract.EndContractBlock();

            _scope = scope;
            _id = id;
            _type = type;
            _size = size;
            _name = name;

            HomeRegisterIndex = RegIndex.Invalid;
            PreferredRegisterMask = RegisterMask.All;
            RegisterIndex = RegIndex.Invalid;
            WorkOffset = Operand.InvalidValue;
            Priority = 10;
            State = VariableState.Unused;
        }
예제 #6
0
        internal void Clear()
        {
            Contract.Ensures(Function == null);

            //_zone.clear();
            _function = null;

            _start = null;
            _stop = null;

            _state.Clear();
            _active = null;

            _forwardJumps = null;

            _currentOffset = 0;
            //_unreachable = 0;

            _modifiedGPRegisters = RegisterMask.Zero;
            _modifiedMMRegisters = RegisterMask.Zero;
            _modifiedXMMRegisters = RegisterMask.Zero;

            _allocableEBP = false;

            _adjustESP = 0;

            _argumentsBaseReg = RegIndex.Invalid;
            _argumentsBaseOffset = 0;
            _argumentsActualDisp = 0;

            _variablesBaseReg = RegIndex.Invalid;
            _variablesBaseOffset = 0;
            _variablesActualDisp = 0;

            _memUsed = null;
            _memFree = null;

            _mem4BlocksCount = 0;
            _mem8BlocksCount = 0;
            _mem16BlocksCount = 0;

            _memBytesTotal = 0;

            _backCode.Clear();
            _backPos = 0;
        }