📄 bfin.h
字号:
/* Definitions for the Blackfin port. Copyright (C) 2005 Free Software Foundation, Inc. Contributed by Analog Devices. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */#ifndef _BFIN_CONFIG#define _BFIN_CONFIG#define OBJECT_FORMAT_ELF#define BRT 1#define BRF 0/* Print subsidiary information on the compiler version in use. */#define TARGET_VERSION fprintf (stderr, " (BlackFin bfin)")/* Run-time compilation parameters selecting different hardware subsets. */extern int target_flags;/* Predefinition in the preprocessor for this target machine */#ifndef TARGET_CPU_CPP_BUILTINS#define TARGET_CPU_CPP_BUILTINS() \ do \ { \ builtin_define ("bfin"); \ builtin_define ("BFIN"); \ } \ while (0)#endif/* Generate DSP instructions, like DSP halfword loads */#define TARGET_DSP (1)#define TARGET_DEFAULT MASK_CSYNC/* Don't create frame pointers for leaf functions */#define TARGET_OMIT_LEAF_FRAME_POINTER (target_flags & MASK_OMIT_LEAF_FRAME_POINTER)#define TARGET_LOW_64K (target_flags & MASK_LOW_64K)#define TARGET_CSYNC (target_flags & MASK_CSYNC)#define TARGET_ID_SHARED_LIBRARY (target_flags & MASK_ID_SHARED_LIBRARY)#define MASK_OMIT_LEAF_FRAME_POINTER 0x00000001#define MASK_CSYNC 0x00000002#define MASK_LOW_64K 0x00000004/* Compile using library ID based shared libraries. * Set a specific ID using the -mshared-library-id=xxx option. */#define MASK_ID_SHARED_LIBRARY 0x00000008#define TARGET_SWITCHES {\ { "omit-leaf-frame-pointer", MASK_OMIT_LEAF_FRAME_POINTER, \ "Omit frame pointer for leaf functions" }, \ { "no-omit-leaf-frame-pointer",-MASK_OMIT_LEAF_FRAME_POINTER, \ "Use frame pointer for leaf functions"}, \ { "low64k", MASK_LOW_64K, \ "Program is located in low 64K of memory" }, \ { "no-low64k", -MASK_LOW_64K, \ "Program is not located in low 64K of memory (default)"}, \ { "csync", MASK_CSYNC, \ "Avoid speculative loads by inserting CSYNC or equivalent"}, \ { "no-csync", -MASK_CSYNC, \ "Do not generate extra code to avoid speculative loads"}, \ { "id-shared-library", MASK_ID_SHARED_LIBRARY, \ "Enable ID based shared library" }, \ { "no-id-shared-library", -MASK_ID_SHARED_LIBRARY, \ "Disable ID based shared library" }, \ { "", TARGET_DEFAULT, \ "default: csync"}}/* This macro is similar to `TARGET_SWITCHES' but defines names of command options that have values. Its definition is an initializer with a subgrouping for each command option. Each subgrouping contains a string constant, that defines the fixed part of the option name, and the address of a variable. The variable, type `char *', is set to the variable part of the given option if the fixed part matches. The actual option name is made by appending `-m' to the specified name. */#define TARGET_OPTIONS \{ { "shared-library-id=", &bfin_library_id_string, \ "ID of shared library to build", 0} \}/* Maximum number of library ids we permit */#define MAX_LIBRARY_ID 255extern const char *bfin_library_id_string;/* Sometimes certain combinations of command options do not make sense on a particular target machine. You can define a macro `OVERRIDE_OPTIONS' to take account of this. This macro, if defined, is executed once just after all the command options have been parsed. Don't use this macro to turn on various extra optimizations for `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */ #define OVERRIDE_OPTIONS override_options ()#define FUNCTION_MODE SImode#define Pmode SImode/* store-condition-codes instructions store 0 for false This is the value stored for true. */#define STORE_FLAG_VALUE 1/* Define this if pushing a word on the stack makes the stack pointer a smaller address. */#define STACK_GROWS_DOWNWARD#define STACK_PUSH_CODE PRE_DEC/* Define this if the nominal address of the stack frame is at the high-address end of the local variables; that is, each additional local variable allocated goes at a more negative offset in the frame. */#define FRAME_GROWS_DOWNWARD/* We define a dummy ARGP register; the parameters start at offset 0 from it. */#define FIRST_PARM_OFFSET(DECL) 0/* Offset within stack frame to start allocating local variables at. If FRAME_GROWS_DOWNWARD, this is the offset to the END of the first local allocated. Otherwise, it is the offset to the BEGINNING of the first local allocated. */#define STARTING_FRAME_OFFSET 0/* Register to use for pushing function arguments. */#define STACK_POINTER_REGNUM REG_P6/* Base register for access to local variables of the function. */#define FRAME_POINTER_REGNUM REG_P7/* A dummy register that will be eliminated to either FP or SP. */#define ARG_POINTER_REGNUM REG_ARGP/* `PIC_OFFSET_TABLE_REGNUM' The register number of the register used to address a table of static data addresses in memory. In some cases this register is defined by a processor's "application binary interface" (ABI). When this macro is defined, RTL is generated for this register once, as with the stack pointer and frame pointer registers. If this macro is not defined, it is up to the machine-dependent files to allocate such a register (if necessary). */#define PIC_OFFSET_TABLE_REGNUM (REG_P5)/* A static chain register for nested functions. We need to use a call-clobbered register for this. */#define STATIC_CHAIN_REGNUM REG_P2/* Define this if functions should assume that stack space has been allocated for arguments even when their values are passed in registers. The value of this macro is the size, in bytes, of the area reserved for arguments passed in registers. This space can either be allocated by the caller or be a part of the machine-dependent stack frame: `OUTGOING_REG_PARM_STACK_SPACE' says which. */#define FIXED_STACK_AREA 12#define REG_PARM_STACK_SPACE(FNDECL) FIXED_STACK_AREA/* Define this if the above stack space is to be considered part of the * space allocated by the caller. */#define OUTGOING_REG_PARM_STACK_SPACE /* Define this if the maximum size of all the outgoing args is to be accumulated and pushed during the prologue. The amount can be found in the variable current_function_outgoing_args_size. */ #define ACCUMULATE_OUTGOING_ARGS 1/* Value should be nonzero if functions must have frame pointers. Zero means the frame pointer need not be set up (and parms may be accessed via the stack pointer) in functions that seem suitable. This is computed in `reload', in reload1.c. */#define FRAME_POINTER_REQUIRED (bfin_frame_pointer_required ())#define PARM_BOUNDRY 32#define STACK_BOUNDRY 32/*#define DATA_ALIGNMENT(TYPE, BASIC-ALIGN) for arrays.. *//* Make strings word-aligned so strcpy from constants will be faster. */#define CONSTANT_ALIGNMENT(EXP, ALIGN) \ (TREE_CODE (EXP) == STRING_CST \ && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) #define TRAMPOLINE_SIZE 18#define TRAMPOLINE_TEMPLATE(FILE) \ fprintf(FILE, "\t.dd\t0x0000e109\n"); /* p1.l = fn low */ \ fprintf(FILE, "\t.dd\t0x0000e149\n"); /* p1.h = fn high */; \ fprintf(FILE, "\t.dd\t0x0000e10a\n"); /* p2.l = sc low */; \ fprintf(FILE, "\t.dd\t0x0000e14a\n"); /* p2.h = sc high */; \ fprintf(FILE, "\t.dw\t0x0051\n"); /* jump (p1)*/#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ initialize_trampoline (TRAMP, FNADDR, CXT)/* Definitions for register eliminations. This is an array of structures. Each structure initializes one pair of eliminable registers. The "from" register number is given first, followed by "to". Eliminations of the same "from" register are listed in order of preference. There are two registers that can always be eliminated on the i386. The frame pointer and the arg pointer can be replaced by either the hard frame pointer or to the stack pointer, depending upon the circumstances. The hard frame pointer is not used before reload and so it is not eligible for elimination. */#define ELIMINABLE_REGS \{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \ { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}} \/* Given FROM and TO register numbers, say whether this elimination is allowed. Frame pointer elimination is automatically handled. All other eliminations are valid. */#define CAN_ELIMINATE(FROM, TO) \ ((TO) == STACK_POINTER_REGNUM ? ! frame_pointer_needed : 1)/* Define the offset between two registers, one to be eliminated, and the other its replacement, at the start of a routine. */#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ ((OFFSET) = bfin_initial_elimination_offset ((FROM), (TO)))/* This processor has 8 data register for doing arithmetic 8 pointer register for doing addressing, including 1 stack pointer P6 1 frame pointer P7 4 sets of indexing registers (I0-3, B0-3, L0-3, M0-3) 1 condition code flag register CC 5 return address registers RETS/I/X/N/E 1 arithmetic status register (ASTAT). */#define FIRST_PSEUDO_REGISTER 44#define PREG_P(X) (REG_P (X) && REGNO (X) >= REG_P0 && REGNO (X) <= REG_P7)#define ADDRESS_REGNO_P(X) ((X) >= REG_P0 && (X) <= REG_M3)#define D_REGNO_P(X) ((X) <= REG_R7)#define REGISTER_NAMES { \ "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7", \ "P0", "P1", "P2", "P3", "P4", "P5", "SP", "FP", \ "I0", "B0", "L0", "I1", "B1", "L1", "I2", "B2", \ "L2", "I3", "B3", "L3", "M0", "M1", "M2", "M3", \ "A0", "A1", \ "CC", \ "RETS", "RETI", "RETX", "RETN", "RETE", "ASTAT", "SEQSTAT", "USP", \ "ARGP" \}#define SHORT_REGISTER_NAMES { \ "R0.L", "R1.L", "R2.L", "R3.L", "R4.L", "R5.L", "R6.L", "R7.L", \ "P0.L", "P1.L", "P2.L", "P3.L", "P4.L", "P5.L", "SP.L", "FP.L", \ "I0.L", "B0.L", "L0.L", "I1.L", "B1.L", "L1.L", "I2.L", "B2.L", \ "L2.L", "I3.L", "B3.L", "L3.L", "M0.L", "M1.L", "M2.L", "M3.L", }#define HIGH_REGISTER_NAMES { \ "R0.H", "R1.H", "R2.H", "R3.H", "R4.H", "R5.H", "R6.H", "R7.H", \ "P0.H", "P1.H", "P2.H", "P3.H", "P4.H", "P5.H", "SP.H", "FP.H", \ "I0.H", "B0.H", "L0.H", "I1.H", "B1.H", "L1.H", "I2.H", "B2.H", \ "L2.H", "I3.H", "B3.H", "L3.H", "M0.H", "M1.H", "M2.H", "M3.H", }#define DREGS_PAIR_NAMES { \ "R1:0.p", 0, "R3:2.p", 0, "R5:4.p", 0, "R7:6.p", 0, }#define BYTE_REGISTER_NAMES { \ "R0.B", "R1.B", "R2.B", "R3.B", "R4.B", "R5.B", "R6.B", "R7.B", }/* 1 for registers that have pervasive standard uses and are not available for the register allocator. */#define FIXED_REGISTERS \/*r0 r1 r2 r3 r4 r5 r6 r7 p0 p1 p2 p3 p4 p5 p6 p7 */ \{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, \/*i0 b0 l0 i1 b1 l1 i2 b2 l2 i3 b3 l3 m0 m1 m2 m3 */ \ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, \/*a0 a1 cc rets/i/x/n/e astat seqstat usp argp */ \ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 \}/* 1 for registers not available across function calls. These must include the FIXED_REGISTERS and also any registers that can be used without being saved. The latter must include the registers where values are returned and the register where structure-value addresses are passed. Aside from that, you can include as many other registers as you like. */#define CALL_USED_REGISTERS \/*r0 r1 r2 r3 r4 r5 r6 r7 p0 p1 p2 p3 p4 p5 p6 p7 */ \{ 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, \/*i0 b0 l0 i1 b1 l1 i2 b2 l2 i3 b3 l3 m0 m1 m2 m3 */ \ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \/*a0 a1 cc rets/i/x/n/e astat seqstat usp argp */ \ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 \}/* Order in which to allocate registers. Each register must be listed once, even those in FIXED_REGISTERS. List frame pointer late and fixed registers last. Note that, in general, we prefer registers listed in CALL_USED_REGISTERS, keeping the others available for storage of persistent values. */#define REG_ALLOC_ORDER \{ REG_R0, REG_R1, REG_R2, REG_R3, REG_R7, REG_R6, REG_R5, REG_R4, \ REG_P2, REG_P1, REG_P0, REG_P5, REG_P4, REG_P3, REG_P6, REG_P7, \ REG_A0, REG_A1, \ REG_I0, REG_B0, REG_L0, REG_I1, REG_B1, REG_L1, REG_I2, REG_B2, \ REG_L2, REG_I3, REG_B3, REG_L3, REG_M0, REG_M1, REG_M2, REG_M3, \ REG_RETS, REG_RETI, REG_RETX, REG_RETN, REG_RETE, \ REG_ASTAT, REG_SEQSTAT, REG_USP, \ REG_CC, REG_ARGP \}/* Macro to conditionally modify fixed_regs/call_used_regs. */#define CONDITIONAL_REGISTER_USAGE \ { \ conditional_register_usage(); \ if (flag_pic) \ { \ fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ } \ }/* Define the classes of registers for register constraints in the machine description. Also define ranges of constants. One of the classes must always be named ALL_REGS and include all hard regs. If there is more than one class, another class must be named NO_REGS and contain no registers. The name GENERAL_REGS must be the name of a class (or an alias for another name such as ALL_REGS). This is the class of registers that is allowed by "g" or "r" in a register constraint. Also, registers outside this class are allocated only when instructions express preferences for them. The classes must be numbered in nondecreasing order; that is, a larger-numbered class must never be contained completely in a smaller-numbered class. For any two classes, it is very desirable that there be another class that represents their union. */enum reg_class{ NO_REGS, IREGS, BREGS, LREGS, MREGS, CIRCREGS, /* Circular buffering registers, Ix, Bx, Lx together form. See Automatic Circlur Buffering */ DAGREGS, EVEN_AREGS, ODD_AREGS, AREGS, CCREGS, EVEN_DREGS, ODD_DREGS, DREGS, PREGS_CLOBBERED, PREGS, DPREGS, MOST_REGS, PROLOGUE_REGS, NON_A_CC_REGS, ALL_REGS, LIM_REG_CLASSES};#define N_REG_CLASSES ((int)LIM_REG_CLASSES)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -