libFirm 1.20
Enumeration

Enumeration types need not necessarily be represented explicitly by Firm types, as the frontend can lower them to integer constants as well. More...

Typedefs

typedef struct ir_enum_const ir_enum_const
 Enumeration constant.

Functions

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.

Variables

const tp_optype_enumeration
 This type opcode marks that the corresponding type is an enumeration type.

Detailed Description

Enumeration types need not necessarily be represented explicitly by Firm types, as the frontend can lower them to integer constants as well.

For debugging purposes or similar tasks this information is useful. The type state layout_fixed is set, if all enumeration constants have their tarvals assigned. Until then


Typedef Documentation

typedef struct ir_enum_const ir_enum_const

Enumeration constant.

Definition at line 81 of file firm_types.h.


Function Documentation

ir_enum_const* get_enumeration_const ( const ir_type enumeration,
size_t  pos 
)

Returns the enumeration constant at a given position.

const char* get_enumeration_const_name ( const ir_enum_const enum_cnst)

Returns the assigned name of an enumeration constant.

ident* get_enumeration_const_nameid ( const ir_enum_const enum_cnst)

Returns the assigned ident of an enumeration constant.

ident* get_enumeration_ident ( const ir_type enumeration)

Returns enumeration identifier.

size_t get_enumeration_n_enums ( const ir_type enumeration)

Returns the number of enumeration values of this enumeration.

const char* get_enumeration_name ( const ir_type enumeration)

Returns enumeration identifier as c-string.

ir_type* get_enumeration_owner ( const ir_enum_const enum_cnst)

Returns the enumeration type owner of an enumeration constant.

ir_tarval* get_enumeration_value ( const ir_enum_const enum_cnst)

Returns the enumeration constant value.

const tp_op* get_tpop_enumeration ( void  )

Returns type opcode for enumeration type.

See also:
type_enumeration
int is_Enumeration_type ( const ir_type enumeration)

Returns true if a type is a enumeration type.

ir_type* new_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.

ir_type* new_type_enumeration ( ident name,
size_t  n_enums 
)

Create a new type enumeration -- set the enumerators independently.

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.

void set_enumeration_nameid ( ir_enum_const enum_cnst,
ident id 
)

Assign an ident to an enumeration constant.

void set_enumeration_value ( ir_enum_const enum_cnst,
ir_tarval con 
)

Sets the enumeration constant value.


Variable Documentation

This type opcode marks that the corresponding type is an enumeration type.

Consequently it contains a list of idents for the enumeration identifiers and a list of target values that are the constants used to implement the enumerators. This struct is dynamically allocated but constant for the lifetime of the library.

Definition at line 1969 of file typerep.h.