Movatterモバイル変換


[0]ホーム

URL:


Next:, Up:Target Description Macros and Functions   [Contents][Index]


17.1 The Globaltargetm Variable

Variable:struct gcc_targettargetm

The target.c file must define the globaltargetm variablewhich contains pointers to functions and data relating to the targetmachine. The variable is declared intarget.h;target-def.h defines the macroTARGET_INITIALIZER which isused to initialize the variable, and macros for the default initializersfor elements of the structure. The.c file should override thosemacros for which the default definition is inappropriate. For example:

#include "target.h"#include "target-def.h"/*Initialize the GCC target structure.  */#undef TARGET_COMP_TYPE_ATTRIBUTES#define TARGET_COMP_TYPE_ATTRIBUTESmachine_comp_type_attributesstruct gcc_target targetm = TARGET_INITIALIZER;

Where a macro should be defined in the.c file in this manner toform part of thetargetm structure, it is documented below as a“Target Hook” with a prototype. Many macros will change in futurefrom being defined in the.h file to being part of thetargetm structure.

Similarly, there is atargetcm variable for hooks that arespecific to front ends for C-family languages, documented as “CTarget Hook”. This is declared inc-family/c-target.h, theinitializerTARGETCM_INITIALIZER inc-family/c-target-def.h. If targets initializetargetcmthemselves, they should settarget_has_targetcm=yes inconfig.gcc; otherwise a default definition is used.

Similarly, there is atargetm_common variable for hooks thatare shared between the compiler driver and the compilers proper,documented as “Common Target Hook”. This is declared incommon/common-target.h, the initializerTARGETM_COMMON_INITIALIZER incommon/common-target-def.h. If targets initializetargetm_common themselves, they should settarget_has_targetm_common=yes inconfig.gcc; otherwise adefault definition is used.

Similarly, there is atargetdm variable for hooks that arespecific to the D language front end, documented as “D Target Hook”.This is declared ind/d-target.h, the initializerTARGETDM_INITIALIZER ind/d-target-def.h. If targetsinitializetargetdm themselves, they should settarget_has_targetdm=yes inconfig.gcc; otherwise a defaultdefinition is used.

Similarly, there is atargetrustm variable for hooks that arespecific to the Rust language front end, documented as “Rust TargetHook”. This is declared inrust/rust-target.h, the initializerTARGETRUSTM_INITIALIZER inrust/rust-target-def.h.If targets initializetargetrustm themselves, they should settarget_has_targetrustm=yes inconfig.gcc; otherwise adefault definition is used.

Similarly, there is atargetjitm variable for hooks that arespecific to the jit front end, documented as “JIT Target Hook”.This is declared injit/jit-target.h, the initializerTARGETJITM_INITIALIZER injit/jit-target-def.h. If targetsinitializetargetjitm themselves, they should settarget_has_targetjitm=yes inconfig.gcc; otherwise a defaultdefinition is used.


Next:Controlling the Compilation Driver,gcc, Up:Target Description Macros and Functions   [Contents][Index]


[8]ページ先頭

©2009-2026 Movatter.jp