Next | Prev | Up | Top | Contents | Index

Predefined Variables

The predefined variables are set by the compiler or assembler when they are invoked. These variables will have different values depending on which switches are used on the command line. These variables can then be used by conditional compilation directives such as #ifdef to determine which code gets compiled or assembled for a particular ABI. You can see the values of these predefined variables by adding the -show switch to a compilation command. The variable that can help distinguish between on32 and n32 compilations are the following:

 For MipsI o32 executables:

-D_MIPS_FPSET=16
-D_MIPS_ISA=_MIPS_ISA_MIPS1
-D_MIPS_SIM=_MIPS_SIM_ABI32

 For MipsIV N32 executables:

-D_MIPS_FPSET=32
-D_MIPS_ISA=_MIPS_ISA_MIPS4
-D_MIPS_SIM=_MIPS_SIM_ABIN32
The explanation of these predefines is as follows:

The following code fragment shows an example of the use of these macros:

#if (_MIPS_ISA == _MIPS_ISA_MIPS1 || _MIPS_ISA == _MIPS_ISA_MIPS2) #define SZREG 4 #endif #if (_MIPS_ISA == _MIPS_ISA_MIPS3 || _MIPS_ISA == _MIPS_ISA_MIPS4) #define SZREG 8 #endif


Next | Prev | Up | Top | Contents | Index