#include <stdint.h>#include <alloca.h>#include "defs.h"#include "opcode.h"#include "symtab.h"#include "const.h"#include "cxx_template.h"#include "wn_tree_util.h"#include "lwn_util.h"#include "wn_simp.h"#include "ipo_defs.h"#include "ipa_df.h"#include "ipaa.h"#include "ipa_cprop.h"#include "ipa_option.h"#include "ipo_parent.h"#include "ipo_const.h"#include "ipc_symtab_merge.h"#include "ipa_section_annot.h"

Go to the source code of this file.
| #define __STDC_LIMIT_MACROS |
Definition at line 46 of file ipo_const.cxx.
| typedef HASH_TABLE<ST*,WN*> ST_TO_WN_MAP |
Definition at line 70 of file ipo_const.cxx.
| typedef HASH_TABLE<TY_IDX,TY_IDX> TY_TO_TY_MAP |
Definition at line 71 of file ipo_const.cxx.
| static void Check_If_Global_Has_Const_Value | ( | IPA_NODE * | node, | |
| WN * | block, | |||
| ST * | global_st | |||
| ) | [static] |
Definition at line 925 of file ipo_const.cxx.
References GLOBAL_ANNOT::Find(), Gen_WN_Const(), Generate_Assignment_Stmt(), IPA_NODE::Global_Annot(), GLOBAL_ANNOT::Index(), SCLASS_COMMON, ST_base, ST_ofst, ST_sclass, ST_st_idx, ST_type, TY_size, UINT32, and GLOBAL_VALUE::Value().
Referenced by Propagate_Constants().
| static UINT32 Compute_param_count | ( | INT | kid, | |
| const VALUE_DYN_ARRAY & | cprop_annot | |||
| ) | [static] |
Definition at line 1277 of file ipo_const.cxx.
References i, INT, last, DYN_ARRAY< T >::Lastidx(), MIN, and min.
Referenced by Reset_param_list().
Definition at line 149 of file ipo_const.cxx.
References ARB_copy(), i, INT32, Is_True, KIND_ARRAY, MTYPE_UNKNOWN, New_ARB(), New_TY(), Set_TY_align, Set_TY_arb(), Set_TY_etype(), TY_align, TY_AR_ndims, TY_arb(), TY_etype, TY_Init(), TY_kind, TY_size, and Ty_Table.
Referenced by fix_array_bounds::operator()().
| static ST* Create_Const_ST | ( | const SUMMARY_VALUE & | value | ) | [static] |
Definition at line 1422 of file ipo_const.cxx.
References CLASS_CONST, Enter_tcon(), SUMMARY_VALUE::Get_const_st_idx(), SUMMARY_VALUE::Get_int_const_value(), SUMMARY_VALUE::Get_mtype(), SUMMARY_VALUE::Get_tcon_idx(), Host_To_Targ(), SUMMARY_VALUE::Is_const_st(), SUMMARY_VALUE::Is_int_const(), Is_True, MTYPE_To_TY, New_Const_Sym(), ST_class, ST_is_const_var, ST_ptr(), Tcon_Table, and TCON_ty.
Referenced by IPO_propagate_globals().
| static ST* Create_Global_ST | ( | const SUMMARY_VALUE & | value | ) | [static] |
Definition at line 574 of file ipo_const.cxx.
References CLASS_CONST, Enter_tcon(), SUMMARY_VALUE::Get_const_st_idx(), SUMMARY_VALUE::Get_const_type(), SUMMARY_VALUE::Get_global_st_idx(), SUMMARY_VALUE::Get_int_const_value(), SUMMARY_VALUE::Get_mtype(), SUMMARY_VALUE::Get_tcon_idx(), Host_To_Targ(), SUMMARY_VALUE::Is_addr_of(), SUMMARY_VALUE::Is_convertible_to_global(), Is_True, mtype, MTYPE_is_integral, MTYPE_To_TY, New_Const_Sym(), NULL, ST_class, ST_is_const_var, St_Table, SUMMARY_VALUE::Target_mtype(), Tcon_Table, TCON_ty, TRUE, TYPE_ID, VALUE_CONST, VALUE_GLOBAL, and VALUE_INT_CONST.
Referenced by Gen_LDA(), and Propagate_Constants().
Definition at line 708 of file ipo_const.cxx.
References iter, NULL, op, and WN_TREE_ITER_base< WHIRL >::Wn().
Referenced by Replace_Addr_Of_Formal_By_Actual(), and Replace_Formal_By_Actual().
| static WN* Gen_LDA | ( | const SUMMARY_VALUE & | value, | |
| const ST * | formal | |||
| ) | [inline, static] |
Definition at line 629 of file ipo_const.cxx.
References Create_Global_ST(), GLOBAL_SYMTAB, Is_True, MTYPE_V, NULL, OPCODE_make_op(), OPR_LDA, Pointer_type, ST_level, ST_st_idx, ST_type, and WN_CreateLda.
Referenced by Propagate_Constants().
| static WN* Gen_WN_Const | ( | const SUMMARY_VALUE & | value | ) | [static] |
Definition at line 535 of file ipo_const.cxx.
References CLASS_CONST, Fail_FmtAssertion(), SUMMARY_VALUE::Get_const_st_idx(), SUMMARY_VALUE::Get_const_type(), SUMMARY_VALUE::Get_int_const_value(), SUMMARY_VALUE::Get_mtype(), SUMMARY_VALUE::Get_tcon_idx(), SUMMARY_VALUE::Is_addr_of(), Is_True, Mtype_comparison(), MTYPE_is_integral, MTYPE_To_TY, MTYPE_V, New_Const_Sym(), NULL, OPCODE_make_op(), OPR_CONST, ST_class, ST_is_const_var, ST_st_idx, St_Table, Tcon_Table, TCON_ty, VALUE_CONST, VALUE_INT_CONST, WN_CreateConst, and WN_Intconst().
Referenced by Check_If_Global_Has_Const_Value(), IPO_propagate_globals(), and Propagate_Constants().
Definition at line 647 of file ipo_const.cxx.
References IPA_Enable_Assert, IPA_Enable_Cprop2, LWN_Set_Parent, NULL, ST_type, TY_mtype, TYPE_ID, WN_INSERT_BlockBefore(), WN_Stid(), and WN_Type_Conversion().
Referenced by Check_If_Global_Has_Const_Value(), IPO_propagate_globals(), and Propagate_Constants().
| static BOOL IPA_constant_in_array_bounds | ( | const SUMMARY_VALUE & | value, | |
| WN * | pu, | |||
| ST * | formal_st | |||
| ) | [static] |
Definition at line 453 of file ipo_const.cxx.
References BOOL, FALSE, Is_True, iter, mtype, Mtype_comparison(), MTYPE_is_integral, OPR_FUNC_ENTRY, OPR_LDID, OPR_PRAGMA, WN_TREE_ITER_base< WHIRL >::Replace(), SCLASS_FORMAL_REF, ST_sclass, ST_type, Summary_value_to_intconst(), TRUE, TY_mtype, TYPE_ID, wn, WN_TREE_ITER_base< WHIRL >::Wn(), WN_COPY_Tree(), WN_operator(), WN_pragma(), WN_PRAGMA_PREAMBLE_END, WN_rtype(), WN_set_rtype(), and WN_st().
Referenced by IPO_propagate_globals(), and Propagate_Constants().
Definition at line 1175 of file ipo_const.cxx.
References Clear_ST_is_value_parm(), IPA_NODE::Cprop_Annot(), CURRENT_SYMTAB, For_all(), IPA_NODE_SECTION_INFO::Get_formals(), IPA_NODE::Has_Aliased_Formal(), i, INT, IPA_Enable_Array_Sections, LWN_Parentize(), New_TYLIST(), NULL, Propagate_Constants(), PU_prototype(), Pu_Table, SCLASS_AUTO, sec, IPA_NODE::Section_Annot(), Set_ST_sclass, Set_TY_tylist(), Set_TYLIST_type(), IPA_NODE::Set_Whirl_Tree(), DYN_ARRAY< T >::Sizeof(), ST_pu(), St_Table, TY_tylist(), Tylist_Table, UINT, IPA_NODE::Whirl_Tree(), WN_CreateEntry, WN_func_body, WN_func_pragmas, WN_func_varrefs, WN_kid(), WN_linenum(), WN_map_id(), WN_num_formals, WN_set_map_id(), WN_st(), and WN_st_idx().
Referenced by IPA_Preoptimize(), and IPO_Process_node().
Definition at line 1452 of file ipo_const.cxx.
References BOOL, GLOBAL_ANNOT::Bottom(), GLOBAL_ANNOT::Common_ST, Create_Const_ST(), DYN_ARRAY< T >::Elements(), FALSE, Gen_WN_Const(), Generate_Assignment_Stmt(), SUMMARY_VALUE::Get_mtype(), IPA_NODE::Global_Annot(), GLOBAL_ANNOT::Global_Value_Array(), i, INT32, IPA_constant_in_array_bounds(), IPAA_NODE_INFO::Is_def_elmt(), LWN_Insert_Block_Before(), LWN_Parentize(), MEM_POOL_Initialize, MEM_POOL_Pop, MEM_POOL_Push, IPA_NODE::Mod_Ref_Info(), new_block, GLOBAL_ANNOT::Offset_Size_To_ST, pu, Replace_Formal_By_Actual(), GLOBAL_ANNOT::Size, Size(), ST_IDX_index(), ST_ptr(), ST_type, Temp_pool, GLOBAL_ANNOT::Top(), TRUE, TY_mtype, UINT32, Update_array_bounds(), IPA_NODE::Whirl_Tree(), WN_CreateBlock, WN_first(), WN_func_body, and WN_verifier().
Referenced by IPA_Preoptimize(), and IPO_Process_node().
| static void Propagate_Constants | ( | IPA_NODE * | node, | |
| WN * | w, | |||
| VALUE_DYN_ARRAY * | cprop_annot | |||
| ) | [static] |
Definition at line 978 of file ipo_const.cxx.
References actual, BOOL, Check_If_Global_Has_Const_Value(), SUMMARY_VALUE::Clear_is_addr_of(), Create_Global_ST(), FALSE, Gen_LDA(), Gen_WN_Const(), Generate_Assignment_Stmt(), SUMMARY_VALUE::Get_global_st_idx(), i, INT, IPA_constant_in_array_bounds(), SUMMARY_VALUE::Is_addr_of(), SUMMARY_VALUE::Is_constant(), IPAA_NODE_INFO::Is_formal_dmod_elmt(), IPAA_NODE_INFO::Is_formal_imod_elmt(), SUMMARY_VALUE::Is_global(), Is_True, LWN_Insert_Block_Before(), LWN_Parentize(), IPA_NODE::Mod_Ref_Info(), MTYPE_is_complex, NULL, SUMMARY_VALUE::Remove_param(), Replace_Addr_Of_Formal_By_Actual(), Replace_Formal_By_Actual(), Replace_Formal_By_LDA(), SCLASS_FORMAL_REF, SUMMARY_VALUE::Set_convertible_to_global(), SUMMARY_VALUE::Set_mtype(), ST_addr_saved(), ST_sclass, ST_st_idx, St_Table, ST_type, SUMMARY_VALUE::Target_mtype(), TRUE, TY_mtype, Update_array_bounds(), WN_CreateBlock, WN_first(), WN_formal, WN_func_body, WN_num_formals, WN_st(), and WN_verifier().
Referenced by IPA_Propagate_Constants().
| static void Replace_Addr_Of_Formal_By_Actual | ( | WN * | func_body, | |
| ST_IDX | formal, | |||
| const WN * | actual | |||
| ) | [static] |
Definition at line 904 of file ipo_const.cxx.
References for_all_wn(), Is_True, op, OPR_FUNC_ENTRY, and WN_operator().
Referenced by Propagate_Constants().
| static void Replace_Formal_By_Actual | ( | WN * | func_body, | |
| ST_IDX | formal, | |||
| const ST * | actual | |||
| ) | [inline, static] |
Definition at line 719 of file ipo_const.cxx.
References CLASS_CONST, FALSE, for_all_wn(), INT64, Is_True, iter, mtype, MTYPE_is_integral, NULL, OPERATOR_has_sym(), OPERATOR_is_expression(), OPERATOR_is_leaf(), OPR_FUNC_ENTRY, OPR_IO_ITEM, WN_TREE_ITER_base< WHIRL >::Replace(), ST_class, ST_st_idx, ST_tcon, ST_type, Targ_To_Host(), Tcon_Table, TCON_ty, TY_mtype, Ty_Table, TYPE_ID, WN_TREE_ITER_base< WHIRL >::Wn(), WN_operator(), WN_Simplify_Tree(), and WN_st_idx().
Referenced by IPO_propagate_globals(), and Propagate_Constants().
Definition at line 791 of file ipo_const.cxx.
References Is_True, iter, MTYPE_V, NULL, OPCODE_make_op(), OPERATOR_has_sym(), OPR_FUNC_ENTRY, OPR_ICALL, OPR_ILOAD, OPR_ISTORE, OPR_LDA, OPR_LDID, OPR_STID, Pointer_type, WN_TREE_ITER_base< WHIRL >::Replace(), Replace_Icall(), TY_pointed, UINT, WN_TREE_ITER_base< WHIRL >::Wn(), WN_CreateLda, WN_CreateLdid, WN_desc(), WN_field_id(), WN_kid(), WN_kid0(), WN_kid1(), WN_kid_count(), WN_Ldid(), WN_offset(), WN_operator(), WN_rtype(), WN_st_idx(), WN_Stid(), and WN_ty().
Referenced by Propagate_Constants().
Definition at line 773 of file ipo_const.cxx.
References call(), i, INT, OPR_CALL, WN_TREE_ITER_base< WHIRL >::Replace(), WN_call_flag(), WN_desc(), WN_generic_call(), WN_kid(), WN_kid_count(), and WN_rtype().
Referenced by Replace_Formal_By_LDA().
| void Reset_param_list | ( | IPA_NODE * | caller, | |
| IPA_NODE * | callee, | |||
| IPA_EDGE * | edge, | |||
| IPA_CALL_GRAPH * | cg | |||
| ) |
Definition at line 1298 of file ipo_const.cxx.
References call(), Compute_param_count(), IPA_NODE::Cprop_Annot(), Current_Map_Tab, DEMANGLE, first, fprintf(), fputc(), IPA_NODE::Has_frequency(), IPA_EDGE::Has_Pass_Not_Saved_Param(), IPA_EDGE::Has_Readonly_Param(), i, INT, IPA_Enable_Readonly_Ref, IPA_WN_MAP32_Get(), IPA_WN_MAP32_Set(), Is_True, last, DYN_ARRAY< T >::Lastidx(), LWN_Extract_From_Block(), LWN_Insert_Block_Before(), LWN_Set_Parent, IPA_CALL_GRAPH::Map_Callsites(), IPA_NODE::Name(), NULL, OPR_BLOCK, OPR_ICALL, Parent_Map, SUMMARY_CALLSITE::Set_param_count(), IPA_EDGE::Set_Whirl_Node(), ST_name, IPA_EDGE::Summary_Callsite(), TFile, Trace_IPA, Trace_Perf, TYPE_ID, UINT, IPA_EDGE::Whirl_Node(), IPA_NODE::Whirl_Tree(), WN_Call, WN_call_flag(), WN_desc(), WN_Get_Linenum(), WN_Get_Parent(), WN_kid(), WN_kid_count(), WN_MAP_FEEDBACK, WN_operator(), WN_Parm_Passed_Not_Saved, WN_Parm_Read_Only, WN_rtype(), WN_set_kid_count(), WN_Set_Linenum(), WN_Set_Parent(), WN_Set_Parm_Dummy, and WN_st().
Referenced by IPO_Process_edge().
| static BOOL ST_has_const_value | ( | ST * | st, | |
| WN * | stid, | |||
| ST_TO_WN_MAP * | st_to_intconst_map | |||
| ) | [static] |
Definition at line 79 of file ipo_const.cxx.
References HASH_TABLE< SIG_TYPE, DATA_TYPE >::Enter_If_Unique(), FALSE, Is_True, OPR_INTCONST, OPR_STID, TRUE, WN_kid0(), WN_offset(), WN_operator(), and WN_st().
Referenced by TY_AR_has_new_const().
| static WN* Summary_value_to_intconst | ( | const SUMMARY_VALUE & | value, | |
| TYPE_ID | mtype, | |||
| BOOL | is_ref_param | |||
| ) | [static] |
Definition at line 426 of file ipo_const.cxx.
References SUMMARY_VALUE::Get_int_const_value(), SUMMARY_VALUE::Get_tcon_idx(), INT64, SUMMARY_VALUE::Is_addr_of(), SUMMARY_VALUE::Is_const_st(), SUMMARY_VALUE::Is_int_const(), NULL, Targ_Is_Integral(), Tcon_Table, and WN_Intconst().
Referenced by IPA_constant_in_array_bounds().
| static BOOL TY_AR_has_new_const | ( | TY_IDX | ty_idx, | |
| const ST_TO_WN_MAP * | st_to_stid_map, | |||
| ST_TO_WN_MAP * | st_to_intconst_map | |||
| ) | [static] |
Definition at line 103 of file ipo_const.cxx.
References BOOL, FALSE, HASH_TABLE< SIG_TYPE, DATA_TYPE >::Find(), i, INT32, Is_True, KIND_ARRAY, ST_has_const_value(), ST_ptr(), TRUE, TY_AR_const_lbnd, TY_AR_const_stride, TY_AR_const_ubnd, TY_AR_lbnd_var(), TY_AR_ndims, TY_AR_stride_var(), TY_AR_ubnd_var(), and TY_kind.
Referenced by fix_array_bounds::operator()().
| static void TY_AR_propagate_constants | ( | TY_IDX | ty_idx, | |
| const ST_TO_WN_MAP * | st_to_intconst_map | |||
| ) | [static] |
Definition at line 184 of file ipo_const.cxx.
References HASH_TABLE< SIG_TYPE, DATA_TYPE >::Find(), i, INT32, Is_True, KIND_ARRAY, OPR_INTCONST, Set_TY_AR_const_lbnd(), Set_TY_AR_const_stride(), Set_TY_AR_const_ubnd(), Set_TY_AR_lbnd_val(), Set_TY_AR_stride_val(), Set_TY_AR_ubnd_val(), ST_ptr(), TY_AR_const_lbnd, TY_AR_const_stride, TY_AR_const_ubnd, TY_AR_lbnd_var(), TY_AR_ndims, TY_AR_stride_var(), TY_AR_ubnd_var(), TY_kind, WN_const_val(), and WN_operator().
Referenced by fix_array_bounds::operator()().
Definition at line 364 of file ipo_const.cxx.
References CURRENT_SYMTAB, HASH_TABLE< SIG_TYPE, DATA_TYPE >::Enter(), For_all(), Is_True, iter, Malloc_Mem_Pool, node, OPR_FUNC_ENTRY, OPR_INTCONST, OPR_LDID, OPR_PRAGMA, OPR_STID, WN_TREE_ITER_base< WHIRL >::Replace(), St_Table, Update_wn_types(), wn, WN_TREE_ITER_base< WHIRL >::Wn(), WN_COPY_Tree(), WN_entry_first, WN_kid0(), WN_next(), WN_offset(), WN_operator(), WN_pragma(), WN_PRAGMA_PREAMBLE_END, WN_Simplify_Tree(), and WN_st().
Referenced by IPO_propagate_globals(), and Propagate_Constants().
| static void Update_wn_types | ( | WN * | pu, | |
| const TY_TO_TY_MAP * | old_to_new_ty_map | |||
| ) | [static] |
Definition at line 306 of file ipo_const.cxx.
References HASH_TABLE< SIG_TYPE, DATA_TYPE >::Find(), Is_True, OPERATOR_has_1ty(), OPERATOR_has_2ty(), OPR_FUNC_ENTRY, wn, WN_ITER_wn, WN_load_addr_ty(), WN_operator(), WN_set_load_addr_ty(), WN_set_ty(), WN_ty(), WN_WALK_TreeIter(), and WN_WALK_TreeNext().
Referenced by Update_array_bounds().
Definition at line 669 of file ipo_const.cxx.
Referenced by CFG_NODE_INFO::Add_array_param(), Evaluate_actuals(), expand_inline_function(), ffedata_gather_(), ffedata_value_(), OPT_STAB::Generate_call_mu_chi_by_ref(), ALIAS_CLASSIFICATION::Handle_call(), OPT_STAB::Has_read_only_parm(), intrinsic_runtime(), IPA_Do_Linearization(), Is_callee_formal_mappable_to_caller(), lower_bit_field_id(), lower_nary_madd(), Map_term_to_caller(), SUMMARIZE< program >::Process_actual(), process_actual_array_node(), process_actual_node(), Propagate_Constants(), Set_addr_saved_stmt(), store_parm_decls(), store_parm_decls_oldstyle(), update_actual_indices(), and WN_NaryToExpr().
Definition at line 668 of file ipo_const.cxx.
Referenced by Add_Object_To_Frame_Segment(), Add_value_to_caller_linex(), DRA_Mangle_Entry(), DRA_Preprocess_Entry(), OPT_TAIL::Entry_is_well_behaved(), Evaluate_value(), OPT_TAIL::Exit_is_well_behaved(), expand_inline_function(), fei_object(), OPT_TAIL::Fixup_exit(), init_node_section_annot(), lower_bit_field_id(), IPA_ARRAY_DF_FLOW::PostProcessIO(), SUMMARIZE< program >::Process_formal(), SUMMARIZE< program >::Process_formal_alt(), SUMMARIZE< program >::Process_procedure(), types_are_compatible(), and update_linex_with_constant_mod().
Definition at line 687 of file ipo_const.cxx.
Referenced by CODEMAP::Add_bin_node_and_fold(), CODEMAP::Add_expr(), COPYPROP::Copy_propagate_cr(), find_reloads(), GTY(), linear_transform_loops(), and SPARSE_BV::Union_2_Diff_Core().
Definition at line 685 of file ipo_const.cxx.
Referenced by CODEMAP::Add_tcon(), Allocate_Result_TN(), Apply_Back_Sub_Invariant(), Apply_Back_Sub_Variant(), Apply_Interleave(), Array_Is_HFA(), Build_Io_Mask(), Cast_Float_Operands(), CGEMIT_Print_Variable_Info(), CGTARG_Load_From_Memory(), CGTARG_Store_To_Memory(), CGTARG_TN_For_Asm_Operand(), IVR::Choose_primary_IV(), Convert_Imm_Mul(), Create_DST_type_For_Tree(), Create_Global_ST(), Create_Io_Entry(), RVI_NODE::Create_load(), RVI_NODE::Create_store(), Create_Stride1_Condition_If_Required(), Create_TY_For_Tree(), cwh_io_split_io_items(), OPT_STAB::Enter_symbol(), Evaluate_chi(), Execution_Cost_Expr(), Execution_Cost_Value(), Exp_COPY(), Exp_Intrinsic_Call(), Exp_Landingpadentry_Intrinsic(), Exp_Select_And_Condition(), Exp_To_Linex_Array(), Expand_Load(), Expand_Madd(), Expand_Misaligned_Load(), Expand_Vote(), Gen_Assign_Of_Init_Val(), get_32bit_cilist_item(), get_FIT_type(), Get_Return_Info(), ALIAS_RULE::Get_stripped_mtype(), Handle_INTRINSIC_OP(), Handle_LDID(), Identity_assignment_type(), Initialize_Special_Global_Symbols(), INITV_Set_LABEL(), IPA_constant_in_array_bounds(), IPA_LNO_Read_Terms(), Irb_Init_Integer(), lower_bit_field_id(), lower_io_items(), lower_return_ldid(), Machine_Type(), move_ext_is_replaced(), RVI_NODE::Mtype(), RVI_ANN::New_ldid(), NORMALIZE_LOOP::Normalize_do_loop(), PREG_To_TN(), SUMMARIZE< program >::Process_constant_jump_function(), IPO_INLINE::Process_Copy_In(), IPO_INLINE::Process_Copy_In_Copy_Out(), IPO_INLINE::Process_Formal_ST(), Process_Preg_Temps(), Replace_Formal_By_Actual(), Replace_Wnexp_With_Exp_Copy(), Set_up_all_preg_symbols(), Split_Array(), ST_is_const_initialized_scalar(), Struct_Is_HFA(), Traverse_TYs(), TY_Of_Expr(), Union_Formal_Cprop_Annot(), Union_Formal_Cprop_Annot_With_Cloning(), Union_Quasi_Clone_Cprop_Annot(), update_linex_with_constant_mod(), Walk_Linex(), WFE_Add_Aggregate_Init_Double(), WFE_Add_Aggregate_Init_Integer(), WFE_Alloca_ST(), WFE_Save_Expr(), AGGINIT::WGEN_Add_Aggregate_Init_Integer(), WGEN_Save_Expr(), and WN_Single_Iteration_Cost().
Definition at line 686 of file ipo_const.cxx.
1.5.6