libFirm
typerep.h File Reference

Declarations for functions and datastructures to represent types. More...

#include <stdlib.h>
#include "firm_types.h"
#include "begin.h"
#include "end.h"

Go to the source code of this file.

Data Structures

union  type_or_ent
 A data type to treat types and entities as the same. More...

Macros

#define IR_VTABLE_NUM_NOT_SET   ((unsigned)(-1))
 A reserved value for "not yet set".
#define IR_VA_START_PARAMETER_NUMBER   ((size_t)-1)
 Sepcial parameter number which can be used for parameter entities to indicate the first non-declared parameter in a procedure with variable arguments.
#define is_SuperClass_of(high, low)   is_SubClass_of(low, high)
 Returns true if high is superclass of low.
#define is_SuperClass_ptr_of(low, high)   is_SubClass_ptr_of(high, low)
 Superclass check for pointers to classes.
#define INVALID_MEMBER_INDEX   ((size_t)-1)
 Special index returned when get_class_member_index() cannot find a member.
#define cc_cdecl_set   (0)
 cdecl calling convention
#define cc_stdcall_set   cc_callee_clear_stk
 stdcall calling convention
#define cc_fastcall_set   (cc_reg_param|cc_callee_clear_stk)
 fastcall calling convention
#define IS_CDECL(cc_mask)   (((cc_mask) & cc_bits) == cc_cdecl_set)
 check for the CDECL calling convention
#define IS_STDCALL(cc_mask)   (((cc_mask) & cc_bits) == cc_stdcall_set)
 check for the STDCALL calling convention
#define IS_FASTCALL(cc_mask)   (((cc_mask) & cc_bits) == cc_fastcall_set)
 check for the FASTCALL calling convention
#define SET_CDECL(cc_mask)   (((cc_mask) & ~cc_bits) | cc_cdecl_set)
 Sets the CDECL convention bits.
#define SET_STDCALL(cc_mask)   (((cc_mask) & ~cc_bits) | cc_stdcall_set)
 Sets the STDCALL convention bits.
#define SET_FASTCALL(cc_mask)   (((cc_mask) & ~cc_bits) | cc_fastcall_set)
 Sets the FASTCALL convention bits.

Typedefs

typedef struct tp_op tp_op
 A structure containing information about a kind of type.
typedef identmangle_inherited_name_func (const ir_entity *ent, const ir_type *clss)
 Type of argument functions for inheritance resolver.
typedef int( compare_types_func_t )(const void *tp1, const void *tp2)
 Type for a function that compares two types.
typedef void type_walk_func (type_or_ent tore, void *env)
 Type of argument functions for type walkers.
typedef void class_walk_func (ir_type *clss, void *env)
 The class walk function.
typedef void entity_walk_func (ir_entity *ent, void *env)
 the entity walk function.

Enumerations

enum  ir_visibility { ir_visibility_external, ir_visibility_local, ir_visibility_private }
 Visibility classed for entities. More...
enum  ir_linkage {
  IR_LINKAGE_DEFAULT = 0, IR_LINKAGE_CONSTANT = 1 << 0, IR_LINKAGE_WEAK = 1 << 1, IR_LINKAGE_GARBAGE_COLLECT = 1 << 2,
  IR_LINKAGE_MERGE = 1 << 3, IR_LINKAGE_HIDDEN_USER = 1 << 4, IR_LINKAGE_NO_CODEGEN = 1 << 5
}
 linkage specifies how the linker treats symbols More...
enum  ir_entity_usage {
  ir_usage_none = 0, ir_usage_address_taken = 1 << 0, ir_usage_write = 1 << 1, ir_usage_read = 1 << 2,
  ir_usage_reinterpret_cast = 1 << 3, ir_usage_unknown
}
 Bitfield type indicating the way an entity is used. More...
enum  ir_initializer_kind_t { IR_INITIALIZER_CONST, IR_INITIALIZER_TARVAL, IR_INITIALIZER_NULL, IR_INITIALIZER_COMPOUND }
 the kind (type) of an initializer More...
enum  ir_allocation { allocation_automatic, allocation_parameter, allocation_dynamic, allocation_static }
enum  ir_peculiarity { peculiarity_existent, peculiarity_description, peculiarity_inherited }
enum  ptr_access_kind {
  ptr_access_none = 0, ptr_access_read = 1, ptr_access_write = 2, ptr_access_rw = ptr_access_read|ptr_access_write,
  ptr_access_store = 4, ptr_access_all = ptr_access_rw|ptr_access_store
}
 Encodes how a pointer parameter is accessed. More...
enum  tp_opcode {
  tpo_uninitialized = 0, tpo_class, tpo_struct, tpo_method,
  tpo_union, tpo_array, tpo_enumeration, tpo_pointer,
  tpo_primitive, tpo_code, tpo_none, tpo_unknown,
  tpo_last = tpo_unknown
}
 An enum for the type kinds. More...
enum  inh_transitive_closure_state { inh_transitive_closure_none, inh_transitive_closure_valid, inh_transitive_closure_invalid, inh_transitive_closure_max }
 The state of the transitive closure. More...
enum  ir_class_cast_state { ir_class_casts_any = 0, ir_class_casts_transitive = 1, ir_class_casts_normalized = 2, ir_class_casts_state_max }
 The state of Cast operations that cast class types or pointers to class types. More...
enum  ir_type_state { layout_undefined, layout_fixed }
 The state of the type layout. More...
enum  ir_variadicity { variadicity_non_variadic, variadicity_variadic }
 This enum flags the variadicity of methods (methods with a variable amount of arguments (e.g. More...
enum  calling_convention {
  cc_reg_param = 0x01000000, cc_last_on_top = 0x02000000, cc_callee_clear_stk = 0x04000000, cc_this_call = 0x08000000,
  cc_compound_ret = 0x10000000, cc_frame_on_caller_stk = 0x20000000, cc_fpreg_param = 0x40000000, cc_bits = (0xFF << 24)
}
 Calling conventions: lower 24 bits are the number of register parameters, upper 8 encode the calling conventions. More...

Functions

ir_visibility get_entity_visibility (const ir_entity *entity)
 Returns the visibility class of an entity.
void set_entity_visibility (ir_entity *entity, ir_visibility visibility)
 Sets visibility class of an entity.
int entity_is_externally_visible (const ir_entity *entity)
 Returns 1 if the entity is visible outside the current compilation unit or to unknown callers (like asm statements).
int entity_has_definition (const ir_entity *entity)
 Returns 1 if the entity has a definition (initializer) in the current compilation unit.
ir_entitynew_entity (ir_type *owner, ident *name, ir_type *tp)
 Creates a new entity.
ir_entitynew_d_entity (ir_type *owner, ident *name, ir_type *tp, dbg_info *db)
 Creates a new entity.
ir_entitynew_parameter_entity (ir_type *owner, size_t pos, ir_type *type)
 Creates a new entity corresponding to a function parameter.
ir_entitynew_d_parameter_entity (ir_type *owner, size_t pos, ir_type *type, dbg_info *dbgi)
 Like new_parameter_entity() but with debug information.
int check_entity (const ir_entity *ent)
 Check an entity.
ir_entitycopy_entity_own (ir_entity *old, ir_type *new_owner)
 Copies the entity if the new_owner is different from the owner of the old entity, else returns the old entity.
ir_entitycopy_entity_name (ir_entity *old, ident *new_name)
 Copies the entity if the new_name is different from the name of the old entity, else returns the old entity.
void free_entity (ir_entity *ent)
 Frees the entity.
const char * get_entity_name (const ir_entity *ent)
 Returns the name of an entity.
identget_entity_ident (const ir_entity *ent)
 Returns the ident of an entity.
void set_entity_ident (ir_entity *ent, ident *id)
 Sets the ident of the entity.
identget_entity_ld_ident (const ir_entity *ent)
 Returns the mangled name of the entity.
void set_entity_ld_ident (ir_entity *ent, ident *ld_ident)
 Sets the mangled name of the entity.
const char * get_entity_ld_name (const ir_entity *ent)
 Returns the mangled name of the entity as a string.
int entity_has_ld_ident (const ir_entity *entity)
 returns 1 if the entity has an ld_ident set explicitely
ir_typeget_entity_owner (const ir_entity *ent)
 Returns the owner of the entity.
void set_entity_owner (ir_entity *ent, ir_type *owner)
 Sets the owner field in entity to owner.
ir_typeget_entity_type (const ir_entity *ent)
 Returns the type of an entity.
void set_entity_type (ir_entity *ent, ir_type *tp)
 Sets the type of an entity.
ir_linkage get_entity_linkage (const ir_entity *entity)
 Returns the linkage of an entity.
void set_entity_linkage (ir_entity *entity, ir_linkage linkage)
 Sets the linkage flags of entity entity to linkage.
void add_entity_linkage (ir_entity *entity, ir_linkage linkage)
 Adds linkage flags linkage to entity entity.
void remove_entity_linkage (ir_entity *entity, ir_linkage linkage)
 Remove linkage flags linkage from entity entity.
ir_volatility get_entity_volatility (const ir_entity *ent)
 Returns the volatility of an entity.
void set_entity_volatility (ir_entity *ent, ir_volatility vol)
 Sets the volatility of an entity.
const char * get_volatility_name (ir_volatility var)
 Returns the name of the volatility.
unsigned get_entity_alignment (const ir_entity *entity)
 Returns alignment of entity in bytes.
void set_entity_alignment (ir_entity *entity, unsigned alignment)
 Allows you to override the type alignment for an entity.
ir_align get_entity_aligned (const ir_entity *ent)
 Returns indication whether entity is aligned in memory.
void set_entity_aligned (ir_entity *ent, ir_align a)
 Sets indication whether entity is aligned in memory.
const char * get_align_name (ir_align a)
 Returns the name of the alignment.
int get_entity_offset (const ir_entity *ent)
 Returns the offset of an entity (in a compound) in bytes.
void set_entity_offset (ir_entity *ent, int offset)
 Sets the offset of an entity (in a compound) in bytes.
unsigned char get_entity_offset_bits_remainder (const ir_entity *ent)
 Returns the offset bit remainder of a bitfield entity (in a compound) in bits.
void set_entity_offset_bits_remainder (ir_entity *ent, unsigned char offset)
 Sets the offset bit remainder of a bitfield entity (in a compound) in bits.
void * get_entity_link (const ir_entity *ent)
 Returns the stored intermediate information.
void set_entity_link (ir_entity *ent, void *l)
 Stores new intermediate information.
ir_graphget_entity_irg (const ir_entity *ent)
 The entity knows the corresponding irg if the entity is a method.
unsigned get_entity_vtable_number (const ir_entity *ent)
 Returns the entity vtable number.
void set_entity_vtable_number (ir_entity *ent, unsigned vtable_number)
 Sets the entity vtable number.
void set_entity_label (ir_entity *ent, ir_label_t label)
 Sets label number of an entity with code type.
ir_label_t get_entity_label (const ir_entity *ent)
 Returns label number of an entity with code type.
int is_entity_compiler_generated (const ir_entity *ent)
 Checks if an entity is compiler generated.
void set_entity_compiler_generated (ir_entity *ent, int flag)
 Sets/resets the compiler generated flag.
ir_entity_usage get_entity_usage (const ir_entity *ent)
 Returns the entity usage.
void set_entity_usage (ir_entity *ent, ir_entity_usage flag)
 Sets/resets the state of the address taken flag of an entity.
dbg_infoget_entity_dbg_info (const ir_entity *ent)
 Returns the debug information of an entity.
void set_entity_dbg_info (ir_entity *ent, dbg_info *db)
 Sets the debug information of an entity.
int is_parameter_entity (const ir_entity *entity)
 returns true if a given entity is a parameter_entity representing the address of a function parameter
size_t get_entity_parameter_number (const ir_entity *entity)
 returns number of parameter a parameter entitiy represents
void set_entity_parameter_number (ir_entity *entity, size_t n)
 set number of parameter an entity represents
int is_irn_const_expression (ir_node *n)
 Returns true if the the node is representable as code on const_code_irg.
ir_nodecopy_const_value (dbg_info *dbg, ir_node *n, ir_node *to_block)
 Copies a Firm subgraph that complies to the restrictions for constant expressions to block.
ir_nodeget_atomic_ent_value (const ir_entity *ent)
 Returns initial value of entity with atomic type ent.
void set_atomic_ent_value (ir_entity *ent, ir_node *val)
 Sets initial value of entity with atomic type ent to node val.
ir_initializer_kind_t get_initializer_kind (const ir_initializer_t *initializer)
 Returns kind of an initializer.
const char * get_initializer_kind_name (ir_initializer_kind_t ini)
 Returns the name of the initializer kind.
ir_initializer_tget_initializer_null (void)
 Returns the null initializer (there's only one instance of it in a program )
ir_initializer_tcreate_initializer_const (ir_node *value)
 Creates an initializer containing a reference to a node on the const-code irg.
ir_initializer_tcreate_initializer_tarval (ir_tarval *tv)
 Creates an initializer containing a single tarval value.
ir_nodeget_initializer_const_value (const ir_initializer_t *initializer)
 Returns value contained in a const initializer.
ir_tarvalget_initializer_tarval_value (const ir_initializer_t *initialzier)
 Returns value contained in a tarval initializer.
ir_initializer_tcreate_initializer_compound (size_t n_entries)
 Creates a compound initializer which holds n_entries entries.
size_t get_initializer_compound_n_entries (const ir_initializer_t *initializer)
 Returns the number of entries in a compound initializer.
void set_initializer_compound_value (ir_initializer_t *initializer, size_t index, ir_initializer_t *value)
 Sets entry with index index to the initializer value.
ir_initializer_tget_initializer_compound_value (const ir_initializer_t *initializer, size_t index)
 Returns the value with index index of a compound initializer.
void set_entity_initializer (ir_entity *entity, ir_initializer_t *initializer)
 Sets the new style initializers of an entity.
int has_entity_initializer (const ir_entity *entity)
 Returns true, if an entity has new style initializers.
ir_initializer_tget_entity_initializer (const ir_entity *entity)
 Returns the new style initializers of an entity.
void add_entity_overwrites (ir_entity *ent, ir_entity *overwritten)
 Adds entity ent to the list of entities that overwrite overwritten.
size_t get_entity_n_overwrites (const ir_entity *ent)
 Returns the number of entities in the list of entities that overwrite entity ent.
size_t get_entity_overwrites_index (const ir_entity *ent, ir_entity *overwritten)
 Returns index of overwritten in list of entities overwriting entity ent.
ir_entityget_entity_overwrites (const ir_entity *ent, size_t pos)
 Returns entry pos in list of entities overwriting entity ent.
void set_entity_overwrites (ir_entity *ent, size_t pos, ir_entity *overwritten)
 Sets entry pos in list of entities overwriting entity ent.
void remove_entity_overwrites (ir_entity *ent, ir_entity *overwritten)
 Remove overwritten from list of entities overwriting entity ent.
size_t get_entity_n_overwrittenby (const ir_entity *ent)
 Returns number of entities overwritten by ent.
size_t get_entity_overwrittenby_index (const ir_entity *ent, ir_entity *overwrites)
 Returns index of overwrites in list of entities overwritten by entity ent.
ir_entityget_entity_overwrittenby (const ir_entity *ent, size_t pos)
 Return entry pos in list of entities overwritten by entity ent.
void set_entity_overwrittenby (ir_entity *ent, size_t pos, ir_entity *overwrites)
 Sets entry pos in list of entities overwritten by entity ent.
void remove_entity_overwrittenby (ir_entity *ent, ir_entity *overwrites)
 Removes entry overwrites in list of entities overwritten by ent.
int is_entity (const void *thing)
 Checks whether a pointer points to an entity.
int is_atomic_entity (const ir_entity *ent)
 Returns true if the type of the entity is a primitive, pointer enumeration or method type.
int is_compound_entity (const ir_entity *ent)
 Returns true if the type of the entity is a class, structure, array or union type.
int is_method_entity (const ir_entity *ent)
 Returns true if the type of the entity is a Method type.
long get_entity_nr (const ir_entity *ent)
 Outputs a unique number for this entity if libfirm is compiled for debugging, (configure with –enable-debug) else returns the address of the type cast to long.
ir_visited_t get_entity_visited (const ir_entity *ent)
 Returns the entities visited counter.
void set_entity_visited (ir_entity *ent, ir_visited_t num)
 Sets the entities visited counter.
void mark_entity_visited (ir_entity *ent)
 Marks entity as visited.
int entity_visited (const ir_entity *ent)
 Returns true if this entity was visited.
int entity_not_visited (const ir_entity *ent)
 Returns true if this entity was not visited.
mtp_additional_properties get_entity_additional_properties (const ir_entity *ent)
 Returns the mask of the additional entity properties.
void set_entity_additional_properties (ir_entity *ent, mtp_additional_properties prop)
 Sets the mask of the additional graph properties.
void add_entity_additional_properties (ir_entity *ent, mtp_additional_properties flag)
 Sets additional graph properties.
ir_typeget_entity_repr_class (const ir_entity *ent)
 Returns the class type that this type info entity represents or NULL if ent is no type info entity.
ir_entityget_unknown_entity (void)
 Returns the unknown entity .
int is_unknown_entity (const ir_entity *entity)
 Tests whether entity entity is (the) unknown entity.
ir_allocation get_entity_allocation (const ir_entity *ent)
void set_entity_allocation (ir_entity *ent, ir_allocation al)
ir_peculiarity get_entity_peculiarity (const ir_entity *ent)
void set_entity_peculiarity (ir_entity *ent, ir_peculiarity pec)
int is_entity_final (const ir_entity *ent)
void set_entity_final (ir_entity *ent, int final)
ir_peculiarity get_class_peculiarity (const ir_type *clss)
void set_class_peculiarity (ir_type *clss, ir_peculiarity pec)
const char * get_tpop_name (const tp_op *op)
 Returns the string for the type opcode.
tp_opcode get_tpop_code (const tp_op *op)
 Returns an enum for the type opcode.
int is_SubClass_of (ir_type *low, ir_type *high)
 Returns true if low is subclass of high.
int is_SubClass_ptr_of (ir_type *low, ir_type *high)
 Subclass check for pointers to classes.
int is_overwritten_by (ir_entity *high, ir_entity *low)
 Returns true if high is (transitive) overwritten by low.
ir_entityresolve_ent_polymorphy (ir_type *dynamic_class, ir_entity *static_ent)
 Resolve polymorphism in the inheritance relation.
identdefault_mangle_inherited_name (const ir_entity *ent, const ir_type *clss)
 Default name mangling for inherited entities.
void resolve_inheritance (mangle_inherited_name_func *mfunc)
 Resolve implicit inheritance.
void set_irp_inh_transitive_closure_state (inh_transitive_closure_state s)
 Sets the transitive closure of sub/superclass state for the whole program.
void invalidate_irp_inh_transitive_closure_state (void)
 Sets the transitive closure of sub/superclass state for the whole program to inh_transitive_closure_invalid.
inh_transitive_closure_state get_irp_inh_transitive_closure_state (void)
 Returns the transitive closure of sub/superclass state for the whole program.
void compute_inh_transitive_closure (void)
 Compute transitive closure of the subclass/superclass and overwrites/overwrittenby relation.
void free_inh_transitive_closure (void)
 Free memory occupied by the transitive closure information.
ir_typeget_class_trans_subtype_first (const ir_type *tp)
 Start iteration over all transitive subtypes of tp.
ir_typeget_class_trans_subtype_next (const ir_type *tp)
 Returns next type in a subtype iteration started by get_class_trans_subtype_first()
int is_class_trans_subtype (const ir_type *tp, const ir_type *subtp)
 Check if subtp is a subtype of tp.
ir_typeget_class_trans_supertype_first (const ir_type *tp)
 Start iteration over all transitive supertypes of tp.
ir_typeget_class_trans_supertype_next (const ir_type *tp)
 Returns next type in a supertype iteration started by get_class_trans_supertype_first()
ir_entityget_entity_trans_overwrittenby_first (const ir_entity *ent)
 Start iteration over all entities that transitive overwrite entity ent.
ir_entityget_entity_trans_overwrittenby_next (const ir_entity *ent)
 Returns next entity in a overwrittenby iteration started by get_entity_trans_overwrittenby_first()
ir_entityget_entity_trans_overwrites_first (const ir_entity *ent)
 Start iteration over all transitive overwritten entities, overwritten by entity ent.
ir_entityget_entity_trans_overwrites_next (const ir_entity *ent)
 Returns next entity in a overwrites iteration started by get_entity_trans_overwrites_first()
void set_irg_class_cast_state (ir_graph *irg, ir_class_cast_state state)
 Sets class cast state for graph irg to state.
ir_class_cast_state get_irg_class_cast_state (const ir_graph *irg)
 Returns class cast state for graph irg.
void set_irp_class_cast_state (ir_class_cast_state state)
 Sets class cast state for the whole program to state.
ir_class_cast_state get_irp_class_cast_state (void)
 Returns class cast state for the whole program.
int check_type (const ir_type *tp)
 Checks a type.
int tr_verify (void)
 Walks the type information and performs a set of sanity checks.
void free_type (ir_type *tp)
 Frees the memory used by the type.
const tp_opget_type_tpop (const ir_type *tp)
 Returns type opcode of type tp.
identget_type_tpop_nameid (const ir_type *tp)
 Returns name identifier of type opcode of type tp.
const char * get_type_tpop_name (const ir_type *tp)
 Returns name of type opcode of type tp.
tp_opcode get_type_tpop_code (const ir_type *tp)
 Returns opcode of type opcode of type tp.
void ir_print_type (char *buffer, size_t buffer_size, const ir_type *tp)
 construct a string representing the type.
const char * get_type_state_name (ir_type_state s)
 Returns a human readable string for the enum entry.
ir_type_state get_type_state (const ir_type *tp)
 Returns the type layout state of a type.
void set_type_state (ir_type *tp, ir_type_state state)
 Sets the type layout state of a type.
ir_modeget_type_mode (const ir_type *tp)
 Returns the mode of a type.
void set_type_mode (ir_type *tp, ir_mode *m)
 Sets the mode of a type.
unsigned get_type_size_bytes (const ir_type *tp)
 Returns the size of a type in bytes.
void set_type_size_bytes (ir_type *tp, unsigned size)
 Sets the size of a type in bytes.
unsigned get_type_alignment_bytes (ir_type *tp)
 Returns the alignment of a type in bytes.
void set_type_alignment_bytes (ir_type *tp, unsigned align)
 Sets the alignment of a type in bytes.
ir_visited_t get_type_visited (const ir_type *tp)
 Returns the visited counter of a type.
void set_type_visited (ir_type *tp, ir_visited_t num)
 Sets the visited counter of a type to num.
void mark_type_visited (ir_type *tp)
 Sets visited field in type to type_visited.
int type_visited (const ir_type *tp)
 Returns non-zero if the type is already visited.
int type_not_visited (const ir_type *tp)
 Returns non-zero if the type is not yet visited.
void * get_type_link (const ir_type *tp)
 Returns the associated link field of a type.
void set_type_link (ir_type *tp, void *l)
 Sets the associated link field of a type.
void inc_master_type_visited (void)
 Increments type visited reference counter by one.
void set_master_type_visited (ir_visited_t val)
 Sets type visited reference counter.
ir_visited_t get_master_type_visited (void)
 Returns type visited reference counter.
void set_type_dbg_info (ir_type *tp, type_dbg_info *db)
 Sets the debug information of a type.
type_dbg_infoget_type_dbg_info (const ir_type *tp)
 Returns the debug information of a type.
int is_type (const void *thing)
 Checks whether a pointer points to a type.
long get_type_nr (const ir_type *tp)
 Outputs a unique number for this type if libfirm is compiled for debugging, (configure with –enable-debug) else returns the address of the type cast to long.
int equal_type (ir_type *typ1, ir_type *typ2)
 Checks whether two types are structurally equal.
int smaller_type (ir_type *st, ir_type *lt)
 Checks whether two types are structural comparable.
ir_typenew_type_class (ident *name)
 Creates a new class type.
ir_typenew_d_type_class (ident *name, type_dbg_info *db)
 Creates a new class type with debug information.
identget_class_ident (const ir_type *clss)
 Returns identifier of the class type.
const char * get_class_name (const ir_type *clss)
 Returns identifier of the class type.
size_t get_class_n_members (const ir_type *clss)
 Returns the number of members of this class.
ir_entityget_class_member (const ir_type *clss, size_t pos)
 Returns the member at position pos, 0 <= pos < n_member.
size_t get_class_member_index (const ir_type *clss, ir_entity *mem)
 Returns index of mem in clss, INVALID_MEMBER_INDEX if not contained.
ir_entityget_class_member_by_name (ir_type *clss, ident *name)
 Finds the member with name 'name'.
void add_class_subtype (ir_type *clss, ir_type *subtype)
 Adds subtype as subtype to clss.
size_t get_class_n_subtypes (const ir_type *clss)
 Returns the number of subtypes.
ir_typeget_class_subtype (ir_type *clss, size_t pos)
 Returns the subtype at position pos, 0 <= pos < n_subtype.
size_t get_class_subtype_index (ir_type *clss, const ir_type *subclass)
 Returns the index to access subclass as subtype of class.
void set_class_subtype (ir_type *clss, ir_type *subtype, size_t pos)
 Sets the subtype at position pos, 0 <= pos < n_subtype.
void remove_class_subtype (ir_type *clss, ir_type *subtype)
 Finds subtype in the list of subtypes and removes it.
void add_class_supertype (ir_type *clss, ir_type *supertype)
 Adds supertype as supertype to class.
size_t get_class_n_supertypes (const ir_type *clss)
 Returns the number of supertypes.
size_t get_class_supertype_index (ir_type *clss, ir_type *super_clss)
 Returns the index to access superclass as supertype of class.
ir_typeget_class_supertype (ir_type *clss, size_t pos)
 Returns the supertype at position pos, 0 <= pos < n_supertype.
void set_class_supertype (ir_type *clss, ir_type *supertype, size_t pos)
 Sets the supertype at position pos, 0 <= pos < n_supertype.
void remove_class_supertype (ir_type *clss, ir_type *supertype)
 Finds supertype in the list of supertypes and removes it.
ir_entityget_class_type_info (const ir_type *clss)
 Returns the type info entity of a class.
void set_class_type_info (ir_type *clss, ir_entity *ent)
 Sets a type info entity for the class.
unsigned get_class_vtable_size (const ir_type *clss)
 Returns the size of the virtual function table.
void set_class_vtable_size (ir_type *clss, unsigned size)
 Sets a new size of the virtual function table.
int is_class_final (const ir_type *clss)
 Returns non-zero if a class is final.
void set_class_final (ir_type *clss, int flag)
 Sets the class final flag.
int is_class_interface (const ir_type *clss)
 Returns non-zero if a class is an interface.
void set_class_interface (ir_type *clss, int flag)
 Sets the class interface flag.
int is_class_abstract (const ir_type *clss)
 Returns non-zero if a class is an abstract class.
void set_class_abstract (ir_type *clss, int flag)
 Sets the class abstract flag.
int is_Class_type (const ir_type *clss)
 Returns true if a type is a class type.
const tp_opget_tpop_class (void)
 Returns type opcode for class type.
ir_typenew_type_struct (ident *name)
 Creates a new type struct.
ir_typenew_d_type_struct (ident *name, type_dbg_info *db)
 Creates a new type struct with debug information.
identget_struct_ident (const ir_type *strct)
 Returns struct identifier.
const char * get_struct_name (const ir_type *strct)
 Returns struct identifier as c-string.
size_t get_struct_n_members (const ir_type *strct)
 Returns the number of members of this struct.
ir_entityget_struct_member (const ir_type *strct, size_t pos)
 Returns the member at position pos, pos < n_member.
size_t get_struct_member_index (const ir_type *strct, ir_entity *member)
 Returns index of member in strct, -1 if not contained.
int is_Struct_type (const ir_type *strct)
 Returns true if a type is a struct type.
const tp_opget_tpop_struct (void)
 Returns type opcode for struct type.
ir_typenew_type_union (ident *name)
 Creates a new type union.
ir_typenew_d_type_union (ident *name, type_dbg_info *db)
 Creates a new type union with debug information.
identget_union_ident (const ir_type *uni)
 Returns union identifier.
const char * get_union_name (const ir_type *uni)
 Returns union identifier as c-string.
size_t get_union_n_members (const ir_type *uni)
 Returns the number of unioned types of this union.
ir_entityget_union_member (const ir_type *uni, size_t pos)
 Returns the entity at position pos of a union.
size_t get_union_member_index (const ir_type *uni, ir_entity *member)
 Returns index of member in uni, -1 if not contained.
int is_Union_type (const ir_type *uni)
 Returns true if a type is a union type.
const tp_opget_tpop_union (void)
 Returns type opcode for union type.
ir_typenew_type_method (size_t n_param, size_t n_res)
 Create a new method type.
ir_typenew_d_type_method (size_t n_param, size_t n_res, type_dbg_info *db)
 Create a new method type with debug information.
size_t get_method_n_params (const ir_type *method)
 Returns the number of parameters of this method.
ir_typeget_method_param_type (const ir_type *method, size_t pos)
 Returns the type of the parameter at position pos of a method.
void set_method_param_type (ir_type *method, size_t pos, ir_type *tp)
 Sets the type of the parameter at position pos of a method.
size_t get_method_n_ress (const ir_type *method)
 Returns the number of results of a method type.
ir_typeget_method_res_type (const ir_type *method, size_t pos)
 Returns the return type of a method type at position pos.
void set_method_res_type (ir_type *method, size_t pos, ir_type *tp)
 Sets the type of the result at position pos of a method.
const char * get_variadicity_name (ir_variadicity vari)
 Returns the null-terminated name of this variadicity.
ir_variadicity get_method_variadicity (const ir_type *method)
 Returns the variadicity of a method.
void set_method_variadicity (ir_type *method, ir_variadicity vari)
 Sets the variadicity of a method.
mtp_additional_properties get_method_additional_properties (const ir_type *method)
 Returns the mask of the additional graph properties.
void set_method_additional_properties (ir_type *method, mtp_additional_properties property_mask)
 Sets the mask of the additional graph properties.
void add_method_additional_properties (ir_type *method, mtp_additional_properties flag)
 Sets one additional graph property.
unsigned get_method_calling_convention (const ir_type *method)
 Returns the calling convention of an entities graph.
void set_method_calling_convention (ir_type *method, unsigned cc_mask)
 Sets the calling convention of an entities graph.
unsigned get_method_n_regparams (ir_type *method)
 Returns the number of registers parameters, 0 means default.
void set_method_n_regparams (ir_type *method, unsigned n_regs)
 Sets the number of registers parameters, 0 means default.
int is_Method_type (const ir_type *method)
 Returns true if a type is a method type.
const tp_opget_tpop_method (void)
 Returns type opcode for method type.
ir_typenew_type_array (size_t n_dims, ir_type *element_type)
 Create a new type array.
ir_typenew_d_type_array (size_t n_dims, ir_type *element_type, type_dbg_info *db)
 Create a new type array with debug information.
size_t get_array_n_dimensions (const ir_type *array)
 Returns the number of array dimensions of this type.
void set_array_bounds_int (ir_type *array, size_t dimension, int lower_bound, int upper_bound)
 Allocates Const nodes of mode_Is for one array dimension.
void set_array_bounds (ir_type *array, size_t dimension, ir_node *lower_bound, ir_node *upper_bound)
 Sets the bounds for one array dimension.
void set_array_lower_bound (ir_type *array, size_t dimension, ir_node *lower_bound)
 Sets the lower bound for one array dimension, i.e.
void set_array_lower_bound_int (ir_type *array, size_t dimension, int lower_bound)
 Allocates Const nodes of mode_Is for the lower bound of an array dimension, i.e.
void set_array_upper_bound (ir_type *array, size_t dimension, ir_node *upper_bound)
 Sets the upper bound for one array dimension, i.e.
void set_array_upper_bound_int (ir_type *array, size_t dimension, int upper_bound)
 Allocates Const nodes of mode_Is for the upper bound of an array dimension, i.e.
int has_array_lower_bound (const ir_type *array, size_t dimension)
 Returns true if lower bound != Unknown.
ir_nodeget_array_lower_bound (const ir_type *array, size_t dimension)
 Returns the lower bound of an array.
long get_array_lower_bound_int (const ir_type *array, size_t dimension)
 Works only if bound is Const node with tarval that can be converted to long.
int has_array_upper_bound (const ir_type *array, size_t dimension)
 returns true if lower bound != Unknown
ir_nodeget_array_upper_bound (const ir_type *array, size_t dimension)
 Returns the upper bound of an array.
long get_array_upper_bound_int (const ir_type *array, size_t dimension)
 Works only if bound is Const node with tarval that can be converted to long.
void set_array_order (ir_type *array, size_t dimension, size_t order)
 Sets an array dimension to a specific order.
size_t get_array_order (const ir_type *array, size_t dimension)
 Returns the order of an array dimension.
size_t find_array_dimension (const ir_type *array, size_t order)
 Find the array dimension that is placed at order order.
void set_array_element_type (ir_type *array, ir_type *tp)
 Sets the array element type.
ir_typeget_array_element_type (const ir_type *array)
 Returns the array element type.
void set_array_element_entity (ir_type *array, ir_entity *ent)
 Sets the array element entity.
ir_entityget_array_element_entity (const ir_type *array)
 Returns the array element entity.
void set_array_variable_size (ir_type *array, int variable_size_flag)
 Sets the array variable size flag.
int is_array_variable_size (const ir_type *array)
 Returns the array variable size flag.
int is_Array_type (const ir_type *array)
 Returns true if a type is an array type.
const tp_opget_tpop_array (void)
 Returns type opcode for array type.
ir_typenew_type_enumeration (ident *name, size_t n_enums)
 Create a new type enumeration – set the enumerators independently.
ir_typenew_d_type_enumeration (ident *name, size_t n_enums, type_dbg_info *db)
 Create a new type enumeration with debug information – set the enumerators independently.
identget_enumeration_ident (const ir_type *enumeration)
 Returns enumeration identifier.
const char * get_enumeration_name (const ir_type *enumeration)
 Returns enumeration identifier as c-string.
void set_enumeration_const (ir_type *enumeration, size_t pos, ident *nameid, ir_tarval *con)
 Sets an enumeration constant to a enumeration type at a given position.
size_t get_enumeration_n_enums (const ir_type *enumeration)
 Returns the number of enumeration values of this enumeration.
ir_enum_constget_enumeration_const (const ir_type *enumeration, size_t pos)
 Returns the enumeration constant at a given position.
ir_typeget_enumeration_owner (const ir_enum_const *enum_cnst)
 Returns the enumeration type owner of an enumeration constant.
void set_enumeration_value (ir_enum_const *enum_cnst, ir_tarval *con)
 Sets the enumeration constant value.
ir_tarvalget_enumeration_value (const ir_enum_const *enum_cnst)
 Returns the enumeration constant value.
void set_enumeration_nameid (ir_enum_const *enum_cnst, ident *id)
 Assign an ident to an enumeration constant.
identget_enumeration_const_nameid (const ir_enum_const *enum_cnst)
 Returns the assigned ident of an enumeration constant.
const char * get_enumeration_const_name (const ir_enum_const *enum_cnst)
 Returns the assigned name of an enumeration constant.
int is_Enumeration_type (const ir_type *enumeration)
 Returns true if a type is a enumeration type.
const tp_opget_tpop_enumeration (void)
 Returns type opcode for enumeration type.
ir_typenew_type_pointer (ir_type *points_to)
 Creates a new type pointer.
ir_typenew_d_type_pointer (ir_type *points_to, type_dbg_info *db)
 Creates a new type pointer with debug information.
void set_pointer_points_to_type (ir_type *pointer, ir_type *tp)
 Sets the type to which a pointer points to.
ir_typeget_pointer_points_to_type (const ir_type *pointer)
 Returns the type to which a pointer points to.
int is_Pointer_type (const ir_type *pointer)
 Returns true if a type is a pointer type.
ir_typefind_pointer_type_to_type (ir_type *tp)
 Returns the first pointer type that has as points_to tp.
const tp_opget_tpop_pointer (void)
 Returns type opcode for pointer type.
ir_typenew_type_primitive (ir_mode *mode)
 Creates a new primitive type.
ir_typenew_d_type_primitive (ir_mode *mode, type_dbg_info *db)
 Creates a new primitive type with debug information.
int is_Primitive_type (const ir_type *primitive)
 Returns true if a type is a primitive type.
ir_typeget_primitive_base_type (const ir_type *tp)
 Returns the base type of a primitive (bitfield) type or NULL if none.
void set_primitive_base_type (ir_type *tp, ir_type *base_tp)
 Sets the base type of a primitive (bitfield) type.
const tp_opget_tpop_primitive (void)
 Returns type opcode for primitive type.
ir_typeget_none_type (void)
 Returns the none type.
int is_none_type (const ir_type *type)
 Checks whether type type is the none type.
const tp_opget_tpop_none (void)
 Returns type opcode for none type.
ir_typeget_code_type (void)
 Returns the code type.
int is_code_type (const ir_type *tp)
 Checks whether a type is a code type.
const tp_opget_tpop_code_type (void)
 Returns type opcode for code type.
ir_typeget_unknown_type (void)
 Returns the unknown type.
int is_unknown_type (const ir_type *type)
 Checks whether type type is the unknown type.
const tp_opget_tpop_unknown (void)
 Returns type opcode for unknown type.
int is_atomic_type (const ir_type *tp)
 Checks whether a type is atomic.
identget_compound_ident (const ir_type *tp)
 Returns the identifier of a compound type.
const char * get_compound_name (const ir_type *tp)
 Returns compound identifier as c-string.
size_t get_compound_n_members (const ir_type *tp)
 Returns the number of elements in a Firm compound type.
ir_entityget_compound_member (const ir_type *tp, size_t pos)
 Returns the member of a Firm compound type at position pos.
size_t get_compound_member_index (const ir_type *tp, ir_entity *member)
 Returns index of member in tp, -1 if not contained.
void remove_compound_member (ir_type *compound, ir_entity *entity)
 Remove a member from a compound type.
void set_compound_variable_size (ir_type *compound, int variable_size)
 Sets the variable size flag of a compound type.
int is_compound_variable_size (const ir_type *compound)
 Returns the variable size flag.
void default_layout_compound_type (ir_type *tp)
 layout members of a struct/union or class type in a default way.
int is_compound_type (const ir_type *tp)
 Checks whether a type is a compound type.
ir_typenew_type_frame (void)
 Makes a new frame type.
int is_frame_type (const ir_type *tp)
 Checks, whether a type is a frame type.
ir_typeclone_frame_type (ir_type *type)
 Makes a clone of a frame type.
ir_entityframe_alloc_area (ir_type *frame_type, int size, unsigned alignment, int at_start)
 Allocate an area of size bytes aligned at alignment at the start or the end of a frame type.
void type_walk (type_walk_func *pre, type_walk_func *post, void *env)
 Touches every type and entity in unspecified order.
void type_walk_irg (ir_graph *irg, type_walk_func *pre, type_walk_func *post, void *env)
 Walks over all type information reachable from an ir graph.
void type_walk_super2sub (type_walk_func *pre, type_walk_func *post, void *env)
 Touches every class in specified order:
void type_walk_super (type_walk_func *pre, type_walk_func *post, void *env)
 Walker for class types in inheritance order.
void class_walk_super2sub (class_walk_func *pre, class_walk_func *post, void *env)
 Same as type_walk_super2sub, but visits only class types.
void walk_types_entities (ir_type *tp, entity_walk_func *doit, void *env)
 Walks over all entities in the type.
void types_calc_finalization (void)
 If we have the closed world assumption, we can calculate the finalization of classes and entities by inspecting the class hierarchy.
ir_visibility get_type_visibility (const ir_type *tp)
void set_type_visibility (ir_type *tp, ir_visibility v)

Variables

const tp_optype_class
 This type opcode marks that the corresponding type is a class type.
const tp_optype_struct
 This type opcode marks that the corresponding type is a compound type as a struct in C.
const tp_optype_union
 This type opcode marks that the corresponding type is a union type.
const tp_optype_method
 This type opcode marks that the corresponding type is a method type.
const tp_optype_array
 This type opcode marks that the corresponding type is an array type.
const tp_optype_enumeration
 This type opcode marks that the corresponding type is an enumeration type.
const tp_optype_pointer
 This type opcode marks that the corresponding type is a pointer type.
const tp_optype_primitive
 This type opcode marks that the corresponding type is a primitive type.
const tp_optpop_none
 This type opcode is an auxiliary opcode dedicated to support type analyses.
const tp_optpop_code
 The code type is used to mark pieces of code (basic blocks)
const tp_optpop_unknown
 This type opcode is an auxiliary opcode dedicated to support type analyses.

Detailed Description

Declarations for functions and datastructures to represent types.

Definition in file typerep.h.

Enumeration Type Documentation

Encodes how a pointer parameter is accessed.

Enumerator:
ptr_access_none 

no access

ptr_access_read 

read access

ptr_access_write 

write access

ptr_access_rw 

read AND write access

ptr_access_store 

the pointer is stored

ptr_access_all 

all possible access

Definition at line 740 of file typerep.h.