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

📄 ns32k.h

📁 gcc编译工具没有什么特别
💻 H
📖 第 1 页 / 共 5 页
字号:
 *  adjspd <local stack space + 4> * *  # Save any general purpose registers necessary * *  save [<general purpose regs to save>] * *  movf  fn, tos    # Save any floating point registers necessary *  . *  . */#if defined(IMMEDIATE_PREFIX) && IMMEDIATE_PREFIX#define ADJSP(FILE, n) \        fprintf (FILE, "\tadjspd %c%d\n", IMMEDIATE_PREFIX, (n))#else#define ADJSP(FILE, n) \        fprintf (FILE, "\tadjspd %d\n", (n))#endif#define FUNCTION_PROLOGUE(FILE, SIZE)     \{ register int regno, g_regs_used = 0;				\  int used_regs_buf[8], *bufp = used_regs_buf;			\  int used_fregs_buf[17], *fbufp = used_fregs_buf;		\  extern char call_used_regs[];					\  extern int current_function_uses_pic_offset_table, flag_pic;	\  MAIN_FUNCTION_PROLOGUE;					\  for (regno = R0_REGNUM; regno < F0_REGNUM; regno++)		\    if (regs_ever_live[regno]					\	&& ! call_used_regs[regno])				\      {								\        *bufp++ = regno; g_regs_used++;				\      }								\  *bufp = -1;							\  for (; regno < FRAME_POINTER_REGNUM; regno++)			\    if (regs_ever_live[regno] && !call_used_regs[regno])	\      {								\        *fbufp++ = regno;					\      }								\  *fbufp = -1;							\  bufp = used_regs_buf;						\  if (frame_pointer_needed)					\    fprintf (FILE, "\tenter [");				\  else								\    {								\      if (SIZE)							\        ADJSP (FILE, SIZE + 4);					\      if (g_regs_used && g_regs_used > 4)			\        fprintf (FILE, "\tsave [");				\      else							\	{							\	  while (*bufp >= 0)					\            fprintf (FILE, "\tmovd r%d,tos\n", *bufp++);	\	  g_regs_used = 0;					\	}							\    }								\  while (*bufp >= 0)						\    {								\      fprintf (FILE, "r%d", *bufp++);				\      if (*bufp >= 0)						\	fputc (',', FILE);					\    }								\  if (frame_pointer_needed)					\    fprintf (FILE, "],%d\n", SIZE);				\  else if (g_regs_used)						\    fprintf (FILE, "]\n");					\  fbufp = used_fregs_buf;					\  while (*fbufp >= 0)						\    {								\      if ((*fbufp & 1) || (fbufp[0] != fbufp[1] - 1))	\	fprintf (FILE, "\tmovf %s,tos\n", ns32k_out_reg_names[*fbufp++]); \      else							\	{							\	  fprintf (FILE, "\tmovl %s,tos\n",                     \		   ns32k_out_reg_names[fbufp[0]]);                    \	  fbufp += 2;						\	}							\    }								\  if (flag_pic && current_function_uses_pic_offset_table)	\    {								\      fprintf (FILE, "\tsprd sb,tos\n");			\      if (TARGET_REGPARM)					\	{							\	  fprintf (FILE, "\taddr __GLOBAL_OFFSET_TABLE_(pc),tos\n"); \	  fprintf (FILE, "\tlprd sb,tos\n");			\	}							\      else							\	{							\	  fprintf (FILE, "\taddr __GLOBAL_OFFSET_TABLE_(pc),r0\n"); \	  fprintf (FILE, "\tlprd sb,r0\n");			\	}							\    }								\}/* Output assembler code to FILE to increment profiler label # LABELNO   for profiling a function entry.   THIS DEFINITION FOR THE 32000 IS A GUESS.  IT HAS NOT BEEN TESTED.  */#define FUNCTION_PROFILER(FILE, LABELNO)  \   fprintf (FILE, "\taddr LP%d,r0\n\tbsr mcount\n", (LABELNO))/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,   the stack pointer does not matter.  The value is tested only in   functions that have frame pointers.   No definition is equivalent to always zero.   We use 0, because using 1 requires hair in FUNCTION_EPILOGUE   that is worse than the stack adjust we could save.  *//* #define EXIT_IGNORE_STACK 1 *//* 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,   if EXIT_IGNORE_STACK is nonzero.  That doesn't apply here.   If a frame pointer is needed (decided in reload.c ?) then   we need assembler of the form    movf  tos, fn	# Restore any saved floating point registers    .    .    # Restore any saved general purpose registers, restore the stack    # pointer from the frame pointer, restore the old frame pointer.    exit [<general purpose regs to save>]   If a frame pointer is not needed we need assembler of the form    # Restore any general purpose registers saved    movf  tos, fn	# Restore any saved floating point registers    .    .    .    restore [<general purpose regs to save>]    # reclaim space allocated on stack    adjspd <-(local stack space + 4)> */#define FUNCTION_EPILOGUE(FILE, SIZE) \{ register int regno, g_regs_used = 0, f_regs_used = 0;		\  int used_regs_buf[8], *bufp = used_regs_buf;			\  int used_fregs_buf[17], *fbufp = used_fregs_buf;		\  extern char call_used_regs[];					\  extern int current_function_uses_pic_offset_table, flag_pic;	\  if (flag_pic && current_function_uses_pic_offset_table)	\    fprintf (FILE, "\tlprd sb,tos\n");				\  *fbufp++ = -2;						\  for (regno = F0_REGNUM; regno < FRAME_POINTER_REGNUM; regno++) \    if (regs_ever_live[regno] && !call_used_regs[regno])	\      {								\       *fbufp++ = regno; f_regs_used++;				\      }								\  fbufp--;							\  for (regno = 0; regno < F0_REGNUM; regno++)			\    if (regs_ever_live[regno]					\	&& ! call_used_regs[regno])				\      {                                                        	\        *bufp++ = regno; g_regs_used++;				\      }                                                        	\  while (fbufp > used_fregs_buf)				\    {								\      if ((*fbufp & 1) && fbufp[0] == fbufp[-1] + 1)	        \	{							\	  fprintf (FILE, "\tmovl tos,%s\n",                     \		   ns32k_out_reg_names[fbufp[-1]]);                   \	  fbufp -= 2;						\	}							\      else fprintf (FILE, "\tmovf tos,%s\n", ns32k_out_reg_names[*fbufp--]); \    }								\  if (frame_pointer_needed)					\    fprintf (FILE, "\texit [");					\  else								\    {								\      if (g_regs_used && g_regs_used > 4)			\        fprintf (FILE, "\trestore [");				\      else							\        {							\	  while (bufp > used_regs_buf)				\            fprintf (FILE, "\tmovd tos,r%d\n", *--bufp);	\	  g_regs_used = 0;					\        }							\    }								\  while (bufp > used_regs_buf)					\    {								\      fprintf (FILE, "r%d", *--bufp);				\      if (bufp > used_regs_buf)					\	fputc (',', FILE);					\    }								\  if (g_regs_used || frame_pointer_needed)			\    fprintf (FILE, "]\n");					\  if (SIZE && !frame_pointer_needed)				\    ADJSP (FILE, -(SIZE + 4));					\  if (current_function_pops_args)				\    fprintf (FILE, "\tret %d\n", current_function_pops_args);	\  else fprintf (FILE, "\tret 0\n"); }/* Store in the variable DEPTH the initial difference between the   frame pointer reg contents and the stack pointer reg contents,   as of the start of the function body.  This depends on the layout   of the fixed parts of the stack frame and on how registers are saved.  */#define INITIAL_FRAME_POINTER_OFFSET(DEPTH)			\{								\  int regno;							\  int offset = -4;						\  extern int current_function_uses_pic_offset_table, flag_pic;	\  for (regno = 0; regno < L1_REGNUM; regno++)			\    if (regs_ever_live[regno] && ! call_used_regs[regno])	\      offset += 4;						\  for (; regno < FRAME_POINTER_REGNUM; regno++)			\    if (regs_ever_live[regno] && ! call_used_regs[regno])	\      offset += 8;						\  if (flag_pic && current_function_uses_pic_offset_table)	\    offset += 4;						\  (DEPTH) = (offset + get_frame_size ()				\	     + (get_frame_size () == 0 ? 0 : 4));		\}/* Output assembler code for a block containing the constant parts   of a trampoline, leaving space for the variable parts.  *//* On the 32k, the trampoline looks like this:     addr  0(pc),r2     jump  @__trampoline     .int STATIC     .int FUNCTIONDoing trampolines with a library assist function is easier than figuringout how to do stores to memory in reverse byte order (the way immediateoperands on the 32k are stored).  */#define TRAMPOLINE_TEMPLATE(FILE)					\{									\  fprintf (FILE, "\taddr 0(pc),r2\n" );					\  fprintf (FILE, "\tjump " );						\  PUT_ABSOLUTE_PREFIX (FILE);						\  fprintf (FILE, "__trampoline\n" );					\  ASM_OUTPUT_INT (FILE, const0_rtx);					\  ASM_OUTPUT_INT (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.   FNADDR is an RTX for the address of the function's pure code.   CXT is an RTX for the static chain value for the function.  */#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); \}/* This is the library routine that is used   to transfer control from the trampoline   to the actual nested function.  *//* The function name __transfer_from_trampoline is not actually used.   The function definition just permits use of "asm with operands"   (though the operand list is empty).  */#define TRANSFER_FROM_TRAMPOLINE	\void					\__transfer_from_trampoline ()		\{					\  asm (".globl __trampoline");		\  asm ("__trampoline:");		\  asm ("movd 16(r2),tos");		\  asm ("movd 12(r2),r1");		\  asm ("ret 0");			\}/* Addressing modes, and classification of registers for them.  *//* #define HAVE_POST_INCREMENT 0 *//* #define HAVE_POST_DECREMENT 0 *//* #define HAVE_PRE_DECREMENT 0 *//* #define HAVE_PRE_INCREMENT 0 *//* Macros to check register numbers against specific register classes.  *//* 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.   Since they use reg_renumber, they are safe only once reg_renumber   has been allocated, which happens in local-alloc.c.  *//* note that FP and SP cannot be used as an index. What about PC? */#define REGNO_OK_FOR_INDEX_P(REGNO)  \((REGNO) < F0_REGNUM || (unsigned)reg_renumber[REGNO] < F0_REGNUM)#define REGNO_OK_FOR_BASE_P(REGNO)   \((REGNO) < F0_REGNUM || (unsigned)reg_renumber[REGNO] < F0_REGNUM \ || (REGNO) == FRAME_POINTER_REGNUM || (REGNO) == STACK_POINTER_REGNUM)#define FP_REG_P(X) \ (GET_CODE (X) == REG && REGNO (X) >= F0_REGNUM && REGNO (X) < FRAME_POINTER_REGNUM)/* 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.   This might not work on future ns32k processors as negative   displacements are not officially allowed but a mode reserved   to National.  This works on processors up to 32532, though,   and we don't expect any new ones in the series ;-( */#define CONSTANT_ADDRESS_P(X)   \  (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF		\   || GET_CODE (X) == CONST						\   || (GET_CODE (X) == CONST_INT					\       && NS32K_DISPLACEMENT_P (INTVAL (X))))#define CONSTANT_ADDRESS_NO_LABEL_P(X)   \  (GET_CODE (X) == CONST_INT						\   && NS32K_DISPLACEMENT_P (INTVAL (X)))/* Return the register class of a scratch register needed to copy IN into   or out of a register in CLASS in MODE.  If it can be done directly,   NO_REGS is returned.  */#define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \  secondary_reload_class (CLASS, MODE, IN)/*  Certain machines have the property that some registers cannot be    copied to some other registers without using memory.  Define this    macro on those machines to be a C expression that is non-zero if    objects of mode M in registers of CLASS1 can only be copied to    registers of class CLASS2 by storing a register of CLASS1 into    memory and loading that memory location into a register of CLASS2.    On the ns32k, floating point regs can only be loaded through memory    The movdf and movsf insns in ns32k.md copy between general and    floating registers using the stack. In principle, we could get    better code not allowing that case in the constraints and defining    SECONDARY_MEMORY_NEEDED in practice, though the stack slots used    are not available for optimization.  */

⌨️ 快捷键说明

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