libFirm 1.20
|
00001 /* 00002 * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. 00003 * 00004 * This file is part of libFirm. 00005 * 00006 * This file may be distributed and/or modified under the terms of the 00007 * GNU General Public License version 2 as published by the Free Software 00008 * Foundation and appearing in the file LICENSE.GPL included in the 00009 * packaging of this file. 00010 * 00011 * Licensees holding valid libFirm Professional Edition licenses may use 00012 * this file in accordance with the libFirm Commercial License. 00013 * Agreement provided with the Software. 00014 * 00015 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00016 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00017 * PURPOSE. 00018 */ 00019 00024 #ifndef FIRM_TYPEREP_H 00025 #define FIRM_TYPEREP_H 00026 00027 #include <stdlib.h> 00028 #include "firm_types.h" 00029 00030 #include "begin.h" 00031 00092 typedef enum { 00097 ir_visibility_default, 00104 ir_visibility_local, 00109 ir_visibility_external, 00117 ir_visibility_private 00118 } ir_visibility; 00119 00123 typedef enum ir_linkage { 00124 IR_LINKAGE_DEFAULT = 0, 00131 IR_LINKAGE_CONSTANT = 1 << 0, 00138 IR_LINKAGE_WEAK = 1 << 1, 00144 IR_LINKAGE_GARBAGE_COLLECT = 1 << 2, 00151 IR_LINKAGE_MERGE = 1 << 3, 00160 IR_LINKAGE_HIDDEN_USER = 1 << 4 00161 } ir_linkage; 00162 ENUM_BITSET(ir_linkage) 00163 00164 00167 FIRM_API ir_visibility get_entity_visibility(const ir_entity *entity); 00168 00172 FIRM_API void set_entity_visibility(ir_entity *entity, ir_visibility visibility); 00173 00182 FIRM_API int entity_is_externally_visible(const ir_entity *entity); 00183 00188 FIRM_API int entity_has_definition(const ir_entity *entity); 00189 00199 FIRM_API ir_entity *new_entity(ir_type *owner, ident *name, ir_type *tp); 00200 00210 FIRM_API ir_entity *new_d_entity(ir_type *owner, ident *name, ir_type *tp, 00211 dbg_info *db); 00212 00217 FIRM_API ir_entity *new_parameter_entity(ir_type *owner, size_t pos, 00218 ir_type *type); 00219 00223 FIRM_API ir_entity *new_d_parameter_entity(ir_type *owner, size_t pos, 00224 ir_type *type, dbg_info *dbgi); 00225 00234 FIRM_API int check_entity(ir_entity *ent); 00235 00244 FIRM_API ir_entity *copy_entity_own(ir_entity *old, ir_type *new_owner); 00245 00254 FIRM_API ir_entity *copy_entity_name(ir_entity *old, ident *new_name); 00255 00262 FIRM_API void free_entity(ir_entity *ent); 00263 00265 FIRM_API const char *get_entity_name(const ir_entity *ent); 00266 00268 FIRM_API ident *get_entity_ident(const ir_entity *ent); 00269 00271 FIRM_API void set_entity_ident(ir_entity *ent, ident *id); 00272 00279 FIRM_API ident *get_entity_ld_ident(const ir_entity *ent); 00280 00282 FIRM_API void set_entity_ld_ident(ir_entity *ent, ident *ld_ident); 00283 00285 FIRM_API const char *get_entity_ld_name(const ir_entity *ent); 00286 00288 FIRM_API int entity_has_ld_ident(const ir_entity *entity); 00289 00291 FIRM_API ir_type *get_entity_owner(const ir_entity *ent); 00292 00298 FIRM_API void set_entity_owner(ir_entity *ent, ir_type *owner); 00299 00301 FIRM_API ir_type *get_entity_type(const ir_entity *ent); 00302 00304 FIRM_API void set_entity_type(ir_entity *ent, ir_type *tp); 00305 00307 FIRM_API ir_linkage get_entity_linkage(const ir_entity *entity); 00308 00310 FIRM_API void set_entity_linkage(ir_entity *entity, ir_linkage linkage); 00312 FIRM_API void add_entity_linkage(ir_entity *entity, ir_linkage linkage); 00314 FIRM_API void remove_entity_linkage(ir_entity *entity, ir_linkage linkage); 00315 00320 FIRM_API ir_volatility get_entity_volatility(const ir_entity *ent); 00321 00326 FIRM_API void set_entity_volatility(ir_entity *ent, ir_volatility vol); 00327 00329 FIRM_API const char *get_volatility_name(ir_volatility var); 00330 00332 FIRM_API unsigned get_entity_alignment(const ir_entity *entity); 00333 00338 FIRM_API void set_entity_alignment(ir_entity *entity, unsigned alignment); 00339 00344 FIRM_API ir_align get_entity_aligned(const ir_entity *ent); 00345 00350 FIRM_API void set_entity_aligned(ir_entity *ent, ir_align a); 00351 00353 FIRM_API const char *get_align_name(ir_align a); 00354 00357 FIRM_API int get_entity_offset(const ir_entity *ent); 00358 00360 FIRM_API void set_entity_offset(ir_entity *ent, int offset); 00361 00364 FIRM_API unsigned char get_entity_offset_bits_remainder(const ir_entity *ent); 00365 00367 FIRM_API void set_entity_offset_bits_remainder(ir_entity *ent, 00368 unsigned char offset); 00369 00371 FIRM_API void *get_entity_link(const ir_entity *ent); 00372 00374 FIRM_API void set_entity_link(ir_entity *ent, void *l); 00375 00380 FIRM_API ir_graph *get_entity_irg(const ir_entity *ent); 00381 00383 #define IR_VTABLE_NUM_NOT_SET ((unsigned)(-1)) 00384 00386 FIRM_API unsigned get_entity_vtable_number(const ir_entity *ent); 00387 00389 FIRM_API void set_entity_vtable_number(ir_entity *ent, unsigned vtable_number); 00390 00392 FIRM_API void set_entity_label(ir_entity *ent, ir_label_t label); 00394 FIRM_API ir_label_t get_entity_label(const ir_entity *ent); 00395 00397 FIRM_API int is_entity_compiler_generated(const ir_entity *ent); 00398 00400 FIRM_API void set_entity_compiler_generated(ir_entity *ent, int flag); 00401 00405 typedef enum { 00406 ir_usage_none = 0, 00407 ir_usage_address_taken = 1 << 0, 00408 ir_usage_write = 1 << 1, 00409 ir_usage_read = 1 << 2, 00410 ir_usage_reinterpret_cast = 1 << 3, 00413 ir_usage_unknown 00414 = ir_usage_address_taken | ir_usage_write | ir_usage_read 00415 | ir_usage_reinterpret_cast 00416 } ir_entity_usage; 00417 00419 FIRM_API ir_entity_usage get_entity_usage(const ir_entity *ent); 00420 00422 FIRM_API void set_entity_usage(ir_entity *ent, ir_entity_usage flag); 00423 00429 FIRM_API dbg_info *get_entity_dbg_info(const ir_entity *ent); 00430 00437 FIRM_API void set_entity_dbg_info(ir_entity *ent, dbg_info *db); 00438 00447 #define IR_VA_START_PARAMETER_NUMBER ((size_t)-1) 00448 00453 FIRM_API int is_parameter_entity(const ir_entity *entity); 00454 00458 FIRM_API size_t get_entity_parameter_number(const ir_entity *entity); 00459 00463 FIRM_API void set_entity_parameter_number(ir_entity *entity, size_t n); 00464 00472 FIRM_API int is_irn_const_expression(ir_node *n); 00473 00482 FIRM_API ir_node *copy_const_value(dbg_info *dbg, ir_node *n, ir_node *to_block); 00483 00485 FIRM_API ir_node *get_atomic_ent_value(ir_entity *ent); 00488 FIRM_API void set_atomic_ent_value(ir_entity *ent, ir_node *val); 00489 00495 typedef enum ir_initializer_kind_t { 00497 IR_INITIALIZER_CONST, 00499 IR_INITIALIZER_TARVAL, 00501 IR_INITIALIZER_NULL, 00503 IR_INITIALIZER_COMPOUND 00504 } ir_initializer_kind_t; 00505 00507 FIRM_API ir_initializer_kind_t get_initializer_kind(const ir_initializer_t *initializer); 00508 00510 FIRM_API const char *get_initializer_kind_name(ir_initializer_kind_t ini); 00511 00515 FIRM_API ir_initializer_t *get_initializer_null(void); 00516 00521 FIRM_API ir_initializer_t *create_initializer_const(ir_node *value); 00522 00524 FIRM_API ir_initializer_t *create_initializer_tarval(ir_tarval *tv); 00525 00527 FIRM_API ir_node *get_initializer_const_value(const ir_initializer_t *initializer); 00528 00530 FIRM_API ir_tarval *get_initializer_tarval_value(const ir_initializer_t *initialzier); 00531 00533 FIRM_API ir_initializer_t *create_initializer_compound(size_t n_entries); 00534 00536 FIRM_API size_t get_initializer_compound_n_entries(const ir_initializer_t *initializer); 00537 00539 FIRM_API void set_initializer_compound_value(ir_initializer_t *initializer, 00540 size_t index, 00541 ir_initializer_t *value); 00542 00544 FIRM_API ir_initializer_t *get_initializer_compound_value( 00545 const ir_initializer_t *initializer, size_t index); 00546 00550 FIRM_API void set_entity_initializer(ir_entity *entity, ir_initializer_t *initializer); 00551 00553 FIRM_API int has_entity_initializer(const ir_entity *entity); 00554 00556 FIRM_API ir_initializer_t *get_entity_initializer(const ir_entity *entity); 00557 00559 FIRM_API void add_entity_overwrites(ir_entity *ent, ir_entity *overwritten); 00562 FIRM_API size_t get_entity_n_overwrites(const ir_entity *ent); 00565 FIRM_API size_t get_entity_overwrites_index(const ir_entity *ent, 00566 ir_entity *overwritten); 00568 FIRM_API ir_entity *get_entity_overwrites(const ir_entity *ent, size_t pos); 00570 FIRM_API void set_entity_overwrites(ir_entity *ent, size_t pos, 00571 ir_entity *overwritten); 00573 FIRM_API void remove_entity_overwrites(ir_entity *ent, ir_entity *overwritten); 00574 00576 FIRM_API size_t get_entity_n_overwrittenby(const ir_entity *ent); 00579 FIRM_API size_t get_entity_overwrittenby_index(const ir_entity *ent, 00580 ir_entity *overwrites); 00582 FIRM_API ir_entity *get_entity_overwrittenby(const ir_entity *ent, size_t pos); 00584 FIRM_API void set_entity_overwrittenby(ir_entity *ent, size_t pos, 00585 ir_entity *overwrites); 00587 FIRM_API void remove_entity_overwrittenby(ir_entity *ent, 00588 ir_entity *overwrites); 00589 00598 FIRM_API int is_entity(const void *thing); 00599 00605 FIRM_API int is_atomic_entity(const ir_entity *ent); 00608 FIRM_API int is_compound_entity(const ir_entity *ent); 00610 FIRM_API int is_method_entity(const ir_entity *ent); 00611 00616 FIRM_API long get_entity_nr(const ir_entity *ent); 00617 00620 FIRM_API ir_visited_t get_entity_visited(const ir_entity *ent); 00621 00624 FIRM_API void set_entity_visited(ir_entity *ent, ir_visited_t num); 00625 00628 FIRM_API void mark_entity_visited(ir_entity *ent); 00629 00632 FIRM_API int entity_visited(const ir_entity *ent); 00633 00636 FIRM_API int entity_not_visited(const ir_entity *ent); 00637 00645 FIRM_API mtp_additional_properties get_entity_additional_properties(const ir_entity *ent); 00646 00648 FIRM_API void set_entity_additional_properties(ir_entity *ent, 00649 mtp_additional_properties prop); 00650 00652 FIRM_API void add_entity_additional_properties(ir_entity *ent, 00653 mtp_additional_properties flag); 00654 00657 FIRM_API ir_type *get_entity_repr_class(const ir_entity *ent); 00658 00693 FIRM_API ir_entity *get_unknown_entity(void); 00694 00697 FIRM_API int is_unknown_entity(const ir_entity *entity); 00698 00700 typedef enum { 00701 allocation_automatic, 00702 allocation_parameter, 00703 allocation_dynamic, 00704 allocation_static 00705 } ir_allocation; 00707 FIRM_API ir_allocation get_entity_allocation(const ir_entity *ent); 00709 FIRM_API void set_entity_allocation(ir_entity *ent, ir_allocation al); 00710 00712 typedef enum { 00713 peculiarity_existent, 00714 peculiarity_description, 00715 peculiarity_inherited 00716 } ir_peculiarity; 00718 FIRM_API ir_peculiarity get_entity_peculiarity(const ir_entity *ent); 00720 FIRM_API void set_entity_peculiarity(ir_entity *ent, ir_peculiarity pec); 00721 00723 FIRM_API int is_entity_final(const ir_entity *ent); 00725 FIRM_API void set_entity_final(ir_entity *ent, int final); 00726 00728 FIRM_API ir_peculiarity get_class_peculiarity(const ir_type *clss); 00730 FIRM_API void set_class_peculiarity(ir_type *clss, ir_peculiarity pec); 00731 00735 typedef enum ptr_access_kind { 00736 ptr_access_none = 0, 00737 ptr_access_read = 1, 00738 ptr_access_write = 2, 00739 ptr_access_rw = ptr_access_read|ptr_access_write, 00740 ptr_access_store = 4, 00741 ptr_access_all = ptr_access_rw|ptr_access_store 00742 } ptr_access_kind; 00743 ENUM_BITSET(ptr_access_kind) 00744 00745 00784 typedef enum { 00785 tpo_uninitialized = 0, /* not a type opcode */ 00786 tpo_class, 00787 tpo_struct, 00788 tpo_method, 00789 tpo_union, 00790 tpo_array, 00791 tpo_enumeration, 00792 tpo_pointer, 00793 tpo_primitive, 00794 tpo_code, 00795 tpo_none, 00796 tpo_unknown, 00797 tpo_last = tpo_unknown /* not a type opcode */ 00798 } tp_opcode; 00799 00808 typedef struct tp_op tp_op; 00809 00810 00817 FIRM_API const char *get_tpop_name(const tp_op *op); 00818 00825 FIRM_API tp_opcode get_tpop_code(const tp_op *op); 00826 00835 FIRM_API int is_SubClass_of(ir_type *low, ir_type *high); 00836 00843 FIRM_API int is_SubClass_ptr_of(ir_type *low, ir_type *high); 00844 00851 #define is_SuperClass_of(high, low) is_SubClass_of(low, high) 00852 00859 #define is_SuperClass_ptr_of(low, high) is_SubClass_ptr_of(high, low) 00860 00864 FIRM_API int is_overwritten_by(ir_entity *high, ir_entity *low); 00865 00871 FIRM_API ir_entity *resolve_ent_polymorphy(ir_type *dynamic_class, 00872 ir_entity* static_ent); 00873 00878 FIRM_API ident *default_mangle_inherited_name(const ir_entity *ent, 00879 const ir_type *clss); 00880 00888 typedef ident *mangle_inherited_name_func(const ir_entity *ent, 00889 const ir_type *clss); 00890 00905 FIRM_API void resolve_inheritance(mangle_inherited_name_func *mfunc); 00906 00907 00908 /* ----------------------------------------------------------------------- */ 00909 /* The transitive closure of the subclass/superclass and */ 00910 /* overwrites/overwrittenby relation. */ 00911 /* */ 00912 /* A walk over the ir (O(#types+#entities)) computes the transitive */ 00913 /* closure. Adding a new type/entity or changing the basic relations in */ 00914 /* some other way invalidates the transitive closure, i.e., it is not */ 00915 /* updated by the basic functions. */ 00916 /* */ 00917 /* The transitive edges are held in a set, not in an array as the */ 00918 /* underlying relation. */ 00919 /* */ 00920 /* Do the sets contain the node itself? I assume NOT! */ 00921 /* ----------------------------------------------------------------------- */ 00922 00926 typedef enum { 00927 inh_transitive_closure_none, 00928 inh_transitive_closure_valid, 00929 inh_transitive_closure_invalid, 00930 inh_transitive_closure_max 00931 } inh_transitive_closure_state; 00932 00935 FIRM_API void set_irp_inh_transitive_closure_state(inh_transitive_closure_state s); 00938 FIRM_API void invalidate_irp_inh_transitive_closure_state(void); 00941 FIRM_API inh_transitive_closure_state get_irp_inh_transitive_closure_state(void); 00942 00948 FIRM_API void compute_inh_transitive_closure(void); 00949 00951 FIRM_API void free_inh_transitive_closure(void); 00952 00954 FIRM_API ir_type *get_class_trans_subtype_first(const ir_type *tp); 00959 FIRM_API ir_type *get_class_trans_subtype_next(const ir_type *tp); 00965 FIRM_API int is_class_trans_subtype(const ir_type *tp, const ir_type *subtp); 00966 00968 FIRM_API ir_type *get_class_trans_supertype_first(const ir_type *tp); 00973 FIRM_API ir_type *get_class_trans_supertype_next(const ir_type *tp); 00974 00976 FIRM_API ir_entity *get_entity_trans_overwrittenby_first(const ir_entity *ent); 00981 FIRM_API ir_entity *get_entity_trans_overwrittenby_next(const ir_entity *ent); 00982 00985 FIRM_API ir_entity *get_entity_trans_overwrites_first(const ir_entity *ent); 00990 FIRM_API ir_entity *get_entity_trans_overwrites_next(const ir_entity *ent); 00991 00992 01017 typedef enum { 01018 ir_class_casts_any = 0, 01020 ir_class_casts_transitive = 1, 01021 ir_class_casts_normalized = 2, 01022 ir_class_casts_state_max 01023 } ir_class_cast_state; 01024 01026 FIRM_API void set_irg_class_cast_state(ir_graph *irg, 01027 ir_class_cast_state state); 01029 FIRM_API ir_class_cast_state get_irg_class_cast_state(const ir_graph *irg); 01031 FIRM_API void set_irp_class_cast_state(ir_class_cast_state state); 01033 FIRM_API ir_class_cast_state get_irp_class_cast_state(void); 01034 01038 enum trverify_error_codes { 01039 no_error = 0, 01040 error_ent_not_cont, 01041 error_null_mem, 01042 error_const_on_wrong_irg, 01043 error_existent_entity_without_irg, 01044 error_wrong_ent_overwrites, 01045 error_inherited_ent_without_const, 01046 error_glob_ent_allocation, 01047 error_ent_const_mode, 01048 error_ent_wrong_owner 01049 }; 01050 01057 FIRM_API int check_type(ir_type *tp); 01058 01071 FIRM_API int tr_verify(void); 01072 01079 FIRM_API void free_type(ir_type *tp); 01080 01082 FIRM_API const tp_op *get_type_tpop(const ir_type *tp); 01084 FIRM_API ident *get_type_tpop_nameid(const ir_type *tp); 01086 FIRM_API const char *get_type_tpop_name(const ir_type *tp); 01088 FIRM_API tp_opcode get_type_tpop_code(const ir_type *tp); 01089 01099 FIRM_API void ir_print_type(char *buffer, size_t buffer_size, 01100 const ir_type *tp); 01101 01103 typedef enum { 01104 layout_undefined, 01110 layout_fixed 01115 } ir_type_state; 01116 01118 FIRM_API const char *get_type_state_name(ir_type_state s); 01119 01121 FIRM_API ir_type_state get_type_state(const ir_type *tp); 01122 01128 FIRM_API void set_type_state(ir_type *tp, ir_type_state state); 01129 01134 FIRM_API ir_mode *get_type_mode(const ir_type *tp); 01135 01140 FIRM_API void set_type_mode(ir_type *tp, ir_mode* m); 01141 01143 FIRM_API unsigned get_type_size_bytes(const ir_type *tp); 01144 01150 FIRM_API void set_type_size_bytes(ir_type *tp, unsigned size); 01151 01153 FIRM_API unsigned get_type_alignment_bytes(ir_type *tp); 01154 01165 FIRM_API void set_type_alignment_bytes(ir_type *tp, unsigned align); 01166 01169 FIRM_API ir_visited_t get_type_visited(const ir_type *tp); 01172 FIRM_API void set_type_visited(ir_type *tp, ir_visited_t num); 01175 FIRM_API void mark_type_visited(ir_type *tp); 01178 FIRM_API int type_visited(const ir_type *tp); 01181 FIRM_API int type_not_visited(const ir_type *tp); 01182 01184 FIRM_API void *get_type_link(const ir_type *tp); 01186 FIRM_API void set_type_link(ir_type *tp, void *l); 01187 01190 FIRM_API void inc_master_type_visited(void); 01193 FIRM_API void set_master_type_visited(ir_visited_t val); 01196 FIRM_API ir_visited_t get_master_type_visited(void); 01197 01204 FIRM_API void set_type_dbg_info(ir_type *tp, type_dbg_info *db); 01205 01211 FIRM_API type_dbg_info *get_type_dbg_info(const ir_type *tp); 01212 01221 FIRM_API int is_type(const void *thing); 01222 01228 FIRM_API long get_type_nr(const ir_type *tp); 01229 01265 FIRM_API int equal_type(ir_type *typ1, ir_type *typ2); 01266 01302 FIRM_API int smaller_type(ir_type *st, ir_type *lt); 01303 01353 FIRM_API ir_type *new_type_class(ident *name); 01354 01356 FIRM_API ir_type *new_d_type_class(ident *name, type_dbg_info *db); 01357 01359 FIRM_API ident *get_class_ident(const ir_type *clss); 01360 01362 FIRM_API const char *get_class_name(const ir_type *clss); 01363 01365 FIRM_API size_t get_class_n_members(const ir_type *clss); 01366 01368 FIRM_API ir_entity *get_class_member(const ir_type *clss, size_t pos); 01369 01374 #define INVALID_MEMBER_INDEX ((size_t)-1) 01375 01377 FIRM_API size_t get_class_member_index(const ir_type *clss, ir_entity *mem); 01378 01381 FIRM_API ir_entity *get_class_member_by_name(ir_type *clss, ident *name); 01382 01387 FIRM_API void add_class_subtype(ir_type *clss, ir_type *subtype); 01388 01390 FIRM_API size_t get_class_n_subtypes(const ir_type *clss); 01391 01393 FIRM_API ir_type *get_class_subtype(ir_type *clss, size_t pos); 01394 01399 FIRM_API size_t get_class_subtype_index(ir_type *clss, const ir_type *subclass); 01400 01405 FIRM_API void set_class_subtype(ir_type *clss, ir_type *subtype, size_t pos); 01406 01408 FIRM_API void remove_class_subtype(ir_type *clss, ir_type *subtype); 01409 01414 FIRM_API void add_class_supertype(ir_type *clss, ir_type *supertype); 01415 01417 FIRM_API size_t get_class_n_supertypes(const ir_type *clss); 01418 01423 FIRM_API size_t get_class_supertype_index(ir_type *clss, ir_type *super_clss); 01424 01426 FIRM_API ir_type *get_class_supertype(ir_type *clss, size_t pos); 01427 01432 FIRM_API void set_class_supertype(ir_type *clss, ir_type *supertype, size_t pos); 01433 01435 FIRM_API void remove_class_supertype(ir_type *clss, ir_type *supertype); 01436 01438 FIRM_API ir_entity *get_class_type_info(const ir_type *clss); 01439 01441 FIRM_API void set_class_type_info(ir_type *clss, ir_entity *ent); 01442 01444 FIRM_API unsigned get_class_vtable_size(const ir_type *clss); 01445 01447 FIRM_API void set_class_vtable_size(ir_type *clss, unsigned size); 01448 01450 FIRM_API int is_class_final(const ir_type *clss); 01451 01453 FIRM_API void set_class_final(ir_type *clss, int flag); 01454 01456 FIRM_API int is_class_interface(const ir_type *clss); 01457 01459 FIRM_API void set_class_interface(ir_type *clss, int flag); 01460 01462 FIRM_API int is_class_abstract(const ir_type *clss); 01463 01465 FIRM_API void set_class_abstract(ir_type *clss, int flag); 01466 01468 FIRM_API int is_Class_type(const ir_type *clss); 01469 01478 FIRM_API const tp_op *type_class; 01480 FIRM_API const tp_op *get_tpop_class(void); 01481 01503 FIRM_API ir_type *new_type_struct(ident *name); 01505 FIRM_API ir_type *new_d_type_struct(ident *name, type_dbg_info* db); 01506 01508 FIRM_API ident *get_struct_ident(const ir_type *strct); 01509 01511 FIRM_API const char *get_struct_name(const ir_type *strct); 01512 01514 FIRM_API size_t get_struct_n_members(const ir_type *strct); 01515 01517 FIRM_API ir_entity *get_struct_member(const ir_type *strct, size_t pos); 01518 01520 FIRM_API size_t get_struct_member_index(const ir_type *strct, ir_entity *member); 01521 01523 FIRM_API int is_Struct_type(const ir_type *strct); 01524 01534 FIRM_API const tp_op *type_struct; 01536 FIRM_API const tp_op *get_tpop_struct(void); 01537 01555 FIRM_API ir_type *new_type_union(ident *name); 01556 01558 FIRM_API ir_type *new_d_type_union(ident *name, type_dbg_info* db); 01559 01560 01562 FIRM_API ident *get_union_ident(const ir_type *uni); 01563 01565 FIRM_API const char *get_union_name(const ir_type *uni); 01566 01568 FIRM_API size_t get_union_n_members(const ir_type *uni); 01569 01571 FIRM_API ir_entity *get_union_member(const ir_type *uni, size_t pos); 01572 01574 FIRM_API size_t get_union_member_index(const ir_type *uni, ir_entity *member); 01575 01577 FIRM_API int is_Union_type(const ir_type *uni); 01578 01586 FIRM_API const tp_op *type_union; 01588 FIRM_API const tp_op *get_tpop_union(void); 01589 01631 FIRM_API ir_type *new_type_method(size_t n_param, size_t n_res); 01632 01642 FIRM_API ir_type *new_d_type_method(size_t n_param, size_t n_res, 01643 type_dbg_info *db); 01644 01646 FIRM_API size_t get_method_n_params(const ir_type *method); 01647 01649 FIRM_API ir_type *get_method_param_type(const ir_type *method, size_t pos); 01653 FIRM_API void set_method_param_type(ir_type *method, size_t pos, ir_type *tp); 01655 FIRM_API size_t get_method_n_ress(const ir_type *method); 01657 FIRM_API ir_type *get_method_res_type(const ir_type *method, size_t pos); 01659 FIRM_API void set_method_res_type(ir_type *method, size_t pos, ir_type *tp); 01660 01666 typedef enum ir_variadicity { 01667 variadicity_non_variadic, 01668 variadicity_variadic 01669 } ir_variadicity; 01670 01672 FIRM_API const char *get_variadicity_name(ir_variadicity vari); 01673 01675 FIRM_API ir_variadicity get_method_variadicity(const ir_type *method); 01676 01678 FIRM_API void set_method_variadicity(ir_type *method, ir_variadicity vari); 01679 01681 FIRM_API mtp_additional_properties get_method_additional_properties(const ir_type *method); 01682 01684 FIRM_API void set_method_additional_properties(ir_type *method, 01685 mtp_additional_properties property_mask); 01686 01688 FIRM_API void add_method_additional_properties(ir_type *method, 01689 mtp_additional_properties flag); 01690 01695 typedef enum { 01696 cc_reg_param = 0x01000000, 01698 cc_last_on_top = 0x02000000, 01703 cc_callee_clear_stk = 0x04000000, 01705 cc_this_call = 0x08000000, 01707 cc_compound_ret = 0x10000000, 01708 cc_frame_on_caller_stk = 0x20000000, 01710 cc_fpreg_param = 0x40000000, 01711 cc_bits = (0xFF << 24) 01712 } calling_convention; 01713 01715 #define cc_cdecl_set (0) 01716 01717 #define cc_stdcall_set cc_callee_clear_stk 01718 01719 #define cc_fastcall_set (cc_reg_param|cc_callee_clear_stk) 01720 01724 #define IS_CDECL(cc_mask) (((cc_mask) & cc_bits) == cc_cdecl_set) 01725 01729 #define IS_STDCALL(cc_mask) (((cc_mask) & cc_bits) == cc_stdcall_set) 01730 01734 #define IS_FASTCALL(cc_mask) (((cc_mask) & cc_bits) == cc_fastcall_set) 01735 01739 #define SET_CDECL(cc_mask) (((cc_mask) & ~cc_bits) | cc_cdecl_set) 01740 01744 #define SET_STDCALL(cc_mask) (((cc_mask) & ~cc_bits) | cc_stdcall_set) 01745 01749 #define SET_FASTCALL(cc_mask) (((cc_mask) & ~cc_bits) | cc_fastcall_set) 01750 01752 FIRM_API unsigned get_method_calling_convention(const ir_type *method); 01753 01755 FIRM_API void set_method_calling_convention(ir_type *method, unsigned cc_mask); 01756 01758 FIRM_API unsigned get_method_n_regparams(ir_type *method); 01759 01761 FIRM_API void set_method_n_regparams(ir_type *method, unsigned n_regs); 01762 01764 FIRM_API int is_Method_type(const ir_type *method); 01765 01773 FIRM_API const tp_op *type_method; 01775 FIRM_API const tp_op *get_tpop_method(void); 01776 01802 FIRM_API ir_type *new_type_array(size_t n_dims, ir_type *element_type); 01803 01812 FIRM_API ir_type *new_d_type_array(size_t n_dims, ir_type *element_type, 01813 type_dbg_info* db); 01814 01815 01817 FIRM_API size_t get_array_n_dimensions(const ir_type *array); 01818 01823 FIRM_API void set_array_bounds_int(ir_type *array, size_t dimension, 01824 int lower_bound, int upper_bound); 01829 FIRM_API void set_array_bounds(ir_type *array, size_t dimension, 01830 ir_node *lower_bound, ir_node *upper_bound); 01832 FIRM_API void set_array_lower_bound(ir_type *array, size_t dimension, 01833 ir_node *lower_bound); 01834 01837 FIRM_API void set_array_lower_bound_int(ir_type *array, size_t dimension, 01838 int lower_bound); 01839 01841 FIRM_API void set_array_upper_bound(ir_type *array, size_t dimension, 01842 ir_node *upper_bound); 01843 01846 FIRM_API void set_array_upper_bound_int(ir_type *array, size_t dimension, 01847 int upper_bound); 01848 01850 FIRM_API int has_array_lower_bound(const ir_type *array, size_t dimension); 01852 FIRM_API ir_node *get_array_lower_bound(const ir_type *array, size_t dimension); 01854 FIRM_API long get_array_lower_bound_int(const ir_type *array, size_t dimension); 01856 FIRM_API int has_array_upper_bound(const ir_type *array, size_t dimension); 01858 FIRM_API ir_node *get_array_upper_bound(const ir_type *array, size_t dimension); 01860 FIRM_API long get_array_upper_bound_int(const ir_type *array, size_t dimension); 01861 01863 FIRM_API void set_array_order(ir_type *array, size_t dimension, size_t order); 01864 01866 FIRM_API size_t get_array_order(const ir_type *array, size_t dimension); 01867 01869 FIRM_API size_t find_array_dimension(const ir_type *array, size_t order); 01870 01872 FIRM_API void set_array_element_type(ir_type *array, ir_type *tp); 01873 01875 FIRM_API ir_type *get_array_element_type(const ir_type *array); 01876 01878 FIRM_API void set_array_element_entity(ir_type *array, ir_entity *ent); 01879 01881 FIRM_API ir_entity *get_array_element_entity(const ir_type *array); 01882 01884 FIRM_API int is_Array_type(const ir_type *array); 01885 01894 FIRM_API const tp_op *type_array; 01896 FIRM_API const tp_op *get_tpop_array(void); 01897 01915 FIRM_API ir_type *new_type_enumeration(ident *name, size_t n_enums); 01916 01918 FIRM_API ir_type *new_d_type_enumeration(ident *name, size_t n_enums, 01919 type_dbg_info *db); 01920 01921 01923 FIRM_API ident *get_enumeration_ident(const ir_type *enumeration); 01924 01926 FIRM_API const char *get_enumeration_name(const ir_type *enumeration); 01927 01929 FIRM_API void set_enumeration_const(ir_type *enumeration, size_t pos, 01930 ident *nameid, ir_tarval *con); 01931 01933 FIRM_API size_t get_enumeration_n_enums(const ir_type *enumeration); 01934 01936 FIRM_API ir_enum_const *get_enumeration_const(const ir_type *enumeration, 01937 size_t pos); 01938 01940 FIRM_API ir_type *get_enumeration_owner(const ir_enum_const *enum_cnst); 01941 01943 FIRM_API void set_enumeration_value(ir_enum_const *enum_cnst, ir_tarval *con); 01944 01946 FIRM_API ir_tarval *get_enumeration_value(const ir_enum_const *enum_cnst); 01947 01949 FIRM_API void set_enumeration_nameid(ir_enum_const *enum_cnst, ident *id); 01950 01952 FIRM_API ident *get_enumeration_const_nameid(const ir_enum_const *enum_cnst); 01953 01955 FIRM_API const char *get_enumeration_const_name(const ir_enum_const *enum_cnst); 01956 01958 FIRM_API int is_Enumeration_type(const ir_type *enumeration); 01959 01969 FIRM_API const tp_op *type_enumeration; 01971 FIRM_API const tp_op *get_tpop_enumeration(void); 01972 01984 FIRM_API ir_type *new_type_pointer(ir_type *points_to); 01985 01987 FIRM_API ir_type *new_d_type_pointer(ir_type *points_to, type_dbg_info* db); 01988 01989 01991 FIRM_API void set_pointer_points_to_type(ir_type *pointer, ir_type *tp); 01992 01994 FIRM_API ir_type *get_pointer_points_to_type(const ir_type *pointer); 01995 01997 FIRM_API int is_Pointer_type(const ir_type *pointer); 01998 02002 FIRM_API ir_type *find_pointer_type_to_type(ir_type *tp); 02003 02011 FIRM_API const tp_op *type_pointer; 02013 FIRM_API const tp_op *get_tpop_pointer(void); 02014 02026 FIRM_API ir_type *new_type_primitive(ir_mode *mode); 02027 02029 FIRM_API ir_type *new_d_type_primitive(ir_mode *mode, type_dbg_info* db); 02030 02032 FIRM_API int is_Primitive_type(const ir_type *primitive); 02033 02035 FIRM_API ir_type *get_primitive_base_type(const ir_type *tp); 02036 02038 FIRM_API void set_primitive_base_type(ir_type *tp, ir_type *base_tp); 02039 02048 FIRM_API const tp_op *type_primitive; 02050 FIRM_API const tp_op *get_tpop_primitive(void); 02051 02073 FIRM_API ir_type *get_none_type(void); 02075 FIRM_API int is_none_type(const ir_type *type); 02084 FIRM_API const tp_op *tpop_none; 02086 FIRM_API const tp_op *get_tpop_none(void); 02093 FIRM_API ir_type *get_code_type(void); 02097 FIRM_API int is_code_type(const ir_type *tp); 02101 FIRM_API const tp_op *tpop_code; 02103 FIRM_API const tp_op *get_tpop_code_type(void); 02125 FIRM_API ir_type *get_unknown_type(void); 02127 FIRM_API int is_unknown_type(const ir_type *type); 02136 FIRM_API const tp_op *tpop_unknown; 02138 FIRM_API const tp_op *get_tpop_unknown(void); 02146 FIRM_API int is_atomic_type(const ir_type *tp); 02147 02157 FIRM_API ident *get_compound_ident(const ir_type *tp); 02158 02160 FIRM_API const char *get_compound_name(const ir_type *tp); 02161 02173 FIRM_API size_t get_compound_n_members(const ir_type *tp); 02174 02183 FIRM_API ir_entity *get_compound_member(const ir_type *tp, size_t pos); 02184 02186 FIRM_API size_t get_compound_member_index(const ir_type *tp, ir_entity *member); 02187 02189 FIRM_API void remove_compound_member(ir_type *compound, ir_entity *entity); 02190 02194 FIRM_API void default_layout_compound_type(ir_type *tp); 02195 02203 FIRM_API int is_compound_type(const ir_type *tp); 02204 02216 FIRM_API ir_type *new_type_frame(void); 02217 02221 FIRM_API int is_frame_type(const ir_type *tp); 02222 02228 FIRM_API ir_type *clone_frame_type(ir_type *type); 02229 02242 FIRM_API ir_entity *frame_alloc_area(ir_type *frame_type, int size, 02243 unsigned alignment, int at_start); 02244 02257 typedef int (compare_types_func_t)(const void *tp1, const void *tp2); 02258 02260 typedef union { 02261 ir_type *typ; 02262 ir_entity *ent; 02263 } type_or_ent; 02264 02270 typedef void type_walk_func(type_or_ent tore, void *env); 02271 02277 typedef void class_walk_func(ir_type *clss, void *env); 02278 02283 FIRM_API void type_walk(type_walk_func *pre, type_walk_func *post, void *env); 02284 02290 FIRM_API void type_walk_irg(ir_graph *irg, type_walk_func *pre, 02291 type_walk_func *post, void *env); 02292 02302 FIRM_API void type_walk_super2sub(type_walk_func *pre, type_walk_func *post, 02303 void *env); 02304 02317 FIRM_API void type_walk_super(type_walk_func *pre, type_walk_func *post, 02318 void *env); 02319 02326 FIRM_API void class_walk_super2sub(class_walk_func *pre, class_walk_func *post, 02327 void *env); 02328 02335 typedef void entity_walk_func(ir_entity *ent, void *env); 02336 02344 FIRM_API void walk_types_entities(ir_type *tp, entity_walk_func *doit, 02345 void *env); 02346 02353 FIRM_API void types_calc_finalization(void); 02354 02356 FIRM_API ir_visibility get_type_visibility(const ir_type *tp); 02358 FIRM_API void set_type_visibility(ir_type *tp, ir_visibility v); 02359 02364 #include "end.h" 02365 02366 #endif