(gccint.info.gz) Target Attributes

Info Catalog (gccint.info.gz) Mode Switching (gccint.info.gz) Target Macros (gccint.info.gz) Emulated TLS
 
 17.25 Defining target-specific uses of `__attribute__'
 ======================================================
 
 Target-specific attributes may be defined for functions, data and types.
 These are described using the following target hooks; they also need to
 be documented in `extend.texi'.
 
  -- Target Hook: const struct attribute_spec * TARGET_ATTRIBUTE_TABLE
      If defined, this target hook points to an array of `struct
      attribute_spec' (defined in `tree.h') specifying the machine
      specific attributes for this target and some of the restrictions
      on the entities to which these attributes are applied and the
      arguments they take.
 
  -- Target Hook: int TARGET_COMP_TYPE_ATTRIBUTES (tree TYPE1, tree
           TYPE2)
      If defined, this target hook is a function which returns zero if
      the attributes on TYPE1 and TYPE2 are incompatible, one if they
      are compatible, and two if they are nearly compatible (which
      causes a warning to be generated).  If this is not defined,
      machine-specific attributes are supposed always to be compatible.
 
  -- Target Hook: void TARGET_SET_DEFAULT_TYPE_ATTRIBUTES (tree TYPE)
      If defined, this target hook is a function which assigns default
      attributes to newly defined TYPE.
 
  -- Target Hook: tree TARGET_MERGE_TYPE_ATTRIBUTES (tree TYPE1, tree
           TYPE2)
      Define this target hook if the merging of type attributes needs
      special handling.  If defined, the result is a list of the combined
      `TYPE_ATTRIBUTES' of TYPE1 and TYPE2.  It is assumed that
      `comptypes' has already been called and returned 1.  This function
      may call `merge_attributes' to handle machine-independent merging.
 
  -- Target Hook: tree TARGET_MERGE_DECL_ATTRIBUTES (tree OLDDECL, tree
           NEWDECL)
      Define this target hook if the merging of decl attributes needs
      special handling.  If defined, the result is a list of the combined
      `DECL_ATTRIBUTES' of OLDDECL and NEWDECL.  NEWDECL is a duplicate
      declaration of OLDDECL.  Examples of when this is needed are when
      one attribute overrides another, or when an attribute is nullified
      by a subsequent definition.  This function may call
      `merge_attributes' to handle machine-independent merging.
 
      If the only target-specific handling you require is `dllimport'
      for Microsoft Windows targets, you should define the macro
      `TARGET_DLLIMPORT_DECL_ATTRIBUTES' to `1'.  The compiler will then
      define a function called `merge_dllimport_decl_attributes' which
      can then be defined as the expansion of
      `TARGET_MERGE_DECL_ATTRIBUTES'.  You can also add
      `handle_dll_attribute' in the attribute table for your port to
      perform initial processing of the `dllimport' and `dllexport'
      attributes.  This is done in `i386/cygwin.h' and `i386/i386.c',
      for example.
 
  -- Target Hook: bool TARGET_VALID_DLLIMPORT_ATTRIBUTE_P (tree DECL)
      DECL is a variable or function with `__attribute__((dllimport))'
      specified. Use this hook if the target needs to add extra
      validation checks to `handle_dll_attribute'.
 
  -- Macro: TARGET_DECLSPEC
      Define this macro to a nonzero value if you want to treat
      `__declspec(X)' as equivalent to `__attribute((X))'.  By default,
      this behavior is enabled only for targets that define
      `TARGET_DLLIMPORT_DECL_ATTRIBUTES'.  The current implementation of
      `__declspec' is via a built-in macro, but you should not rely on
      this implementation detail.
 
  -- Target Hook: void TARGET_INSERT_ATTRIBUTES (tree NODE, tree
           *ATTR_PTR)
      Define this target hook if you want to be able to add attributes
      to a decl when it is being created.  This is normally useful for
      back ends which wish to implement a pragma by using the attributes
      which correspond to the pragma's effect.  The NODE argument is the
      decl which is being created.  The ATTR_PTR argument is a pointer
      to the attribute list for this decl.  The list itself should not
      be modified, since it may be shared with other decls, but
      attributes may be chained on the head of the list and `*ATTR_PTR'
      modified to point to the new attributes, or a copy of the list may
      be made if further changes are needed.
 
  -- Target Hook: bool TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P (tree
           FNDECL)
      This target hook returns `true' if it is ok to inline FNDECL into
      the current function, despite its having target-specific
      attributes, `false' otherwise.  By default, if a function has a
      target specific attribute attached to it, it will not be inlined.
 
  -- Target Hook: bool TARGET_VALID_OPTION_ATTRIBUTE_P (tree FNDECL,
           tree NAME, tree ARGS, int FLAGS)
      This hook is called to parse the `attribute(option("..."))', and
      it allows the function to set different target machine compile time
      options for the current function that might be different than the
      options specified on the command line.  The hook should return
      `true' if the options are valid.
 
      The hook should set the DECL_FUNCTION_SPECIFIC_TARGET field in the
      function declaration to hold a pointer to a target specific STRUCT
      CL_TARGET_OPTION structure.
 
  -- Target Hook: void TARGET_OPTION_SAVE (struct cl_target_option *PTR)
      This hook is called to save any additional target specific
      information in the STRUCT CL_TARGET_OPTION structure for function
      specific options.   Option file format.
 
  -- Target Hook: void TARGET_OPTION_RESTORE (struct cl_target_option
           *PTR)
      This hook is called to restore any additional target specific
      information in the STRUCT CL_TARGET_OPTION structure for function
      specific options.
 
  -- Target Hook: void TARGET_OPTION_PRINT (struct cl_target_option *PTR)
      This hook is called to print any additional target specific
      information in the STRUCT CL_TARGET_OPTION structure for function
      specific options.
 
  -- Target Hook: bool TARGET_OPTION_PRAGMA_PARSE (target ARGS)
      This target hook parses the options for `#pragma GCC option' to
      set the machine specific options for functions that occur later in
      the input stream.  The options should be the same as handled by the
      `TARGET_VALID_OPTION_ATTRIBUTE_P' hook.
 
  -- Target Hook: bool TARGET_CAN_INLINE_P (tree CALLER, tree CALLEE)
      This target hook returns `false' if the CALLER function cannot
      inline CALLEE, based on target specific information.  By default,
      inlining is not allowed if the callee function has function
      specific target options and the caller does not use the same
      options.
 
Info Catalog (gccint.info.gz) Mode Switching (gccint.info.gz) Target Macros (gccint.info.gz) Emulated TLS
automatically generated by info2html