📄 mvs.h
字号:
of the first local allocated. */#define STARTING_FRAME_OFFSET \ (STACK_POINTER_OFFSET + current_function_outgoing_args_size)#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = STARTING_FRAME_OFFSET/* If we generate an insn to push BYTES bytes, this says how many the stack pointer really advances by. On the 370, we have no push instruction. *//* #define PUSH_ROUNDING(BYTES) *//* Accumulate the outgoing argument count so we can request the right DSA size and determine stack offset. */#define ACCUMULATE_OUTGOING_ARGS/* Define offset from stack pointer, to location where a parm can be pushed. */#define STACK_POINTER_OFFSET 148/* Offset of first parameter from the argument pointer register value. */#define FIRST_PARM_OFFSET(FNDECL) 0/* 1 if N is a possible register number for function argument passing. On the 370, no registers are used in this way. */#define FUNCTION_ARG_REGNO_P(N) 0/* Define a data type for recording info about an argument list during the scan of that argument list. This data type should hold all necessary information about the function itself and about the args processed so far, enough to enable macros such as FUNCTION_ARG to determine where the next arg should go. */#define CUMULATIVE_ARGS int/* Initialize a variable CUM of type CUMULATIVE_ARGS for a call to a function whose data type is FNTYPE. For a library call, FNTYPE is 0. */#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME) ((CUM) = 0)/* Update the data in CUM to advance over an argument of mode MODE and data type TYPE. (TYPE is null for libcalls where that information may not be available.) */#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ ((CUM) += ((MODE) == DFmode || (MODE) == SFmode \ ? 256 \ : (MODE) != BLKmode \ ? (GET_MODE_SIZE (MODE) + 3) / 4 \ : (int_size_in_bytes (TYPE) + 3) / 4))/* Define where to put the arguments to a function. Value is zero to push the argument on the stack, or a hard register in which to store the argument. */#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0/* For an arg passed partly in registers and partly in memory, this is the number of registers used. For args passed entirely in registers or entirely in memory, zero. */#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0/* Define if returning from a function call automatically pops the arguments described by the number-of-args field in the call. */#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0/* Define how to find the value returned by a function. VALTYPE is the data type of the value (as a tree). If the precise function being called is known, FUNC is its FUNCTION_DECL; otherwise, FUNC is 15. */#define RET_REG(MODE) ((MODE) == DFmode || (MODE) == SFmode ? 16 : 15)/* On the 370 the return value is in R15 or R16. */#define FUNCTION_VALUE(VALTYPE, FUNC) \ gen_rtx(REG, TYPE_MODE (VALTYPE), RET_REG(TYPE_MODE(VALTYPE)))/* Define how to find the value returned by a library function assuming the value has mode MODE. */#define LIBCALL_VALUE(MODE) gen_rtx(REG, MODE, RET_REG(MODE))/* 1 if N is a possible register number for a function value. On the 370 under C/370, R15 and R16 are thus used. */#define FUNCTION_VALUE_REGNO_P(N) ((N) == 15 || (N) == 16)/* This macro definition sets up a default value for `main' to return. */#define DEFAULT_MAIN_RETURN c_expand_return (integer_zero_node)/* This macro generates the assembly code for function entry. All of the C/370 environment is preserved. */#if MACROPROLOGUE == 1#define FUNCTION_PROLOGUE(FILE, LSIZE) \{ \ fprintf (FILE, "\tEDCPRLG USRDSAL=%d,BASEREG=%d\n", \ STACK_POINTER_OFFSET + LSIZE + \ current_function_outgoing_args_size, BASE_REGISTER); \ fprintf (FILE, "PG%d\tEQU\t*\n", mvs_page_num ); \ fprintf (FILE, "\tLR\t11,1\n"); \ fprintf (FILE, "\tL\t%d,=A(PGT%d)\n", PAGE_REGISTER, mvs_page_num); \ mvs_page_code = 6; \ mvs_page_lit = 4; \ mvs_check_page (FILE, 0, 0); \ function_base_page = mvs_page_num; \}#else /* MACROPROLOGUE != 1 */#define FUNCTION_PROLOGUE(FILE, LSIZE) \{ \ static int function_label_index = 1; \ static int function_first = 0; \ static int function_year, function_month, function_day; \ static int function_hour, function_minute, function_second; \ int i; \ if (!function_first) \ { \ struct tm *function_time; \ time_t lcltime; \ time (&lcltime); \ function_time = localtime (&lcltime); \ function_year = function_time->tm_year + 1900; \ function_month = function_time->tm_mon + 1; \ function_day = function_time->tm_mday; \ function_hour = function_time->tm_hour; \ function_minute = function_time->tm_min; \ function_second = function_time->tm_sec; \ } \ fprintf (FILE, "$DSD%03d\tDSECT\n", function_label_index); \ fprintf (FILE, "\tDS\tD\n"); \ fprintf (FILE, "\tDS\tCL(120+%d)\n", STACK_POINTER_OFFSET + LSIZE \ + current_function_outgoing_args_size); \ fprintf (FILE, "\tORG\t$DSD%03d\n", function_label_index); \ fprintf (FILE, "\tDS\tCL(120+8)\n"); \ fprintf (FILE, "\tORG\n"); \ fprintf (FILE, "\tDS\t0D\n"); \ fprintf (FILE, "$DSL%03d\tEQU\t*-$DSD%03d-8\n", function_label_index, \ function_label_index); \ fprintf (FILE, "\tDS\t0H\n"); \ assemble_name (FILE, mvs_function_name); \ fprintf (FILE, "\tCSECT\n"); \ fprintf (FILE, "\tUSING\t*,15\n"); \ fprintf (FILE, "\tB\tFPL%03d\n", function_label_index); \ fprintf (FILE, "\tDC\tAL1(FPL%03d+4-*)\n", function_label_index + 1); \ fprintf (FILE, "\tDC\tX'CE',X'A0',AL1(16)\n"); \ fprintf (FILE, "\tDC\tAL4($PPA%03d)\n",function_label_index); \ fprintf (FILE, "\tDC\tAL4(0)\n"); \ fprintf (FILE, "\tDC\tAL4($DSL%03d)\n", function_label_index); \ fprintf (FILE, "FPL%03d\tEQU\t*\n", function_label_index + 1); \ fprintf (FILE, "\tDC\tAL2(%d),C'%s'\n", strlen (mvs_function_name), \ mvs_function_name); \ fprintf (FILE, "$PPA%03d\tDS\t0F\n", function_label_index); \ fprintf (FILE, "\tDC\tX'03',X'00',X'33',X'00'\n"); \ fprintf (FILE, "\tDC\tV(CEESTART),A(0)\n"); \ fprintf (FILE, "\tDC\tA($TIM%03d)\n", function_label_index); \ fprintf (FILE, "$TIM%03d\tDS\t0F\n", function_label_index); \ fprintf (FILE, "\tDC\tCL4'%d',CL4'%02d%02d',CL6'%02d%02d00'\n", \ function_year, function_month, function_day, \ function_hour, function_minute, function_second); \ fprintf (FILE, "\tDC\tCL2'01',CL4'0100'\n"); \ fprintf (FILE, "FPL%03d\tDS\t0H\n", function_label_index); \ fprintf (FILE, "\tSTM\t14,12,12(13)\n"); \ fprintf (FILE, "\tL\t2,76(,13)\n"); \ fprintf (FILE, "\tL\t0,16(,15)\n"); \ fprintf (FILE, "\tALR\t0,2\n"); \ fprintf (FILE, "\tCL\t0,12(,12)\n"); \ fprintf (FILE, "\tBNH\t*+10\n"); \ fprintf (FILE, "\tL\t15,116(,12)\n"); \ fprintf (FILE, "\tBALR\t14,15\n"); \ fprintf (FILE, "\tL\t15,72(,13)\n"); \ fprintf (FILE, "\tSTM\t15,0,72(2)\n"); \ fprintf (FILE, "\tMVI\t0(2),X'10'\n"); \ fprintf (FILE, "\tST\t2,8(,13)\n "); \ fprintf (FILE, "\tST\t13,4(,2)\n "); \ fprintf (FILE, "\tLR\t13,2\n"); \ fprintf (FILE, "\tDROP\t15\n"); \ fprintf (FILE, "\tBALR\t%d,0\n", BASE_REGISTER); \ fprintf (FILE, "PG%d\tEQU\t*\n", mvs_page_num ); \ fprintf (FILE, "\tUSING\t*,%d\n", BASE_REGISTER); \ fprintf (FILE, "\tLR\t11,1\n"); \ fprintf (FILE, "\tL\t%d,=A(PGT%d)\n", PAGE_REGISTER, mvs_page_num); \ mvs_page_code = 4; \ mvs_page_lit = 4; \ mvs_check_page (FILE, 0, 0); \ function_base_page = mvs_page_num; \ function_first = 1; \ function_label_index += 2; \}#endif /* MACROPROLOGUE */#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \{ \ if (strlen (NAME) * 2 > mvs_function_name_length) \ { \ if (mvs_function_name) \ free (mvs_function_name); \ mvs_function_name = 0; \ } \ if (!mvs_function_name) \ { \ mvs_function_name_length = strlen (NAME) * 2; \ mvs_function_name = (char *) malloc (mvs_function_name_length); \ if (mvs_function_name == 0) \ { \ fatal ("virtual memory exceeded"); \ abort (); \ } \ } \ if (!strcmp (NAME, "main")) \ strcpy (mvs_function_name, "gccmain"); \ else \ strcpy (mvs_function_name, NAME); \ fprintf (FILE, "\tDS\t0F\n"); \ assemble_name (FILE, mvs_function_name); \ fputs ("\tCSECT\n", FILE); \}/* This macro generates the assembly code for function exit, on machines that need it. If FUNCTION_EPILOGUE is not defined then individual return instructions are generated for each return statement. Args are same as for FUNCTION_PROLOGUE. The function epilogue should not depend on the current stack pointer! It should use the frame pointer only. This is mandatory because of alloca; we also take advantage of it to omit stack adjustments before returning. */#if MACROEPILOGUE == 1#define FUNCTION_EPILOGUE(FILE, LSIZE) \{ \ int i; \ check_label_emit(); \ mvs_check_page (FILE,14,0); \ fprintf (FILE, "\tEDCEPIL\n"); \ mvs_page_num++; \ fprintf (FILE, "\tDS\t0F\n" ); \ fprintf (FILE, "\tLTORG\n"); \ fprintf (FILE, "\tDS\t0F\n"); \ fprintf (FILE, "PGT%d\tEQU\t*\n", function_base_page); \ mvs_free_label(); \ for ( i = function_base_page; i < mvs_page_num; i++ ) \ fprintf (FILE, "\tDC\tA(PG%d)\n", i); \}#else /* MACROEPILOGUE != 1 */#define FUNCTION_EPILOGUE(FILE, LSIZE) \{ \ int i; \ check_label_emit(); \ mvs_check_page (FILE,14,0); \ fprintf (FILE, "\tL\t13,4(,13)\n"); \ fprintf (FILE, "\tL\t14,12(,13)\n"); \ fprintf (FILE, "\tLM\t2,12,28(13)\n"); \ fprintf (FILE, "\tBALR\t1,14\n"); \ fprintf (FILE, "\tDC\tA("); \ mvs_page_num++; \ assemble_name (FILE, mvs_function_name); \ fprintf (FILE, ")\n" ); \ fprintf (FILE, "\tDS\t0F\n" ); \ fprintf (FILE, "\tLTORG\n"); \ fprintf (FILE, "\tDS\t0F\n"); \ fprintf (FILE, "PGT%d\tEQU\t*\n", function_base_page); \ mvs_free_label(); \ for ( i = function_base_page; i < mvs_page_num; i++ ) \ fprintf (FILE, "\tDC\tA(PG%d)\n", i); \}#endif /* MACROEPILOGUE *//* Output assembler code for a block containing the constant parts of a trampoline, leaving space for the variable parts. On the 370, the trampoline contains these instructions: BALR 14,0 USING *,14 L STATIC_CHAIN_REGISTER,X L 15,Y BR 15 X DS 0F Y DS 0F */#define TRAMPOLINE_TEMPLATE(FILE) \{ \ ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x05E0)); \ ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x5800 | \ STATIC_CHAIN_REGNUM << 4)); \ ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0xE00A)); \ ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x58F0)); \ ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0xE00E)); \ ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x07FF)); \ ASM_OUTPUT_SHORT (FILE, const0_rtx); \ ASM_OUTPUT_SHORT (FILE, const0_rtx); \ ASM_OUTPUT_SHORT (FILE, const0_rtx); \ ASM_OUTPUT_SHORT (FILE, const0_rtx); \}/* Length in units of the trampoline for entering a nested function. */#define TRAMPOLINE_SIZE 20/* Emit RTL insns to initialize the variable parts of a trampoline. */#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \{ \ emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 12)), CXT); \ emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 16)), FNADDR); \}/* Output assembler code to FILE to increment profiler label # LABELNO for profiling a function entry. */#define FUNCTION_PROFILER(FILE, LABELNO) \ fprintf (FILE, "Error: No profiling available.\n")/* Define EXIT_IGNORE_STACK if, when returning from a function, the stack pointer does not matter (provided there is a frame pointer). */#define EXIT_IGNORE_STACK 1/* Addressing modes, and classification of registers for them. *//* #define HAVE_POST_INCREMENT *//* #define HAVE_POST_DECREMENT *//* #define HAVE_PRE_DECREMENT *//* #define HAVE_PRE_INCREMENT *//* These assume that REGNO is a hard or pseudo reg number. They give nonzero only if REGNO is a hard reg of the suitable class or a pseudo reg currently allocated to a suitable hard reg. These definitions are NOT overridden anywhere. */#define REGNO_OK_FOR_INDEX_P(REGNO) \ (((REGNO) > 0 && (REGNO) < 16) \ || (reg_renumber[REGNO] > 0 && reg_renumber[REGNO] < 16))#define REGNO_OK_FOR_BASE_P(REGNO) REGNO_OK_FOR_INDEX_P(REGNO)#define REGNO_OK_FOR_DATA_P(REGNO) \ ((REGNO) < 16 || (unsigned) reg_renumber[REGNO] < 16)#define REGNO_OK_FOR_FP_P(REGNO) \ ((unsigned) ((REGNO) - 16) < 4 || (unsigned) (reg_renumber[REGNO] - 16) < 4)/* Now macros that check whether X is a register and also, strictly, whether it is in a specified class. *//* 1 if X is a data register. */#define DATA_REG_P(X) (REG_P (X) && REGNO_OK_FOR_DATA_P (REGNO (X)))/* 1 if X is an fp register. */#define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))/* 1 if X is an address register. */#define ADDRESS_REG_P(X) (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X)))/* Maximum number of registers that can appear in a valid memory address. */#define MAX_REGS_PER_ADDRESS 2/* Recognize any constant value that is a valid address. */#define CONSTANT_ADDRESS_P(X) \ (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \ || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST_DOUBLE \ || (GET_CODE (X) == CONST \ && GET_CODE (XEXP (XEXP (X, 0), 0)) == LABEL_REF) \ || (GET_CODE (X) == CONST \ && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF \ && !SYMBOL_REF_FLAG (XEXP (XEXP (X, 0), 0))))/* Nonzero if the constant value X is a legitimate general operand. It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -