⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frv.c

📁 Mac OS X 10.4.9 for x86 Source Code gcc 实现源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
  reg_class_from_letter['C'] = CR_REGS;  reg_class_from_letter['W'] = FDPIC_CALL_REGS; /* gp14+15 */  reg_class_from_letter['Z'] = FDPIC_REGS; /* gp15 */  /* There is no single unaligned SI op for PIC code.  Sometimes we     need to use ".4byte" and sometimes we need to use ".picptr".     See frv_assemble_integer for details.  */  if (flag_pic || TARGET_FDPIC)    targetm.asm_out.unaligned_op.si = 0;  if ((target_flags_explicit & MASK_LINKED_FP) == 0)    target_flags |= MASK_LINKED_FP;  for (i = 0; i < ARRAY_SIZE (frv_unit_names); i++)    frv_unit_codes[i] = get_cpu_unit_code (frv_unit_names[i]);  for (i = 0; i < ARRAY_SIZE (frv_type_to_unit); i++)    frv_type_to_unit[i] = ARRAY_SIZE (frv_unit_codes);  init_machine_status = frv_init_machine_status;}/* Some machines may desire to change what optimizations are performed for   various optimization levels.  This macro, if defined, is executed once just   after the optimization level is determined and before the remainder of the   command options have been parsed.  Values set in this macro are used as the   default values for the other command line options.   LEVEL is the optimization level specified; 2 if `-O2' is specified, 1 if   `-O' is specified, and 0 if neither is specified.   SIZE is nonzero if `-Os' is specified, 0 otherwise.   You should not use this macro to change options that are not   machine-specific.  These should uniformly selected by the same optimization   level on all supported machines.  Use this macro to enable machbine-specific   optimizations.   *Do not examine `write_symbols' in this macro!* The debugging options are   *not supposed to alter the generated code.  *//* On the FRV, possibly disable VLIW packing which is done by the 2nd   scheduling pass at the current time.  */voidfrv_optimization_options (int level, int size ATTRIBUTE_UNUSED){  if (level >= 2)    {#ifdef DISABLE_SCHED2      flag_schedule_insns_after_reload = 0;#endif#ifdef ENABLE_RCSP      flag_rcsp = 1;#endif    }}/* Return true if NAME (a STRING_CST node) begins with PREFIX.  */static intfrv_string_begins_with (tree name, const char *prefix){  int prefix_len = strlen (prefix);  /* Remember: NAME's length includes the null terminator.  */  return (TREE_STRING_LENGTH (name) > prefix_len	  && strncmp (TREE_STRING_POINTER (name), prefix, prefix_len) == 0);}/* Zero or more C statements that may conditionally modify two variables   `fixed_regs' and `call_used_regs' (both of type `char []') after they have   been initialized from the two preceding macros.   This is necessary in case the fixed or call-clobbered registers depend on   target flags.   You need not define this macro if it has no work to do.   If the usage of an entire class of registers depends on the target flags,   you may indicate this to GCC by using this macro to modify `fixed_regs' and   `call_used_regs' to 1 for each of the registers in the classes which should   not be used by GCC.  Also define the macro `REG_CLASS_FROM_LETTER' to return   `NO_REGS' if it is called with a letter for a class that shouldn't be used.   (However, if this class is not included in `GENERAL_REGS' and all of the   insn patterns whose constraints permit this class are controlled by target   switches, then GCC will automatically avoid using these registers when the   target switches are opposed to them.)  */voidfrv_conditional_register_usage (void){  int i;  for (i = GPR_FIRST + NUM_GPRS; i <= GPR_LAST; i++)    fixed_regs[i] = call_used_regs[i] = 1;  for (i = FPR_FIRST + NUM_FPRS; i <= FPR_LAST; i++)    fixed_regs[i] = call_used_regs[i] = 1;  /* Reserve the registers used for conditional execution.  At present, we need     1 ICC and 1 ICR register.  */  fixed_regs[ICC_TEMP] = call_used_regs[ICC_TEMP] = 1;  fixed_regs[ICR_TEMP] = call_used_regs[ICR_TEMP] = 1;  if (TARGET_FIXED_CC)    {      fixed_regs[ICC_FIRST] = call_used_regs[ICC_FIRST] = 1;      fixed_regs[FCC_FIRST] = call_used_regs[FCC_FIRST] = 1;      fixed_regs[ICR_FIRST] = call_used_regs[ICR_FIRST] = 1;      fixed_regs[FCR_FIRST] = call_used_regs[FCR_FIRST] = 1;    }  if (TARGET_FDPIC)    fixed_regs[GPR_FIRST + 16] = fixed_regs[GPR_FIRST + 17] =      call_used_regs[GPR_FIRST + 16] = call_used_regs[GPR_FIRST + 17] = 0;#if 0  /* If -fpic, SDA_BASE_REG is the PIC register.  */  if (g_switch_value == 0 && !flag_pic)    fixed_regs[SDA_BASE_REG] = call_used_regs[SDA_BASE_REG] = 0;  if (!flag_pic)    fixed_regs[PIC_REGNO] = call_used_regs[PIC_REGNO] = 0;#endif}/* * Compute the stack frame layout * * Register setup: * +---------------+-----------------------+-----------------------+ * |Register       |type                   |caller-save/callee-save| * +---------------+-----------------------+-----------------------+ * |GR0            |Zero register          |        -              | * |GR1            |Stack pointer(SP)      |        -              | * |GR2            |Frame pointer(FP)      |        -              | * |GR3            |Hidden parameter       |        caller save    | * |GR4-GR7        |        -              |        caller save    | * |GR8-GR13       |Argument register      |        caller save    | * |GR14-GR15      |        -              |        caller save    | * |GR16-GR31      |        -              |        callee save    | * |GR32-GR47      |        -              |        caller save    | * |GR48-GR63      |        -              |        callee save    | * |FR0-FR15       |        -              |        caller save    | * |FR16-FR31      |        -              |        callee save    | * |FR32-FR47      |        -              |        caller save    | * |FR48-FR63      |        -              |        callee save    | * +---------------+-----------------------+-----------------------+ * * Stack frame setup: * Low *     SP-> |-----------------------------------| *	    |         Argument area		| *	    |-----------------------------------| *	    |	 Register save area		| *	    |-----------------------------------| *	    |	Local variable save area	| *     FP-> |-----------------------------------| *	    |	    Old FP			| *	    |-----------------------------------| *	    |    Hidden parameter save area     | *	    |-----------------------------------| *	    | Return address(LR) storage area   | *	    |-----------------------------------| *	    |     Padding for alignment         | *	    |-----------------------------------| *	    |     Register argument area	| * OLD SP-> |-----------------------------------| *          |       Parameter area		| *          |-----------------------------------| * High * * Argument area/Parameter area: * * When a function is called, this area is used for argument transfer.  When * the argument is set up by the caller function, this area is referred to as * the argument area.  When the argument is referenced by the callee function, * this area is referred to as the parameter area.  The area is allocated when * all arguments cannot be placed on the argument register at the time of * argument transfer. * * Register save area: * * This is a register save area that must be guaranteed for the caller * function.  This area is not secured when the register save operation is not * needed. * * Local variable save area: * * This is the area for local variables and temporary variables. * * Old FP: * * This area stores the FP value of the caller function. * * Hidden parameter save area: * * This area stores the start address of the return value storage * area for a struct/union return function. * When a struct/union is used as the return value, the caller * function stores the return value storage area start address in * register GR3 and passes it to the caller function. * The callee function interprets the address stored in the GR3 * as the return value storage area start address. * When register GR3 needs to be saved into memory, the callee * function saves it in the hidden parameter save area.  This * area is not secured when the save operation is not needed. * * Return address(LR) storage area: * * This area saves the LR.  The LR stores the address of a return to the caller * function for the purpose of function calling. * * Argument register area: * * This area saves the argument register.  This area is not secured when the * save operation is not needed. * * Argument: * * Arguments, the count of which equals the count of argument registers (6 * words), are positioned in registers GR8 to GR13 and delivered to the callee * function.  When a struct/union return function is called, the return value * area address is stored in register GR3.  Arguments not placed in the * argument registers will be stored in the stack argument area for transfer * purposes.  When an 8-byte type argument is to be delivered using registers, * it is divided into two and placed in two registers for transfer.  When * argument registers must be saved to memory, the callee function secures an * argument register save area in the stack.  In this case, a continuous * argument register save area must be established in the parameter area.  The * argument register save area must be allocated as needed to cover the size of * the argument register to be saved.  If the function has a variable count of * arguments, it saves all argument registers in the argument register save * area. * * Argument Extension Format: * * When an argument is to be stored in the stack, its type is converted to an * extended type in accordance with the individual argument type.  The argument * is freed by the caller function after the return from the callee function is * made. * * +-----------------------+---------------+------------------------+ * |    Argument Type      |Extended Type  |Stack Storage Size(byte)| * +-----------------------+---------------+------------------------+ * |char                   |int            |        4		    | * |signed char            |int            |        4		    | * |unsigned char          |int            |        4		    | * |[signed] short int     |int            |        4		    | * |unsigned short int     |int            |        4		    | * |[signed] int           |No extension   |        4		    | * |unsigned int           |No extension   |        4		    | * |[signed] long int      |No extension   |        4		    | * |unsigned long int      |No extension   |        4		    | * |[signed] long long int |No extension   |        8		    | * |unsigned long long int |No extension   |        8		    | * |float                  |double         |        8		    | * |double                 |No extension   |        8		    | * |long double            |No extension   |        8		    | * |pointer                |No extension   |        4		    | * |struct/union           |-              |        4 (*1)	    | * +-----------------------+---------------+------------------------+ * * When a struct/union is to be delivered as an argument, the caller copies it * to the local variable area and delivers the address of that area. * * Return Value: * * +-------------------------------+----------------------+ * |Return Value Type              |Return Value Interface| * +-------------------------------+----------------------+ * |void                           |None                  | * |[signed|unsigned] char         |GR8                   | * |[signed|unsigned] short int    |GR8                   | * |[signed|unsigned] int          |GR8                   | * |[signed|unsigned] long int     |GR8                   | * |pointer                        |GR8                   | * |[signed|unsigned] long long int|GR8 & GR9             | * |float                          |GR8                   | * |double                         |GR8 & GR9             | * |long double                    |GR8 & GR9             | * |struct/union                   |(*1)                  | * +-------------------------------+----------------------+ * * When a struct/union is used as the return value, the caller function stores * the start address of the return value storage area into GR3 and then passes * it to the callee function.  The callee function interprets GR3 as the start * address of the return value storage area.  When this address needs to be * saved in memory, the callee function secures the hidden parameter save area * and saves the address in that area. */frv_stack_t *frv_stack_info (void){  static frv_stack_t info, zero_info;  frv_stack_t *info_ptr	= &info;  tree fndecl		= current_function_decl;  int varargs_p		= 0;  tree cur_arg;  tree next_arg;  int range;  int alignment;  int offset;  /* If we've already calculated the values and reload is complete,     just return now.  */  if (frv_stack_cache)    return frv_stack_cache;  /* Zero all fields.  */  info = zero_info;  /* Set up the register range information.  */  info_ptr->regs[STACK_REGS_GPR].name         = "gpr";  info_ptr->regs[STACK_REGS_GPR].first        = LAST_ARG_REGNUM + 1;  info_ptr->regs[STACK_REGS_GPR].last         = GPR_LAST;  info_ptr->regs[STACK_REGS_GPR].dword_p      = TRUE;  info_ptr->regs[STACK_REGS_FPR].name         = "fpr";  info_ptr->regs[STACK_REGS_FPR].first        = FPR_FIRST;  info_ptr->regs[STACK_REGS_FPR].last         = FPR_LAST;  info_ptr->regs[STACK_REGS_FPR].dword_p      = TRUE;  info_ptr->regs[STACK_REGS_LR].name          = "lr";  info_ptr->regs[STACK_REGS_LR].first         = LR_REGNO;  info_ptr->regs[STACK_REGS_LR].last          = LR_REGNO;  info_ptr->regs[STACK_REGS_LR].special_p     = 1;  info_ptr->regs[STACK_REGS_CC].name          = "cc";  info_ptr->regs[STACK_REGS_CC].first         = CC_FIRST;  info_ptr->regs[STACK_REGS_CC].last          = CC_LAST;  info_ptr->regs[STACK_REGS_CC].field_p       = TRUE;  info_ptr->regs[STACK_REGS_LCR].name         = "lcr";  info_ptr->regs[STACK_REGS_LCR].first        = LCR_REGNO;  info_ptr->regs[STACK_REGS_LCR].last         = LCR_REGNO;  info_ptr->regs[STACK_REGS_STDARG].name      = "stdarg";  info_ptr->regs[STACK_REGS_STDARG].first     = FIRST_ARG_REGNUM;  info_ptr->regs[STACK_REGS_STDARG].last      = LAST_ARG_REGNUM;  info_ptr->regs[STACK_REGS_STDARG].dword_p   = 1;  info_ptr->regs[STACK_REGS_STDARG].special_p = 1;  info_ptr->regs[STACK_REGS_STRUCT].name      = "struct";  info_ptr->regs[STACK_REGS_STRUCT].first     = FRV_STRUCT_VALUE_REGNUM;  info_ptr->regs[STACK_REGS_STRUCT].last      = FRV_STRUCT_VALUE_REGNUM;  info_ptr->regs[STACK_REGS_STRUCT].special_p = 1;  info_ptr->regs[STACK_REGS_FP].name          = "fp";  info_ptr->regs[STACK_REGS_FP].first         = FRAME_POINTER_REGNUM;  info_ptr->regs[STACK_REGS_FP].last          = FRAME_POINTER_REGNUM;  info_ptr->regs[STACK_REGS_FP].special_p     = 1;  /* Determine if this is a stdarg function.  If so, allocate space to store     the 6 arguments.  */  if (cfun->stdarg)    varargs_p = 1;  else    {      /* Find the last argument, and see if it is __builtin_va_alist.  */      for (cur_arg = DECL_ARGUMENTS (fndecl); cur_arg != (tree)0; cur_arg = next_arg)	{	  next_arg = TREE_CHAIN (cur_arg);	  if (next_arg == (tree)0)	    {	      if (DECL_NAME (cur_arg)		  && !strcmp (IDENTIFIER_POINTER (DECL_NAME (cur_arg)), "__builtin_va_alist"))		varargs_p = 1;	      break;	    }	}    }  /* Iterate over all of the register ranges.  */  for (range = 0; range < STACK_REGS_MAX; range++)    {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -