libFirm
Compound

Modules

 Class
 If the type opcode is set to type_class the type represents class types.
 Struct
 A struct type represents aggregate types that consist of a list of fields.
 Union
 The union type represents union types.

Functions

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.

Detailed Description

Function Documentation

void default_layout_compound_type ( ir_type tp)

layout members of a struct/union or class type in a default way.

ident* get_compound_ident ( const ir_type tp)

Returns the identifier of a compound type.

ir_entity* get_compound_member ( const ir_type tp,
size_t  pos 
)

Returns the member of a Firm compound type at position pos.

Parameters
tpThe type (must be struct, union or class).
posThe number of the member.
Returns
The member entity 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.

size_t get_compound_n_members ( const ir_type tp)

Returns the number of elements in a Firm compound type.

This is just a comfortability function, because structs and classes can often be treated be the same code, but they have different access functions to their members.

Parameters
tpThe type (must be struct, union or class).
Returns
Number of members in the compound type.
const char* get_compound_name ( const ir_type tp)

Returns compound identifier as c-string.

int is_compound_type ( const ir_type tp)

Checks whether a type is a compound type.

Parameters
tp- any type
Returns
true if the type is class, structure, union or array type.
int is_compound_variable_size ( const ir_type compound)

Returns the variable size flag.

See Also
set_compound_variable_size()
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.

The last member of a variable size compound type may be an array type without explicit size. So the get_type_size_bytes() of a variable size compound type only returns a minimum size for the type (the size if the last members size is 0)