📄 mips.h
字号:
/* ASM_SPEC is the set of arguments to pass to the assembler. */#define ASM_SPEC "\%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \%(subtarget_asm_optimizing_spec) \%(subtarget_asm_debugging_spec) \%{membedded-pic} \%{mabi=32:-32}%{mabi=o32:-32}%{mabi=n32:-n32}%{mabi=64:-64}%{mabi=n64:-64} \%(target_asm_spec) \%(subtarget_asm_spec)"/* Specify to run a post-processor, mips-tfile after the assembler has run to stuff the mips debug information into the object file. This is needed because the $#!%^ MIPS assembler provides no way of specifying such information in the assembly file. If we are cross compiling, disable mips-tfile unless the user specifies -mmips-tfile. */#ifndef ASM_FINAL_SPEC#if ((TARGET_CPU_DEFAULT | TARGET_DEFAULT) & MASK_GAS) != 0/* GAS */#define ASM_FINAL_SPEC "\%{mmips-as: %{!mno-mips-tfile: \ \n mips-tfile %{v*: -v} \ %{K: -I %b.o~} \ %{!K: %{save-temps: -I %b.o~}} \ %{c:%W{o*}%{!o*:-o %b.o}}%{!c:-o %U.o} \ %{.s:%i} %{!.s:%g.s}}}"#else/* not GAS */#define ASM_FINAL_SPEC "\%{!mgas: %{!mno-mips-tfile: \ \n mips-tfile %{v*: -v} \ %{K: -I %b.o~} \ %{!K: %{save-temps: -I %b.o~}} \ %{c:%W{o*}%{!o*:-o %b.o}}%{!c:-o %U.o} \ %{.s:%i} %{!.s:%g.s}}}"#endif#endif /* ASM_FINAL_SPEC *//* Redefinition of libraries used. Mips doesn't support normal UNIX style profiling via calling _mcount. It does offer profiling that samples the PC, so do what we can... */#ifndef LIB_SPEC#define LIB_SPEC "%{pg:-lprof1} %{p:-lprof1} -lc"#endif/* Extra switches sometimes passed to the linker. *//* ??? The bestGnum will never be passed to the linker, because the gcc driver will interpret it as a -b option. */#ifndef LINK_SPEC#define LINK_SPEC "\%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \%{bestGnum} %{shared} %{non_shared} \%(linker_endian_spec)"#endif /* LINK_SPEC defined *//* Specs for the compiler proper *//* SUBTARGET_CC1_SPEC is passed to the compiler proper. It may be overridden by subtargets. */#ifndef SUBTARGET_CC1_SPEC#define SUBTARGET_CC1_SPEC ""#endif/* CC1_SPEC is the set of arguments to pass to the compiler proper. */#ifndef CC1_SPEC#define CC1_SPEC "\%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \%{mips1:-mfp32 -mgp32} %{mips2:-mfp32 -mgp32}\%{mips3:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \%{mips4:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \%{mfp64:%{msingle-float:%emay not use both -mfp64 and -msingle-float}} \%{mfp64:%{m4650:%emay not use both -mfp64 and -m4650}} \%{m4650:-mcpu=r4650} \%{m3900:-mips1 -mcpu=r3900 -mfp32 -mgp32} \%{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \%{pic-none: -mno-half-pic} \%{pic-lib: -mhalf-pic} \%{pic-extern: -mhalf-pic} \%{pic-calls: -mhalf-pic} \%{save-temps: } \%(subtarget_cc1_spec) "#endif/* Preprocessor specs. *//* SUBTARGET_CPP_SIZE_SPEC defines SIZE_TYPE and PTRDIFF_TYPE. It may be overridden by subtargets. */#ifndef SUBTARGET_CPP_SIZE_SPEC#define SUBTARGET_CPP_SIZE_SPEC "\%{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \%{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}"#endif/* SUBTARGET_CPP_SPEC is passed to the preprocessor. It may be overridden by subtargets. */#ifndef SUBTARGET_CPP_SPEC#define SUBTARGET_CPP_SPEC ""#endif/* If we're using 64bit longs, then we have to define __LONG_MAX__ correctly. Similarly for 64bit ints and __INT_MAX__. */#ifndef LONG_MAX_SPEC#if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_LONG64)#define LONG_MAX_SPEC "%{!mno-long64:-D__LONG_MAX__=9223372036854775807L}"#else#define LONG_MAX_SPEC "%{mlong64:-D__LONG_MAX__=9223372036854775807L}"#endif#endif/* CPP_SPEC is the set of arguments to pass to the preprocessor. */#ifndef CPP_SPEC#define CPP_SPEC "\%{.cc: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \%{.cxx: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \%{.C: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \%{.m: -D__LANGUAGE_OBJECTIVE_C -D_LANGUAGE_OBJECTIVE_C -D__LANGUAGE_C -D_LANGUAGE_C} \%{.S: -D__LANGUAGE_ASSEMBLY -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \%{.s: -D__LANGUAGE_ASSEMBLY -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \%{!.S: %{!.s: %{!.cc: %{!.cxx: %{!.C: %{!.m: -D__LANGUAGE_C -D_LANGUAGE_C %{!ansi:-DLANGUAGE_C}}}}}}} \%(subtarget_cpp_size_spec) \%{mips3:-U__mips -D__mips=3 -D__mips64} \%{mips4:-U__mips -D__mips=4 -D__mips64} \%{mgp32:-U__mips64} %{mgp64:-D__mips64} \%{msingle-float:%{!msoft-float:-D__mips_single_float}} \%{m4650:%{!msoft-float:-D__mips_single_float}} \%{msoft-float:-D__mips_soft_float} \%{mabi=eabi:-D__mips_eabi} \%{EB:-UMIPSEL -U_MIPSEL -U__MIPSEL -U__MIPSEL__ -D_MIPSEB -D__MIPSEB -D__MIPSEB__ %{!ansi:-DMIPSEB}} \%{EL:-UMIPSEB -U_MIPSEB -U__MIPSEB -U__MIPSEB__ -D_MIPSEL -D__MIPSEL -D__MIPSEL__ %{!ansi:-DMIPSEL}} \%(long_max_spec) \%(subtarget_cpp_spec) "#endif/* This macro defines names of additional specifications to put in the specs that can be used in various specifications like CC1_SPEC. Its definition is an initializer with a subgrouping for each command option. Each subgrouping contains a string constant, that defines the specification name, and a string constant that used by the GNU CC driver program. Do not define this macro if it does not need to do anything. */#define EXTRA_SPECS \ { "subtarget_cc1_spec", SUBTARGET_CC1_SPEC }, \ { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \ { "subtarget_cpp_size_spec", SUBTARGET_CPP_SIZE_SPEC }, \ { "long_max_spec", LONG_MAX_SPEC }, \ { "mips_as_asm_spec", MIPS_AS_ASM_SPEC }, \ { "gas_asm_spec", GAS_ASM_SPEC }, \ { "target_asm_spec", TARGET_ASM_SPEC }, \ { "subtarget_mips_as_asm_spec", SUBTARGET_MIPS_AS_ASM_SPEC }, \ { "subtarget_asm_optimizing_spec", SUBTARGET_ASM_OPTIMIZING_SPEC }, \ { "subtarget_asm_debugging_spec", SUBTARGET_ASM_DEBUGGING_SPEC }, \ { "subtarget_asm_spec", SUBTARGET_ASM_SPEC }, \ { "linker_endian_spec", LINKER_ENDIAN_SPEC }, \ SUBTARGET_EXTRA_SPECS#ifndef SUBTARGET_EXTRA_SPECS#define SUBTARGET_EXTRA_SPECS#endif/* If defined, this macro is an additional prefix to try after `STANDARD_EXEC_PREFIX'. */#ifndef MD_EXEC_PREFIX#define MD_EXEC_PREFIX "/usr/lib/cmplrs/cc/"#endif#ifndef MD_STARTFILE_PREFIX#define MD_STARTFILE_PREFIX "/usr/lib/cmplrs/cc/"#endif/* Print subsidiary information on the compiler version in use. */#define MIPS_VERSION "[AL 1.1, MM 40]"#ifndef MACHINE_TYPE#define MACHINE_TYPE "BSD Mips"#endif#ifndef TARGET_VERSION_INTERNAL#define TARGET_VERSION_INTERNAL(STREAM) \ fprintf (STREAM, " %s %s", MIPS_VERSION, MACHINE_TYPE)#endif#ifndef TARGET_VERSION#define TARGET_VERSION TARGET_VERSION_INTERNAL (stderr)#endif#define SDB_DEBUGGING_INFO /* generate info for mips-tfile */#define DBX_DEBUGGING_INFO /* generate stabs (OSF/rose) */#define MIPS_DEBUGGING_INFO /* MIPS specific debugging info */#ifndef PREFERRED_DEBUGGING_TYPE /* assume SDB_DEBUGGING_INFO */#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG#endif/* By default, turn on GDB extensions. */#define DEFAULT_GDB_EXTENSIONS 1/* If we are passing smuggling stabs through the MIPS ECOFF object format, put a comment in front of the .stab<x> operation so that the MIPS assembler does not choke. The mips-tfile program will correctly put the stab into the object file. */#define ASM_STABS_OP ((TARGET_GAS) ? ".stabs" : " #.stabs")#define ASM_STABN_OP ((TARGET_GAS) ? ".stabn" : " #.stabn")#define ASM_STABD_OP ((TARGET_GAS) ? ".stabd" : " #.stabd")/* Local compiler-generated symbols must have a prefix that the assembler understands. By default, this is $, although some targets (e.g., NetBSD-ELF) need to override this. */#ifndef LOCAL_LABEL_PREFIX#define LOCAL_LABEL_PREFIX "$"#endif/* By default on the mips, external symbols do not have an underscore prepended, but some targets (e.g., NetBSD) require this. */#ifndef USER_LABEL_PREFIX#define USER_LABEL_PREFIX ""#endif/* Forward references to tags are allowed. */#define SDB_ALLOW_FORWARD_REFERENCES/* Unknown tags are also allowed. */#define SDB_ALLOW_UNKNOWN_REFERENCES/* On Sun 4, this limit is 2048. We use 1500 to be safe, since the length can run past this up to a continuation point. */#define DBX_CONTIN_LENGTH 1500/* How to renumber registers for dbx and gdb. */#define DBX_REGISTER_NUMBER(REGNO) mips_dbx_regno[ (REGNO) ]/* The mapping from gcc register number to DWARF 2 CFA column number. This mapping does not allow for tracking register 0, since SGI's broken dwarf reader thinks column 0 is used for the frame address, but since register 0 is fixed this is not a problem. */#define DWARF_FRAME_REGNUM(REG) \ (REG == GP_REG_FIRST + 31 ? DWARF_FRAME_RETURN_COLUMN : REG)/* The DWARF 2 CFA column which tracks the return address. */#define DWARF_FRAME_RETURN_COLUMN (FP_REG_LAST + 1)/* Before the prologue, RA lives in r31. */#define INCOMING_RETURN_ADDR_RTX gen_rtx (REG, VOIDmode, GP_REG_FIRST + 31)/* Overrides for the COFF debug format. */#define PUT_SDB_SCL(a) \do { \ extern FILE *asm_out_text_file; \ fprintf (asm_out_text_file, "\t.scl\t%d;", (a)); \} while (0)#define PUT_SDB_INT_VAL(a) \do { \ extern FILE *asm_out_text_file; \ fprintf (asm_out_text_file, "\t.val\t%d;", (a)); \} while (0)#define PUT_SDB_VAL(a) \do { \ extern FILE *asm_out_text_file; \ fputs ("\t.val\t", asm_out_text_file); \ output_addr_const (asm_out_text_file, (a)); \ fputc (';', asm_out_text_file); \} while (0)#define PUT_SDB_DEF(a) \do { \ extern FILE *asm_out_text_file; \ fprintf (asm_out_text_file, "\t%s.def\t", \ (TARGET_GAS) ? "" : "#"); \ ASM_OUTPUT_LABELREF (asm_out_text_file, a); \ fputc (';', asm_out_text_file); \} while (0)#define PUT_SDB_PLAIN_DEF(a) \do { \ extern FILE *asm_out_text_file; \ fprintf (asm_out_text_file, "\t%s.def\t.%s;", \ (TARGET_GAS) ? "" : "#", (a)); \} while (0)#define PUT_SDB_ENDEF \do { \ extern FILE *asm_out_text_file; \ fprintf (asm_out_text_file, "\t.endef\n"); \} while (0)#define PUT_SDB_TYPE(a) \do { \ extern FILE *asm_out_text_file; \ fprintf (asm_out_text_file, "\t.type\t0x%x;", (a)); \} while (0)#define PUT_SDB_SIZE(a) \do { \ extern FILE *asm_out_text_file; \ fprintf (asm_out_text_file, "\t.size\t%d;", (a)); \} while (0)#define PUT_SDB_DIM(a) \do { \ extern FILE *asm_out_text_file; \ fprintf (asm_out_text_file, "\t.dim\t%d;", (a)); \} while (0)#ifndef PUT_SDB_START_DIM#define PUT_SDB_START_DIM \do { \ extern FILE *asm_out_text_file; \ fprintf (asm_out_text_file, "\t.dim\t"); \} while (0)#endif#ifndef PUT_SDB_NEXT_DIM#define PUT_SDB_NEXT_DIM(a) \do { \ extern FILE *asm_out_text_file; \ fprintf (asm_out_text_file, "%d,", a); \} while (0)#endif#ifndef PUT_SDB_LAST_DIM#define PUT_SDB_LAST_DIM(a) \do { \ extern FILE *asm_out_text_file; \ fprintf (asm_out_text_file, "%d;", a); \} while (0)#endif#define PUT_SDB_TAG(a) \do { \ extern FILE *asm_out_text_file; \ fprintf (asm_out_text_file, "\t.tag\t"); \ ASM_OUTPUT_LABELREF (asm_out_text_file, a); \ fputc (';', asm_out_text_file); \} while (0)/* For block start and end, we create labels, so that later we can figure out where the correct offset is. The normal .ent/.end serve well enough for functions,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -