📄 trans.h
字号:
/* Initialize a statement block. */void gfc_init_block (stmtblock_t *);/* Start a new statement block. Like gfc_init_block but also starts a new variable scope. */void gfc_start_block (stmtblock_t *);/* Finish a statement block. Also closes the scope if the block was created with gfc_start_block. */tree gfc_finish_block (stmtblock_t *);/* Merge the scope of a block with its parent. */void gfc_merge_block_scope (stmtblock_t * block);/* Return the backend label decl. */tree gfc_get_label_decl (gfc_st_label *);/* Return the decl for an external function. */tree gfc_get_extern_function_decl (gfc_symbol *);/* Return the decl for a function. */tree gfc_get_function_decl (gfc_symbol *);/* Build a CALL_EXPR. */tree gfc_build_function_call (tree, tree);/* Build an ADDR_EXPR. */tree gfc_build_addr_expr (tree, tree);/* Build an INDIRECT_REF. */tree gfc_build_indirect_ref (tree);/* Build an ARRAY_REF. */tree gfc_build_array_ref (tree, tree);/* Creates a label. Decl is artificial if label_id == NULL_TREE. */tree gfc_build_label_decl (tree);/* Return the decl used to hold the function return value. Do not use if the function has an explicit result variable. */tree gfc_get_fake_result_decl (gfc_symbol *);/* Get the return label for the current function. */tree gfc_get_return_label (void);/* Add a decl to the binding level for the current function. */void gfc_add_decl_to_function (tree);/* Make prototypes for runtime library functions. */void gfc_build_builtin_function_decls (void);/* Set the backend source location of a decl. */void gfc_set_decl_location (tree, locus *);/* Return the variable decl for a symbol. */tree gfc_get_symbol_decl (gfc_symbol *);/* Build a static initializer. */tree gfc_conv_initializer (gfc_expr *, gfc_typespec *, tree, bool, bool);/* Substitute a temporary variable in place of the real one. */void gfc_shadow_sym (gfc_symbol *, tree, gfc_saved_var *);/* Restore the original variable. */void gfc_restore_sym (gfc_symbol *, gfc_saved_var *);/* Returns true if a variable of specified size should go on the stack. */int gfc_can_put_var_on_stack (tree);/* Allocate the lang-specific part of a decl node. */void gfc_allocate_lang_decl (tree);/* Advance along a TREE_CHAIN. */tree gfc_advance_chain (tree, int);/* Create a decl for a function. */void gfc_create_function_decl (gfc_namespace *);/* Generate the code for a function. */void gfc_generate_function_code (gfc_namespace *);/* Output a BLOCK DATA program unit. */void gfc_generate_block_data (gfc_namespace *);/* Output a decl for a module variable. */void gfc_generate_module_vars (gfc_namespace *);/* Get and set the current location. */void gfc_set_backend_locus (locus *);void gfc_get_backend_locus (locus *);/* Handle static constructor functions. */extern GTY(()) tree gfc_static_ctors;void gfc_generate_constructors (void);/* Generate a runtime error check. */void gfc_trans_runtime_check (tree, tree, stmtblock_t *);/* Generate code for an assignment, includes scalarization. */tree gfc_trans_assignment (gfc_expr *, gfc_expr *);/* Generate code for a pointer assignment. */tree gfc_trans_pointer_assignment (gfc_expr *, gfc_expr *);/* Initialize function decls for library functions. */void gfc_build_intrinsic_lib_fndecls (void);/* Create function decls for IO library functions. */void gfc_build_io_library_fndecls (void);/* Build a function decl for a library function. */tree gfc_build_library_function_decl (tree, tree, int, ...);/* somewhere! */tree pushdecl (tree);tree pushdecl_top_level (tree);void pushlevel (int);tree poplevel (int, int, int);tree getdecls (void);tree gfc_truthvalue_conversion (tree);tree builtin_function (const char *, tree, int, enum built_in_class, const char *, tree);/* Runtime library function decls. */extern GTY(()) tree gfor_fndecl_internal_malloc;extern GTY(()) tree gfor_fndecl_internal_malloc64;extern GTY(()) tree gfor_fndecl_internal_realloc;extern GTY(()) tree gfor_fndecl_internal_realloc64;extern GTY(()) tree gfor_fndecl_internal_free;extern GTY(()) tree gfor_fndecl_allocate;extern GTY(()) tree gfor_fndecl_allocate64;extern GTY(()) tree gfor_fndecl_deallocate;extern GTY(()) tree gfor_fndecl_pause_numeric;extern GTY(()) tree gfor_fndecl_pause_string;extern GTY(()) tree gfor_fndecl_stop_numeric;extern GTY(()) tree gfor_fndecl_stop_string;extern GTY(()) tree gfor_fndecl_select_string;extern GTY(()) tree gfor_fndecl_runtime_error;extern GTY(()) tree gfor_fndecl_set_fpe;extern GTY(()) tree gfor_fndecl_set_std;extern GTY(()) tree gfor_fndecl_ttynam;extern GTY(()) tree gfor_fndecl_ctime;extern GTY(()) tree gfor_fndecl_fdate;extern GTY(()) tree gfor_fndecl_in_pack;extern GTY(()) tree gfor_fndecl_in_unpack;extern GTY(()) tree gfor_fndecl_associated;/* Math functions. Many other math functions are handled in trans-intrinsic.c. */typedef struct gfc_powdecl_list GTY(()){ tree integer; tree real; tree cmplx;}gfc_powdecl_list;extern GTY(()) gfc_powdecl_list gfor_fndecl_math_powi[4][3];extern GTY(()) tree gfor_fndecl_math_cpowf;extern GTY(()) tree gfor_fndecl_math_cpow;extern GTY(()) tree gfor_fndecl_math_cpowl10;extern GTY(()) tree gfor_fndecl_math_cpowl16;extern GTY(()) tree gfor_fndecl_math_ishftc4;extern GTY(()) tree gfor_fndecl_math_ishftc8;extern GTY(()) tree gfor_fndecl_math_ishftc16;extern GTY(()) tree gfor_fndecl_math_exponent4;extern GTY(()) tree gfor_fndecl_math_exponent8;extern GTY(()) tree gfor_fndecl_math_exponent10;extern GTY(()) tree gfor_fndecl_math_exponent16;/* String functions. */extern GTY(()) tree gfor_fndecl_copy_string;extern GTY(()) tree gfor_fndecl_compare_string;extern GTY(()) tree gfor_fndecl_concat_string;extern GTY(()) tree gfor_fndecl_string_len_trim;extern GTY(()) tree gfor_fndecl_string_index;extern GTY(()) tree gfor_fndecl_string_scan;extern GTY(()) tree gfor_fndecl_string_verify;extern GTY(()) tree gfor_fndecl_string_trim;extern GTY(()) tree gfor_fndecl_string_repeat;extern GTY(()) tree gfor_fndecl_adjustl;extern GTY(()) tree gfor_fndecl_adjustr;/* Other misc. runtime library functions. */extern GTY(()) tree gfor_fndecl_size0;extern GTY(()) tree gfor_fndecl_size1;extern GTY(()) tree gfor_fndecl_iargc;/* Implemented in FORTRAN. */extern GTY(()) tree gfor_fndecl_si_kind;extern GTY(()) tree gfor_fndecl_sr_kind;/* True if node is an integer constant. */#define INTEGER_CST_P(node) (TREE_CODE(node) == INTEGER_CST)/* G95-specific declaration information. *//* Array types only. */struct lang_type GTY(()){ int rank; tree lbound[GFC_MAX_DIMENSIONS]; tree ubound[GFC_MAX_DIMENSIONS]; tree stride[GFC_MAX_DIMENSIONS]; tree size; tree offset; tree dtype; tree dataptr_type;};struct lang_decl GTY(()){ /* Dummy variables. */ tree saved_descriptor; /* Assigned integer nodes. Stringlength is the IO format string's length. Addr is the address of the string or the target label. Stringlength is initialized to -2 and assigned to -1 when addr is assigned to the address of target label. */ tree stringlen; tree addr;};#define GFC_DECL_ASSIGN_ADDR(node) DECL_LANG_SPECIFIC(node)->addr#define GFC_DECL_STRING_LEN(node) DECL_LANG_SPECIFIC(node)->stringlen#define GFC_DECL_SAVED_DESCRIPTOR(node) \ (DECL_LANG_SPECIFIC(node)->saved_descriptor)#define GFC_DECL_PACKED_ARRAY(node) DECL_LANG_FLAG_0(node)#define GFC_DECL_PARTIAL_PACKED_ARRAY(node) DECL_LANG_FLAG_1(node)#define GFC_DECL_ASSIGN(node) DECL_LANG_FLAG_2(node)/* An array descriptor. */#define GFC_DESCRIPTOR_TYPE_P(node) TYPE_LANG_FLAG_1(node)/* An array without a descriptor. */#define GFC_ARRAY_TYPE_P(node) TYPE_LANG_FLAG_2(node)/* The GFC_TYPE_ARRAY_* members are present in both descriptor and descriptorless array types. */#define GFC_TYPE_ARRAY_LBOUND(node, dim) \ (TYPE_LANG_SPECIFIC(node)->lbound[dim])#define GFC_TYPE_ARRAY_UBOUND(node, dim) \ (TYPE_LANG_SPECIFIC(node)->ubound[dim])#define GFC_TYPE_ARRAY_STRIDE(node, dim) \ (TYPE_LANG_SPECIFIC(node)->stride[dim])#define GFC_TYPE_ARRAY_RANK(node) (TYPE_LANG_SPECIFIC(node)->rank)#define GFC_TYPE_ARRAY_SIZE(node) (TYPE_LANG_SPECIFIC(node)->size)#define GFC_TYPE_ARRAY_OFFSET(node) (TYPE_LANG_SPECIFIC(node)->offset)/* Code should use gfc_get_dtype instead of accesig this directly. It may not be known when the type is created. */#define GFC_TYPE_ARRAY_DTYPE(node) (TYPE_LANG_SPECIFIC(node)->dtype)#define GFC_TYPE_ARRAY_DATAPTR_TYPE(node) \ (TYPE_LANG_SPECIFIC(node)->dataptr_type)/* I changed this from sorry(...) because it should not return. *//* TODO: Remove gfc_todo_error before releasing version 1.0. */#define gfc_todo_error(args...) fatal_error("gfc_todo: Not Implemented: " args)/* Build an expression with void type. */#define build1_v(code, arg) build(code, void_type_node, arg)#define build2_v(code, arg1, arg2) build2(code, void_type_node, \ arg1, arg2)#define build3_v(code, arg1, arg2, arg3) build3(code, void_type_node, \ arg1, arg2, arg3)/* This group of functions allows a caller to evaluate an expression from the callee's interface. It establishes a mapping between the interface's dummy arguments and the caller's actual arguments, then applies that mapping to a given gfc_expr. You can initialize a mapping structure like so: gfc_interface_mapping mapping; ... gfc_init_interface_mapping (&mapping); You should then evaluate each actual argument into a temporary gfc_se structure, here called "se", and map the result to the dummy argument's symbol, here called "sym": gfc_add_interface_mapping (&mapping, sym, &se); After adding all mappings, you should call: gfc_finish_interface_mapping (&mapping, pre, post); where "pre" and "post" are statement blocks for initialization and finalization code respectively. You can then evaluate an interface expression "expr" as follows: gfc_apply_interface_mapping (&mapping, se, expr); Once you've evaluated all expressions, you should free the mapping structure with: gfc_free_interface_mapping (&mapping); *//* This structure represents a mapping from OLD to NEW, where OLD is a dummy argument symbol and NEW is a symbol that represents the value of an actual argument. Mappings are linked together using NEXT (in no particular order). */typedef struct gfc_interface_sym_mapping{ struct gfc_interface_sym_mapping *next; gfc_symbol *old; gfc_symtree *new;}gfc_interface_sym_mapping;/* This structure is used by callers to evaluate an expression from a callee's interface. */typedef struct gfc_interface_mapping{ /* Maps the interface's dummy arguments to the values that the caller is passing. The whole list is owned by this gfc_interface_mapping. */ gfc_interface_sym_mapping *syms; /* A list of gfc_charlens that were needed when creating copies of expressions. The whole list is owned by this gfc_interface_mapping. */ gfc_charlen *charlens;}gfc_interface_mapping;void gfc_init_interface_mapping (gfc_interface_mapping *);void gfc_free_interface_mapping (gfc_interface_mapping *);void gfc_add_interface_mapping (gfc_interface_mapping *, gfc_symbol *, gfc_se *);void gfc_finish_interface_mapping (gfc_interface_mapping *, stmtblock_t *, stmtblock_t *);void gfc_apply_interface_mapping (gfc_interface_mapping *, gfc_se *, gfc_expr *);#endif /* GFC_TRANS_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -