GCC Middle and Back End API Reference
ubsan.c File Reference

Data Structures

struct  tree_type_map

Functions

static tree decl_for_type_lookup ()
static void decl_for_type_insert ()
tree ubsan_encode_value ()
static tree ubsan_type_descriptor_type ()
static tree ubsan_source_location_type ()
static tree ubsan_source_location ()
static unsigned short get_ubsan_type_info_for_type ()
tree ubsan_type_descriptor ()
tree ubsan_create_data ()
tree ubsan_instrument_unreachable ()
bool is_ubsan_builtin_p ()

Variables

static htab_t decl_tree_for_type

Function Documentation

static void decl_for_type_insert ( )
static
   Insert a mapping TYPE->DECL in the VAR_DECL for type hashtable.  
static tree decl_for_type_lookup ( )
static
   Lookup a VAR_DECL for TYPE, and return it if we find one.  
     If the hash table is not initialized yet, create it now.  
         That also means we don't have to bother with the lookup.  

Referenced by get_ubsan_type_info_for_type().

static unsigned short get_ubsan_type_info_for_type ( )
static
   This routine returns a magic number for TYPE.  

References tree_type_map::decl, decl_for_type_lookup(), and ubsan_type_descriptor_type().

bool is_ubsan_builtin_p ( )
   Return true if T is a call to a libubsan routine.  
tree ubsan_create_data ( )
   Create a structure for the ubsan library.  NAME is a name of the new
   structure.  The arguments in ... are of __ubsan_type_descriptor type
   and there are at most two of them.  
     Firstly, create a pointer to type descriptor type.  
     Create the structure type.  
         Save the tree argument for later use.  
     Now, fill in the type.  
     If desirable, set the __ubsan_source_location element.  
tree ubsan_encode_value ( )
   Helper routine, which encodes a value in the pointer_sized_int_node.
   Arguments with precision <= POINTER_SIZE are passed directly,
   the rest is passed by reference.  T is a value we are to encode.  
                   The reason for this is that we don't want to pessimize
                   code by making vars unnecessarily addressable.  
tree ubsan_instrument_unreachable ( )
   Instrument the __builtin_unreachable call.  We just call the libubsan
   routine instead.  
static tree ubsan_source_location ( )
static
   Helper routine that returns a CONSTRUCTOR of __ubsan_source_location
   type with its fields filled from a location_t LOC.  
     Fill in the values from LOC.  
static tree ubsan_source_location_type ( )
static
   Build
   struct __ubsan_source_location
   {
     const char *__filename;
     unsigned int __line;
     unsigned int __column;
   }
   type.  

References build_pointer_type(), and get_identifier().

tree ubsan_type_descriptor ( )
   Helper routine that returns ADDR_EXPR of a VAR_DECL of a type
   descriptor.  It first looks into the pointer map; if not found,
   create the VAR_DECL, put it into the pointer map and return the
   ADDR_EXPR of it.  TYPE describes a particular type.  
     See through any typedefs.  
     At least for INTEGER_TYPE/REAL_TYPE/COMPLEX_TYPE, this should work.
     For e.g. type_unsigned_for (type) or bit-fields, the TYPE_NAME
     would be NULL.  
         For INTEGER_TYPE, this is 0x0000.  
       We don't have float support yet.  
     Create a new VAR_DECL of type descriptor.  
     Save the address of the VAR_DECL into the pointer map.  

References gdbhooks::IDENTIFIER_NODE.

static tree ubsan_type_descriptor_type ( )
static
   Build
   struct __ubsan_type_descriptor
   {
     unsigned short __typekind;
     unsigned short __typeinfo;
     char __typename[];
   }
   type.  

Referenced by get_ubsan_type_info_for_type().


Variable Documentation

htab_t decl_tree_for_type
static