libFirm 1.20
|
If the type opcode is set to type_class the type represents class types. More...
Defines | |
#define | INVALID_MEMBER_INDEX ((size_t)-1) |
Special index returned when get_class_member_index() cannot find a member. | |
Functions | |
ir_type * | new_type_class (ident *name) |
Creates a new class type. | |
ir_type * | new_d_type_class (ident *name, type_dbg_info *db) |
Creates a new class type with debug information. | |
ident * | get_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_entity * | get_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_entity * | get_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_type * | get_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_type * | get_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_entity * | get_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_op * | get_tpop_class (void) |
Returns type opcode for class type. | |
Variables | |
const tp_op * | type_class |
This type opcode marks that the corresponding type is a class type. |
If the type opcode is set to type_class the type represents class types.
A list of fields and methods is associated with a class. Further a class can inherit from and bequest to other classes.
The following attributes are private to this type kind:
The following two are dynamic lists that can be grown with an "add_" function, but not shrinked:
#define INVALID_MEMBER_INDEX ((size_t)-1) |
Special index returned when get_class_member_index() cannot find a member.
This index is never used for actual members.
Adds subtype as subtype to clss.
Checks whether clss is a supertype of subtype. If not adds also clss as supertype to subtype.
Adds supertype as supertype to class.
Checks whether clss is a subtype of supertype. If not adds also clss as subtype to supertype.
Returns the member at position pos, 0 <= pos < n_member.
Finds the member with name 'name'.
If several members with the same name returns one of them. Returns NULL if no member found.
Returns index of mem in clss, INVALID_MEMBER_INDEX if not contained.
size_t get_class_n_members | ( | const ir_type * | clss | ) |
Returns the number of members of this class.
size_t get_class_n_subtypes | ( | const ir_type * | clss | ) |
Returns the number of subtypes.
size_t get_class_n_supertypes | ( | const ir_type * | clss | ) |
Returns the number of supertypes.
const char* get_class_name | ( | const ir_type * | clss | ) |
Returns identifier of the class type.
Returns the subtype at position pos, 0 <= pos < n_subtype.
Returns the index to access subclass as subtype of class.
If subclass is no direct subtype of class returns -1.
Returns the supertype at position pos, 0 <= pos < n_supertype.
Returns the index to access superclass as supertype of class.
If superclass is no direct supertype of class returns -1.
unsigned get_class_vtable_size | ( | const ir_type * | clss | ) |
Returns the size of the virtual function table.
const tp_op* get_tpop_class | ( | void | ) |
Returns type opcode for class type.
int is_class_abstract | ( | const ir_type * | clss | ) |
Returns non-zero if a class is an abstract class.
int is_class_final | ( | const ir_type * | clss | ) |
Returns non-zero if a class is final.
int is_class_interface | ( | const ir_type * | clss | ) |
Returns non-zero if a class is an interface.
int is_Class_type | ( | const ir_type * | clss | ) |
Returns true if a type is a class type.
ir_type* new_d_type_class | ( | ident * | name, |
type_dbg_info * | db | ||
) |
Creates a new class type with debug information.
Finds subtype in the list of subtypes and removes it.
Finds supertype in the list of supertypes and removes it.
void set_class_abstract | ( | ir_type * | clss, |
int | flag | ||
) |
Sets the class abstract flag.
void set_class_final | ( | ir_type * | clss, |
int | flag | ||
) |
Sets the class final flag.
void set_class_interface | ( | ir_type * | clss, |
int | flag | ||
) |
Sets the class interface flag.
Sets the subtype at position pos, 0 <= pos < n_subtype.
Does not set the corresponding supertype relation for subtype: this might be a different position!
Sets the supertype at position pos, 0 <= pos < n_supertype.
Does not set the corresponding subtype relation for supertype: this might be at a different position!
void set_class_vtable_size | ( | ir_type * | clss, |
unsigned | size | ||
) |
Sets a new size of the virtual function table.
const tp_op* type_class |
This type opcode marks that the corresponding type is a class type.
Consequently the type refers to supertypes, subtypes and entities. Entities can be any fields, but also methods. This struct is dynamically allocated but constant for the lifetime of the library.