GCC Middle and Back End API Reference
genhooks.cc File Reference
#include "bconfig.h"
#include "system.h"
#include "errors.h"
#include "target.def"
#include "c-family/c-target.def"
#include "common/common-target.def"
#include "d/d-target.def"
#include "rust/rust-target.def"
Include dependency graph for genhooks.cc:

Data Structures

struct  hook_desc
 
struct  s_hook
 

Macros

#define HOOK_VECTOR_1(NAME, FRAGMENT)
 
#define DEFHOOKPOD(NAME, DOC, TYPE, INIT)
 
#define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT)
 
#define DEFHOOK_UNDOC(NAME, DOC, TYPE, PARAMS, INIT)
 
#define DEFHOOKPODX(NAME, TYPE, INIT)
 
#define HOOKSTRUCT(FRAGMENT)
 
#define HOOK_VECTOR(INIT_NAME, SNAME)
 
#define HOOK_VECTOR_END(DECL_NAME)
 
#define C90_EMPTY_HACK
 
#define HOOK_TYPE   "Target Hook"
 
#define HOOK_PREFIX   "TARGET_ASM_"
 
#define HOOK_PREFIX   "TARGET_"
 
#define HOOK_PREFIX   "TARGET_SCHED_"
 
#define HOOK_PREFIX   "TARGET_SIMD_CLONE_"
 
#define HOOK_PREFIX   "TARGET_SIMT_"
 
#define HOOK_PREFIX   "TARGET_OMP_"
 
#define HOOK_PREFIX   "TARGET_GOACC_"
 
#define HOOK_PREFIX   "TARGET_VECTORIZE_"
 
#define HOOK_PREFIX   "TARGET_"
 
#define HOOK_PREFIX   "TARGET_ADDR_SPACE_"
 
#define HOOK_PREFIX   "TARGET_"
 
#define HOOK_PREFIX   "TARGET_C_"
 
#define HOOK_PREFIX   "TARGET_CXX_"
 
#define HOOK_PREFIX   "TARGET_EMUTLS_"
 
#define HOOK_PREFIX   "TARGET_OPTION_"
 
#define HOOK_PREFIX   "TARGET_"
 
#define HOOK_PREFIX   "TARGET_SHRINK_WRAP_"
 
#define HOOK_PREFIX   "TARGET_"
 
#define HOOK_PREFIX   "TARGET_MODE_"
 
#define HOOK_PREFIX   "TARGET_MEMTAG_"
 
#define HOOK_PREFIX   "TARGET_"
 
#define DEF_TARGET_INSN(NAME, PROTO)
 
#define DEF_TARGET_INSN(NAME, PROTO)
 
#define DEF_TARGET_INSN(NAME, PROTO)
 
#define HOOK_VECTOR(INIT_NAME, SNAME)
 
#define HOOK_VECTOR_END(DECL_NAME)
 
#define C90_EMPTY_HACK
 
#define HOOK_TYPE   "Common Target Hook"
 
#define HOOK_PREFIX   "TARGET_"
 
#define HOOK_VECTOR(INIT_NAME, SNAME)
 
#define HOOK_VECTOR_END(DECL_NAME)
 
#define C90_EMPTY_HACK
 
#define HOOK_TYPE   "D Target Hook"
 
#define HOOK_PREFIX   "TARGET_"
 
#define HOOK_VECTOR(INIT_NAME, SNAME)
 
#define HOOK_VECTOR_END(DECL_NAME)
 
#define C90_EMPTY_HACK
 
#define HOOK_TYPE   "Rust Target Hook"
 
#define HOOK_PREFIX   "TARGET_"
 

Functions

static char * upstrdup (const char *in)
 
static hashval_t s_hook_hash (const void *p)
 
static int s_hook_eq_p (const void *p1, const void *p2)
 
static void emit_documentation (const char *in_fname)
 
static void emit_init_macros (const char *docname)
 
int main (int argc, char **argv)
 

Variables

static struct hook_desc hook_array []
 

Macro Definition Documentation

◆ C90_EMPTY_HACK [1/4]

#define C90_EMPTY_HACK

◆ C90_EMPTY_HACK [2/4]

#define C90_EMPTY_HACK

◆ C90_EMPTY_HACK [3/4]

#define C90_EMPTY_HACK

◆ C90_EMPTY_HACK [4/4]

#define C90_EMPTY_HACK

◆ DEF_TARGET_INSN [1/3]

