libFirm
Loading...
Searching...
No Matches
Compound

Topics

 Class
 
 
 Struct
 
 
 Union
 
 

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 (ir_type const *tp, ir_entity const *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 default_layout_compound_type (ir_type *tp)
 Layout members of a compound type in the default way (as determined by the target ABI).
 
int is_compound_type (const ir_type *tp)
 Checks whether a type is a compound type.
 

Detailed Description

These functions are common to classes, structs and unions, collectively known as "compound types".

Note that there is no function to add a member to a compound type. Instead, create an entity with the compound type as its owner or use set_entity_owner() to make it a member of the compound type.

Function Documentation

◆ default_layout_compound_type()

void default_layout_compound_type ( ir_type * tp)

Layout members of a compound type in the default way (as determined by the target ABI).

The compound type may not contain bitfield members, in which case it must be laid out by hand.

◆ get_compound_ident()

ident * get_compound_ident ( const ir_type * tp)

Returns the identifier of a compound type.

◆ get_compound_member()

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.

◆ get_compound_member_index()

size_t get_compound_member_index ( ir_type const * tp,
ir_entity const * member )

Returns index of member in tp, -1 if not contained.

◆ get_compound_n_members()

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.

◆ get_compound_name()

const char * get_compound_name ( const ir_type * tp)

Returns compound identifier as c-string.

◆ is_compound_type()

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 segment type.

◆ remove_compound_member()

void remove_compound_member ( ir_type * compound,
ir_entity * entity )

Remove a member from a compound type.