libFirm

If the type opcode is set to type_class the type represents class types. More...

Macros

#define INVALID_MEMBER_INDEX   ((size_t)-1)
 Special index returned when get_class_member_index() cannot find a member. More...
 

Functions

ir_typenew_type_class (ident *name)
 Creates a new class type. More...
 
size_t get_class_n_members (const ir_type *clss)
 Returns the number of members of this class. More...
 
ir_entityget_class_member (const ir_type *clss, size_t pos)
 Returns the member at position pos, 0 <= pos < n_member. More...
 
size_t get_class_member_index (ir_type const *clss, ir_entity const *mem)
 Returns index of mem in clss, INVALID_MEMBER_INDEX if not contained. More...
 
void add_class_subtype (ir_type *clss, ir_type *subtype)
 Adds subtype as subtype to clss. More...
 
size_t get_class_n_subtypes (const ir_type *clss)
 Returns the number of subtypes. More...
 
ir_typeget_class_subtype (const ir_type *clss, size_t pos)
 Returns the subtype at position pos, 0 <= pos < n_subtype. More...
 
size_t get_class_subtype_index (const ir_type *clss, const ir_type *subclass)
 Returns the index to access subclass as subtype of class. More...
 
void set_class_subtype (ir_type *clss, ir_type *subtype, size_t pos)
 Sets the subtype at position pos, 0 <= pos < n_subtype. More...
 
void remove_class_subtype (ir_type *clss, ir_type *subtype)
 Finds subtype in the list of subtypes and removes it. More...
 
void add_class_supertype (ir_type *clss, ir_type *supertype)
 Adds supertype as supertype to class. More...
 
size_t get_class_n_supertypes (const ir_type *clss)
 Returns the number of supertypes. More...
 
size_t get_class_supertype_index (const ir_type *clss, const ir_type *super_clss)
 Returns the index to access superclass as supertype of class. More...
 
ir_typeget_class_supertype (const ir_type *clss, size_t pos)
 Returns the supertype at position pos, 0 <= pos < n_supertype. More...
 
void set_class_supertype (ir_type *clss, ir_type *supertype, size_t pos)
 Sets the supertype at position pos, 0 <= pos < n_supertype. More...
 
void remove_class_supertype (ir_type *clss, ir_type *supertype)
 Finds supertype in the list of supertypes and removes it. More...
 
int is_Class_type (const ir_type *clss)
 Returns true if a type is a class type. More...
 

Detailed Description

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:

Macro Definition Documentation

#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.

Definition at line 1027 of file typerep.h.

Function Documentation

void add_class_subtype ( ir_type clss,
ir_type subtype 
)

Adds subtype as subtype to clss.

Checks whether clss is a supertype of subtype. If not adds also clss as supertype to subtype.

void add_class_supertype ( ir_type clss,
ir_type supertype 
)

Adds supertype as supertype to class.

Checks whether clss is a subtype of supertype. If not adds also clss as subtype to supertype.

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 ( ir_type const *  clss,
ir_entity const *  mem 
)

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.

ir_type* get_class_subtype ( const ir_type clss,
size_t  pos 
)

Returns the subtype at position pos, 0 <= pos < n_subtype.

size_t get_class_subtype_index ( const ir_type clss,
const ir_type subclass 
)

Returns the index to access subclass as subtype of class.

If subclass is no direct subtype of class returns -1.

ir_type* get_class_supertype ( const ir_type clss,
size_t  pos 
)

Returns the supertype at position pos, 0 <= pos < n_supertype.

size_t get_class_supertype_index ( const ir_type clss,
const ir_type super_clss 
)

Returns the index to access superclass as supertype of class.

If superclass is no direct supertype of class returns -1.

int is_Class_type ( const ir_type clss)

Returns true if a type is a class type.

ir_type* new_type_class ( ident name)

Creates a new class type.

void remove_class_subtype ( ir_type clss,
ir_type subtype 
)

Finds subtype in the list of subtypes and removes it.

void remove_class_supertype ( ir_type clss,
ir_type supertype 
)

Finds supertype in the list of supertypes and removes it.

void set_class_subtype ( ir_type clss,
ir_type subtype,
size_t  pos 
)

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!

void set_class_supertype ( ir_type clss,
ir_type supertype,
size_t  pos 
)

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!