#define DEF_TARGET_INSN ( NAME,
PROTO )
Value:
DEFHOOK_UNDOC (have_##NAME, "", bool, (void), false)

◆ DEF_TARGET_INSN [2/3]

#define DEF_TARGET_INSN ( NAME,
PROTO )
Value:
DEFHOOK_UNDOC (gen_##NAME, "", rtx_insn *, PROTO, NULL)

◆ DEF_TARGET_INSN [3/3]

#define DEF_TARGET_INSN ( NAME,
PROTO )
Value:
DEFHOOKPOD (code_for_##NAME, "*", enum insn_code, CODE_FOR_nothing)

◆ DEFHOOK

#define DEFHOOK ( NAME,
DOC,
TYPE,
PARAMS,
INIT )
Value:
{ DOC, #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT, HOOK_TYPE },
#define HOOK_PREFIX
#define HOOK_TYPE
@ NAME
Definition tree-ssa-pre.cc:242

◆ DEFHOOK_UNDOC

#define DEFHOOK_UNDOC ( NAME,
DOC,
TYPE,
PARAMS,
INIT )
Value:
{ "*", #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT, HOOK_TYPE },

◆ DEFHOOKPOD

#define DEFHOOKPOD ( NAME,
DOC,
TYPE,
INIT )
Value:
{ DOC, #TYPE, HOOK_PREFIX #NAME, 0, #INIT, HOOK_TYPE },

◆ DEFHOOKPODX

#define DEFHOOKPODX ( NAME,
TYPE,
INIT )
Value:
DEFHOOKPOD (NAME, 0, TYPE, INIT)
#define DEFHOOKPOD(NAME, DOC, TYPE, INIT)

◆ HOOK_PREFIX [1/24]

#define HOOK_PREFIX   "TARGET_"

◆ HOOK_PREFIX [2/24]

#define HOOK_PREFIX   "TARGET_"

◆ HOOK_PREFIX [3/24]

#define HOOK_PREFIX   "TARGET_"

◆ HOOK_PREFIX [4/24]

#define HOOK_PREFIX   "TARGET_ASM_"

◆ HOOK_PREFIX [5/24]

#define HOOK_PREFIX   "TARGET_"

◆ HOOK_PREFIX [6/24]

#define HOOK_PREFIX   "TARGET_SCHED_"

◆ HOOK_PREFIX [7/24]

#define HOOK_PREFIX   "TARGET_SIMD_CLONE_"

◆ HOOK_PREFIX [8/24]

#define HOOK_PREFIX   "TARGET_SIMT_"

◆ HOOK_PREFIX [9/24]

#define HOOK_PREFIX   "TARGET_OMP_"

◆ HOOK_PREFIX [10/24]

#define HOOK_PREFIX   "TARGET_GOACC_"

◆ HOOK_PREFIX [11/24]

#define HOOK_PREFIX   "TARGET_VECTORIZE_"

◆ HOOK_PREFIX [12/24]

#define HOOK_PREFIX   "TARGET_"

◆ HOOK_PREFIX [13/24]

#define HOOK_PREFIX   "TARGET_ADDR_SPACE_"

◆ HOOK_PREFIX [14/24]

#define HOOK_PREFIX   "TARGET_"

◆ HOOK_PREFIX [15/24]

#define HOOK_PREFIX   "TARGET_C_"

◆ HOOK_PREFIX [16/24]

#define HOOK_PREFIX   "TARGET_CXX_"

◆ HOOK_PREFIX [17/24]

#define HOOK_PREFIX   "TARGET_EMUTLS_"

◆ HOOK_PREFIX [18/24]

#define HOOK_PREFIX   "TARGET_OPTION_"

◆ HOOK_PREFIX [19/24]

#define HOOK_PREFIX   "TARGET_"

◆ HOOK_PREFIX [20/24]

#define HOOK_PREFIX   "TARGET_SHRINK_WRAP_"

◆ HOOK_PREFIX [21/24]

#define HOOK_PREFIX   "TARGET_"

◆ HOOK_PREFIX [22/24]

#define HOOK_PREFIX   "TARGET_MODE_"

◆ HOOK_PREFIX [23/24]

#define HOOK_PREFIX   "TARGET_MEMTAG_"

◆ HOOK_PREFIX [24/24]

#define HOOK_PREFIX   "TARGET_"

◆ HOOK_TYPE [1/4]

#define HOOK_TYPE   "Common Target Hook"

◆ HOOK_TYPE [2/4]

#define HOOK_TYPE   "D Target Hook"

◆ HOOK_TYPE [3/4]

