📄 c4x.h
字号:
extern void c4x_init_cumulative_args();#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \ (c4x_init_cumulative_args (&CUM, FNTYPE, LIBNAME))extern void c4x_function_arg_advance();#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ (c4x_function_arg_advance (&CUM, MODE, TYPE, NAMED))extern struct rtx_def *c4x_function_arg();#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ (c4x_function_arg(&CUM, MODE, TYPE, NAMED))/* Define the profitability of saving registers around calls. NOTE: For now we turn this off because caller-save assumes that a register with a QFmode quantity can be saved/restored using QImode. *//* #define CALLER_SAVE_PROFITABLE(REFS,CALLS) 0 *//* Never pass data by reference. */#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) 0#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0/* 1 if N is a possible register number for function argument passing. */#define FUNCTION_ARG_REGNO_P(REGNO) \ ( ( ((REGNO) == AR2_REGNO) /* AR2 */ \ || ((REGNO) == R2_REGNO) /* R2 */ \ || ((REGNO) == R3_REGNO) /* R3 */ \ || ((REGNO) == RC_REGNO) /* RC */ \ || ((REGNO) == RS_REGNO) /* RS */ \ || ((REGNO) == RE_REGNO)) /* RE */ \ ? 1 \ : 0)/* How Scalar Function Values Are Returned */#define FUNCTION_VALUE(VALTYPE, FUNC) \ gen_rtx(REG, TYPE_MODE(VALTYPE), R0_REGNO) /* Return in R0 */#define LIBCALL_VALUE(MODE) \ gen_rtx(REG, MODE, R0_REGNO) /* Return in R0 */#define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == R0_REGNO)/* How Large Values Are Returned */#define DEFAULT_PCC_STRUCT_RETURN 0#define STRUCT_VALUE_REGNUM AR0_REGNO /* AR0 *//* Function Entry and Exit */#define FUNCTION_PROLOGUE(FILE, SIZE) c4x_function_prologue(FILE, SIZE)#define FUNCTION_EPILOGUE(FILE, SIZE) c4x_function_epilogue(FILE, SIZE)/* Generating Code for Profiling *//* Note that the generated assembly uses the ^ operator to load the 16 MSBs of the address. This is not supported by the TI assembler. */#define FUNCTION_PROFILER(FILE, LABELNO) \ if (! TARGET_C3X) \ { \ fprintf (FILE, "\tpush\tar2\n"); \ fprintf (FILE, "\tldhi\t^LP%d,ar2\n", (LABELNO)); \ fprintf (FILE, "\tor\t#LP%d,ar2\n", (LABELNO)); \ fprintf (FILE, "\tcall\tmcount\n"); \ fprintf (FILE, "\tpop\tar2\n"); \ } \ else \ { \ fprintf (FILE, "\tpush\tar2\n"); \ fprintf (FILE, "\tldiu\t^LP%d,ar2\n", (LABELNO)); \ fprintf (FILE, "\tlsh\t16,ar2\n"); \ fprintf (FILE, "\tor\t#LP%d,ar2\n", (LABELNO)); \ fprintf (FILE, "\tcall\tmcount\n"); \ fprintf (FILE, "\tpop\tar2\n"); \ }/* There are three profiling modes for basic blocks available. The modes are selected at compile time by using the options -a or -ax of the gnu compiler. The variable `profile_block_flag' will be set according to the selected option. profile_block_flag == 0, no option used: No profiling done. profile_block_flag == 1, -a option used. Count frequency of execution of every basic block. profile_block_flag == 2, -ax option used. Generate code to allow several different profiling modes at run time. Available modes are: Produce a trace of all basic blocks. Count frequency of jump instructions executed. In every mode it is possible to start profiling upon entering certain functions and to disable profiling of some other functions. The result of basic-block profiling will be written to a file `bb.out'. If the -ax option is used parameters for the profiling will be read from file `bb.in'.*/#define FUNCTION_BLOCK_PROFILER(FILE, BLOCKNO) \ if (profile_block_flag == 2) \ { \ if (! TARGET_C3X) \ { \ fprintf (FILE, "\tpush\tst\n"); \ fprintf (FILE, "\tpush\tar2\n"); \ fprintf (FILE, "\tpush\tr2\n"); \ fprintf (FILE, "\tldhi\t^LPBX0,ar2\n"); \ fprintf (FILE, "\tor\t#LPBX0,ar2\n"); \ if (BLOCKNO > 32767) \ { \ fprintf (FILE, "\tldhi\t%d,r2\n", (BLOCKNO) >> 16); \ fprintf (FILE, "\tor\t%d,r2\n", (BLOCKNO)); \ } \ else \ { \ fprintf (FILE, "\tldiu\t%d,r2\n", (BLOCKNO)); \ } \ fprintf (FILE, "\tcall\t___bb_init_trace_func\n"); \ fprintf (FILE, "\tpop\tr2\n"); \ fprintf (FILE, "\tpop\tar2\n"); \ fprintf (FILE, "\tpop\tst\n"); \ } \ else \ { \ fprintf (FILE, "\tpush\tst\n"); \ fprintf (FILE, "\tpush\tar2\n"); \ fprintf (FILE, "\tpush\tr2\n"); \ fprintf (FILE, "\tldiu\t^LPBX0,ar2\n"); \ fprintf (FILE, "\tlsh\t16,ar2\n"); \ fprintf (FILE, "\tor\t#LPBX0,ar2\n"); \ if (BLOCKNO > 32767) \ { \ fprintf (FILE, "\tldi\t%d,r2\n", (BLOCKNO) >> 16); \ fprintf (FILE, "\tlsh\t16,r2\n"); \ fprintf (FILE, "\tor\t%d,r2\n", (BLOCKNO)); \ } \ else \ { \ fprintf (FILE, "\tldiu\t%d,r2\n", (BLOCKNO)); \ } \ fprintf (FILE, "\tcall\t___bb_init_trace_func\n"); \ fprintf (FILE, "\tpop\tr2\n"); \ fprintf (FILE, "\tpop\tar2\n"); \ fprintf (FILE, "\tpop\tst\n"); \ } \ } \ else \ { \ if (! TARGET_C3X) \ { \ fprintf (FILE, "\tpush\tst\n"); \ fprintf (FILE, "\tpush\tar2\n"); \ fprintf (FILE, "\tldhi\t^LPBX0,ar2\n"); \ fprintf (FILE, "\tor\t#LPBX0,ar2\n"); \ fprintf (FILE, "\tcmpi\t0,*ar2\n"); \ fprintf (FILE, "\tbne\t$+2\n"); \ fprintf (FILE, "\tcall\t___bb_init_func\n"); \ fprintf (FILE, "\tpop\tar2\n"); \ fprintf (FILE, "\tpop\tst\n"); \ } \ else \ { \ fprintf (FILE, "\tpush\tst\n"); \ fprintf (FILE, "\tpush\tar2\n"); \ fprintf (FILE, "\tpush\tr2\n"); \ fprintf (FILE, "\tldiu\t^LPBX0,ar2\n"); \ fprintf (FILE, "\tlsh\t16,ar2\n"); \ fprintf (FILE, "\tor\t#LPBX0,ar2\n"); \ fprintf (FILE, "\tldi\t*ar2,r2\n"); \ fprintf (FILE, "\tbne\t$+2\n"); \ fprintf (FILE, "\tcall\t___bb_init_func\n"); \ fprintf (FILE, "\tpop\tr2\n"); \ fprintf (FILE, "\tpop\tar2\n"); \ fprintf (FILE, "\tpop\tst\n"); \ } \ }#define BLOCK_PROFILER(FILE, BLOCKNO) \ if (profile_block_flag == 2) \ { \ if (! TARGET_C3X) \ { \ fprintf (FILE, "\tpush\tst\n"); \ fprintf (FILE, "\tpush\tar2\n"); \ fprintf (FILE, "\tpush\tar0\n"); \ fprintf (FILE, "\tldhi\t^___bb,ar2\n"); \ fprintf (FILE, "\tor\t#___bb,ar2\n"); \ if (BLOCKNO > 32767) \ { \ fprintf (FILE, "\tldhi\t%d,ar0\n", (BLOCKNO) >> 16);\ fprintf (FILE, "\tor\t%d,ar0\n", (BLOCKNO)); \ } \ else \ { \ fprintf (FILE, "\tldiu\t%d,ar0\n", (BLOCKNO)); \ } \ fprintf (FILE, "\tsti\tar0,*ar2\n"); \ fprintf (FILE, "\tldhi\t^LPBX0,ar0\n"); \ fprintf (FILE, "\tor\t#LPBX0,ar0\n"); \ fprintf (FILE, "\tsti\tar0,*+ar2(1)\n"); \ fprintf (FILE, "\tcall\t___bb_trace_func\n"); \ fprintf (FILE, "\tpop\tar0\n"); \ fprintf (FILE, "\tpop\tar2\n"); \ fprintf (FILE, "\tpop\tst\n"); \ } \ else \ { \ fprintf (FILE, "\tpush\tst\n"); \ fprintf (FILE, "\tpush\tar2\n"); \ fprintf (FILE, "\tpush\tar0\n"); \ fprintf (FILE, "\tldiu\t^___bb,ar2\n"); \ fprintf (FILE, "\tlsh\t16,ar2\n"); \ fprintf (FILE, "\tor\t#___bb,ar2\n"); \ if (BLOCKNO > 32767) \ { \ fprintf (FILE, "\tldi\t%d,ar0\n", (BLOCKNO) >> 16); \ fprintf (FILE, "\tlsh\t16,ar0\n"); \ fprintf (FILE, "\tor\t%d,ar0\n", (BLOCKNO)); \ } \ else \ { \ fprintf (FILE, "\tldiu\t%d,ar0\n", (BLOCKNO)); \ } \ fprintf (FILE, "\tsti\tar0,*ar2\n"); \ fprintf (FILE, "\tldiu\t^LPBX0,ar0\n"); \ fprintf (FILE, "\tlsh\t16,ar0\n"); \ fprintf (FILE, "\tor\t#LPBX0,ar0\n"); \ fprintf (FILE, "\tsti\tar0,*+ar2(1)\n"); \ fprintf (FILE, "\tcall\t___bb_trace_func\n"); \ fprintf (FILE, "\tpop\tar0\n"); \ fprintf (FILE, "\tpop\tar2\n"); \ fprintf (FILE, "\tpop\tst\n"); \ } \ } \ else \ { \ if (! TARGET_C3X) \ { \ fprintf (FILE, "\tpush\tar2\n"); \ fprintf (FILE, "\tpush\tar0\n"); \ fprintf (FILE, "\tldhi\t^LPBX2+%d,ar2\n", (BLOCKNO)); \ fprintf (FILE, "\tor\t#LPBX2+%d,ar2\n", (BLOCKNO)); \ fprintf (FILE, "\taddi3\t1,*ar2,ar0\n"); \ fprintf (FILE, "\tsti\tar0,*ar2\n"); \ fprintf (FILE, "\tpop\tar0\n"); \ fprintf (FILE, "\tpop\tar2\n"); \ } \ else \ { \ fprintf (FILE, "\tpush\tar2\n"); \ fprintf (FILE, "\tpush\tar0\n"); \ fprintf (FILE, "\tldiu\t^LPBX2+%d,ar2\n", (BLOCKNO)); \ fprintf (FILE, "\tlsh\t16,ar2\n"); \ fprintf (FILE, "\tor\t#LPBX2+%d,ar2\n", (BLOCKNO)); \ fprintf (FILE, "\tldiu\t*ar2,ar0\n"); \ fprintf (FILE, "\taddi\t1,ar0\n"); \ fprintf (FILE, "\tsti\tar0,*ar2\n"); \ fprintf (FILE, "\tpop\tar0\n"); \ fprintf (FILE, "\tpop\tar2\n"); \ } \ }#define FUNCTION_BLOCK_PROFILER_EXIT(FILE) \ { \ fprintf (FILE, "\tpush\tst\n"); \ fprintf (FILE, "\tpush\tar2\n"); \ fprintf (FILE, "\tcall\t___bb_trace_ret\n"); \ fprintf (FILE, "\tpop\tar2\n"); \ fprintf (FILE, "\tpop\tst\n"); \ }#define MACHINE_STATE_SAVE(ID) \ asm(" push r0"); \ asm(" pushf r0"); \ asm(" push r1"); \ asm(" pushf r1"); \ asm(" push r2"); \ asm(" pushf r2"); \ asm(" push r3"); \ asm(" pushf r3"); \ asm(" push ar0"); \ asm(" push ar1"); \ asm(" .if .BIGMODEL"); \ asm(" push dp"); \ asm(" .endif"); \ asm(" push ir0"); \ asm(" push ir1"); \ asm(" push bk"); \ asm(" push rs"); \ asm(" push re"); \ asm(" push rc"); \ asm(" .if .tms320C40"); \ asm(" push r9"); \ asm(" pushf r9"); \ asm(" push r10"); \ asm(" pushf r10"); \ asm(" push r11"); \ asm(" pushf r11"); \ asm(" .endif");#define MACHINE_STATE_RESTORE(ID) \ asm(" .if .tms320C40"); \ asm(" popf r11"); \ asm(" pop r11"); \ asm(" popf r10"); \ asm(" pop r10"); \ asm(" popf r9"); \ asm(" pop r9"); \ asm(" .endif"); \ asm(" pop rc"); \ asm(" pop re"); \ asm(" pop rs"); \ asm(" pop bk"); \ asm(" pop ir1"); \ asm(" pop ir0"); \ asm(" .if .BIGMODEL"); \ asm(" pop dp"); \ asm(" .endif"); \ asm(" pop ar1"); \ asm(" pop ar0"); \ asm(" popf r3"); \ asm(" pop r3"); \ asm(" popf r2"); \ asm(" pop r2"); \ asm(" popf r1"); \ asm(" pop r1"); \ asm(" popf r0"); \ asm(" pop r0"); \/* Implicit Calls to Library Routines */#define MULQI3_LIBCALL "__mulqi3"#define DIVQI3_LIBCALL "__divqi3"#define UDIVQI3_LIBCALL "__udivqi3"#define MODQI3_LIBCALL "__modqi3"#define UMODQI3_LIBCALL "__umodqi3"#define DIVQF3_LIBCALL "__divqf3"#define MULHF3_LIBCALL "__mulhf3"#define DIVHF3_LIBCALL "__divhf3"#define MULHI3_LIBCALL "__mulhi3"#define SMULHI3_LIBCALL "__smulhi3_high"#define UMULHI3_LIBCALL "__umulhi3_high"#define DIVHI3_LIBCALL "__divhi3"#define UDIVHI3_LIBCALL "__udivhi3"#define MODHI3_LIBCALL "__modhi3"#define UMODHI3_LIBCALL "__umodhi3"#define FLOATHIQF2_LIBCALL "__floathiqf2"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -