ABT.Env.GetCurrentFunction C# (CSharp) Method

GetCurrentFunction() public method

public GetCurrentFunction ( ) : FunctionType
return FunctionType
        public FunctionType GetCurrentFunction() {
            return this._scopes.Peek().func;
        }

Usage Example

Beispiel #1
0
        public override void CGenStmt(Env env, CGenState state)
        {
            ExprType ret_type = env.GetCurrentFunction().ReturnType;

            Int32 stack_size = state.StackSize;

            if (this.ExprOpt.IsSome)
            {
                // Evaluate the Value.
                this.ExprOpt.Value.CGenValue(state);

                // If the function returns a struct, copy it to the address given by 8(%ebp).
                if (this.ExprOpt.Value.Type is StructOrUnionType)
                {
                    state.MOVL(Reg.EAX, Reg.ESI);
                    state.MOVL(2 * ExprType.SIZEOF_POINTER, Reg.EBP, Reg.EDI);
                    state.MOVL(this.ExprOpt.Value.Type.SizeOf, Reg.ECX);
                    state.CGenMemCpy();
                    state.MOVL(2 * ExprType.SIZEOF_POINTER, Reg.EBP, Reg.EAX);
                }

                // Restore stack size.
                state.CGenForceStackSizeTo(stack_size);
            }
            // Jump to end of the function.
            state.JMP(state.ReturnLabel);
        }
All Usage Examples Of ABT.Env::GetCurrentFunction