#define HOOK_TYPE   "Rust Target Hook"

◆ HOOK_TYPE [4/4]

#define HOOK_TYPE   "Target Hook"

◆ HOOK_VECTOR [1/4]

#define HOOK_VECTOR ( INIT_NAME,
SNAME )
Value:
HOOK_VECTOR_1 (INIT_NAME, struct SNAME {)
#define HOOK_VECTOR_1(NAME, FRAGMENT)

◆ HOOK_VECTOR [2/4]

#define HOOK_VECTOR ( INIT_NAME,
SNAME )
Value:
HOOK_VECTOR_1 (INIT_NAME, struct SNAME {)

◆ HOOK_VECTOR [3/4]

#define HOOK_VECTOR ( INIT_NAME,
SNAME )
Value:
HOOK_VECTOR_1 (INIT_NAME, struct SNAME {)

◆ HOOK_VECTOR [4/4]

#define HOOK_VECTOR ( INIT_NAME,
SNAME )
Value:
HOOK_VECTOR_1 (INIT_NAME, struct SNAME {)

◆ HOOK_VECTOR_1

#define HOOK_VECTOR_1 ( NAME,
FRAGMENT )
Value:
{ 0, 0, #NAME, 0, 0, HOOK_TYPE },

◆ HOOK_VECTOR_END [1/4]

#define HOOK_VECTOR_END ( DECL_NAME)
Value:
#define DECL_NAME(NODE)
Definition tree.h:2722

◆ HOOK_VECTOR_END [2/4]

#define HOOK_VECTOR_END ( DECL_NAME)
Value:

◆ HOOK_VECTOR_END [3/4]

#define HOOK_VECTOR_END ( DECL_NAME)
Value:

◆ HOOK_VECTOR_END [4/4]

#define HOOK_VECTOR_END ( DECL_NAME)
Value:

◆ HOOKSTRUCT

#define HOOKSTRUCT ( FRAGMENT)

Function Documentation

◆ emit_documentation()

static void emit_documentation ( const char * in_fname)
static
Read the documentation file with name IN_FNAME, perform substitutions
to incorporate information from hook_array, and emit the result on stdout.
Hooks defined with DEFHOOK / DEFHOOKPOD are emitted at the place of a
matching @hook in the input file; if there is no matching @hook, the
hook is emitted after the hook that precedes it in target.def .
Usually, the emitted hook documentation starts with the hook
signature, followed by the string from the doc field.
The documentation is bracketed in @deftypefn / @deftypevr and a matching
@end.
While emitting the doc field, an @findex entry is added
to the affected paragraph.
If the doc field starts with '*', the leading '*' is stripped, and the doc
field is otherwise emitted unaltered; no function signature/
@deftypefn/deftypevr/@end is emitted.
In particular, a doc field of "*" means not to emit any ocumentation for
this target.def / hook_array entry at all (there might be documentation
for this hook in the file named IN_FNAME, though).
A doc field of 0 is used to append the hook signature after the previous
hook's signture, so that one description can be used for a group of hooks.
When the doc field is "", @deftypefn/@deftypevr and the hook signature
is emitted, but not the matching @end.  This allows all the free-form
documentation to be placed in IN_FNAME, to work around GPL/GFDL
licensing incompatibility issues.   

References hook_desc::doc, fatal(), fopen, free(), hook_array, i, s_hook::name, hook_desc::param, s_hook::pos, s_hook_eq_p(), s_hook_hash(), hook_desc::type, and upstrdup().

Referenced by main().

◆ emit_init_macros()

static void emit_init_macros ( const char * docname)
static
Emit #defines to stdout (this will be redirected to generate
target-hook-def.h) which set target hooks initializer macros
to their default values.  These should only be emitted for hooks
whose type is given by DOCNAME.   

References fatal(), hook_array, i, s_hook::name, and upstrdup().

Referenced by main().

◆ main()

int main ( int argc,
char ** argv )

◆ s_hook_eq_p()

static int s_hook_eq_p ( const void * p1,
const void * p2 )
static

References s_hook::name.

Referenced by emit_documentation().

◆ s_hook_hash()

static hashval_t s_hook_hash ( const void * p)
static

References s_hook::name.

Referenced by emit_documentation().

◆ upstrdup()

static char * upstrdup ( const char * in)
static
Return an upper-case copy of IN.   

Referenced by emit_documentation(), and emit_init_macros().

Variable Documentation

◆ hook_array

struct hook_desc hook_array[]
static