#include <unistd.h>#include <fcntl.h>#include <sys/mman.h>#include <alloca.h>#include <signal.h>#include <errno.h>#include "elf_stuff.h"#include <sys/elf_whirl.h>#include <cmplrs/rcodes.h>#include "defs.h"#include "erglob.h"#include "errors.h"#include "opcode.h"#include "mempool.h"#include "strtab.h"#include "symtab.h"#include "const.h"#include "targ_const.h"#include "irbdata.h"#include "config_targ.h"#include "config_elf_targ.h"#include "wn_core.h"#include "wn.h"#include "wn_map.h"#include "dwarf_DST_mem.h"#include "pu_info.h"#include "ir_elf.h"#include "ir_bwrite.h"#include "ir_bcom.h"#include "ir_bread.h"#include "tracing.h"

Go to the source code of this file.
| #define DEFAULT_NUM_OF_SECTIONS 8 |
| #define DEFAULT_TEMPLATE "/elf_wnXXXXXX" |
Definition at line 383 of file ir_bwrite.cxx.
| #define DEFAULT_TMPDIR "/usr/tmp" |
Definition at line 382 of file ir_bwrite.cxx.
Definition at line 138 of file ir_bwrite.cxx.
Referenced by cleanup(), extract_archive_member(), WN_close_file(), and WN_close_output().
Definition at line 145 of file ir_bwrite.cxx.
Referenced by check_for_whirl(), extract_archive_member(), f_open_com(), and WN_open_output().
| #define USE_STANDARD_TYPES |
Definition at line 66 of file ir_bwrite.cxx.
| static void cleanup | ( | Output_File * | fl | ) | [static] |
Definition at line 159 of file ir_bwrite.cxx.
References output_file::file_size, free(), output_file::map_addr, output_file::mapped_size, MUNMAP, NULL, output_file::num_of_section, output_file::output_fd, and output_file::section_list.
Referenced by build_new_1(), build_throw(), cp_finish_decl(), Do_Cleanups_For_EH(), do_end_catch(), Do_Temp_Cleanups(), elfmap(), eliminate_partially_redundant_load(), expand_expr(), finish_decl(), for(), gen_eh_region_cleanup(), genericize_try_block(), genrtl_case_label(), getEhdr(), GTY(), handler(), if(), initialize_inlined_parameters(), initialize_local_var(), MDclose(), my_execv(), Pop_Scope_And_Do_Cleanups(), read_count_file(), Read_Pragma_Data_Affinity(), register_dtor_fn(), resolve_fixup_regions(), run_phase(), run_simple_program(), WN_close_file(), WN_close_output(), and wrap_cleanups_r().
Definition at line 1513 of file ir_bwrite.cxx.
References WN_close_output(), and WN_write_revision().
Referenced by ir_all(), ir_sel(), main(), PDGCS_terminate(), Perform_Alias_Class_Annotation(), WFE_File_Finish(), and WGEN_File_Finish().
| static int create_temp_file | ( | Output_File * | fl | ) | [static] |
Definition at line 386 of file ir_bwrite.cxx.
References DEFAULT_TEMPLATE, DEFAULT_TMPDIR, fd, output_file::file_name, getenv(), malloc, mkstemp(), mktemp, mode, O_CREAT, O_EXCL, O_RDWR, open, path, strcat(), strcpy, strlen(), tmpdir, and unlink.
Referenced by do_spec_1(), and WN_open_output().
| static Section* get_section | ( | Elf64_Word | sh_info, | |
| const char * | name, | |||
| Output_File * | fl | |||
| ) | [static] |
Definition at line 228 of file ir_bwrite.cxx.
References output_file::cur_section, DEFAULT_NUM_OF_SECTIONS, FmtAssert, i, INT, malloc, output_file::max_num_of_section, memset, section::name, output_file::num_of_section, realloc, output_file::section_list, section::shdr, SHT_MIPS_WHIRL, and strcmp().
| static void ir_bwrite_signal_handler | ( | int | sig, | |
| int | err_num | |||
| ) | [static] |
Definition at line 184 of file ir_bwrite.cxx.
References Doing_mmapped_io, err_str, errno, Fatal_Error(), output_file::file_name, getpid, int, kill, old_sigbus, old_sigsegv, SIGBUS, strerror(), and void.
Referenced by WN_open_output().
| static UINT64 layout_sections | ( | Shdr & | strtab_sec, | |
| Output_File * | fl | |||
| ) | [inline, static] |
Definition at line 267 of file ir_bwrite.cxx.
References __alignof__, output_file::file_size, i, INT, ir_b_align(), ir_b_grow_map(), output_file::mapped_size, memset, section::name, output_file::num_of_section, sec, output_file::section_list, section::shdr, SHT_STRTAB, strlen(), and UINT64.
Referenced by WN_close_output().
| Output_File* Open_Output_Info | ( | char * | output_file | ) |
Definition at line 1478 of file ir_bwrite.cxx.
References EC_IR_Create, ErrMsg(), errno, Set_Error_Phase(), and WN_open_output().
Referenced by Inliner(), ir_all(), ir_sel(), main(), PDGCS_initialize(), Perform_Alias_Class_Annotation(), Phase_Init(), WFE_File_Init(), and WGEN_File_Init().
Definition at line 1400 of file ir_bwrite.cxx.
References cleanup(), close, EC_IR_Close, ErrMsg(), errno, output_file::file_name, output_file::file_size, ftruncate(), output_file::map_addr, output_file::mapped_size, MUNMAP, and output_file::output_fd.
| void WN_close_output | ( | Output_File * | fl | ) |
Definition at line 1364 of file ir_bwrite.cxx.
References cleanup(), close, EC_IR_Close, ErrMsg(), errno, output_file::file_name, output_file::file_size, ftruncate(), layout_sections(), output_file::map_addr, output_file::mapped_size, MUNMAP, output_file::output_fd, UINT64, Use_32_Bit_Pointers, and write_output().
Referenced by output_queue::close_output_file(), Close_Output_Info(), and IP_write_global_symtab().
| Output_File* WN_open_output | ( | char * | file_name | ) |
Definition at line 429 of file ir_bwrite.cxx.
References create_temp_file(), cur_section, output_file::cur_section, output_file::file_name, output_file::file_size, ftruncate(), get_section(), ir_b_align(), ir_b_create_map(), ir_bwrite_signal_handler(), malloc, MAPPED_SIZE, MIPS_WHIRL_PU_SECTION, mUINT64, NULL, output_file::num_of_section, O_CREAT, O_RDWR, O_TRUNC, old_sigbus, old_sigsegv, OPEN, output_file::output_fd, output_file::section_list, section::shdr, SIGBUS, signal(), Use_32_Bit_Pointers, and WT_PU_SECTION.
Referenced by IP_write_global_symtab(), output_queue::open_output_file(), and Open_Output_Info().
| void WN_write_dst | ( | DST_TYPE | dst, | |
| Output_File * | fl | |||
| ) |
Definition at line 772 of file ir_bwrite.cxx.
References cur_section, output_file::file_size, get_section(), ir_b_align(), ir_b_write_dst(), mINT32, MIPS_WHIRL_DST, section::shdr, void, and WT_DST.
Referenced by output_queue::flush(), IP_write_global_symtab(), Perform_Alias_Class_Annotation(), and Write_Global_Info().
| void WN_write_elf_symtab | ( | const void * | symtab, | |
| UINT64 | size, | |||
| UINT64 | entsize, | |||
| UINT | align, | |||
| Output_File * | fl | |||
| ) |
Definition at line 1522 of file ir_bwrite.cxx.
References output_file::file_size, get_section(), ir_b_align(), ir_b_save_buf(), MIPS_WHIRL_STRTAB, output_file::section_list, section::shdr, SHT_STRTAB, SHT_SYMTAB, UINT, void, and WT_STRTAB.
Referenced by Write_Elf_Symtab().
| void WN_write_flags | ( | INT | argc, | |
| char ** | argv, | |||
| Output_File * | fl | |||
| ) |
Definition at line 653 of file ir_bwrite.cxx.
References cur_section, output_file::file_size, FmtAssert, get_section(), i, INT, ir_b_align(), ir_b_grow_map(), ir_b_save_buf(), len, output_file::map_addr, output_file::mapped_size, MIPS_WHIRL_COMP_FLAGS, offset, section::shdr, strlen(), and WT_COMP_FLAGS.
Referenced by Ipl_Extra_Output().
| void WN_write_globals | ( | Output_File * | fl | ) |
Definition at line 710 of file ir_bwrite.cxx.
References cur_section, output_file::file_size, get_section(), ir_b_align(), ir_b_write_global_symtab(), mINT64, MIPS_WHIRL_GLOBALS, section::shdr, void, and WT_GLOBALS.
Referenced by IP_write_global_symtab(), and Write_Global_Info().
| void WN_write_PU_Infos | ( | PU_Info * | pu_list, | |
| Output_File * | fl | |||
| ) |
Definition at line 502 of file ir_bwrite.cxx.
References cur_section, output_file::cur_section, EC_IR_Scn_Write, ErrMsg(), output_file::file_name, output_file::file_size, INT32, ir_b_align(), ir_b_grow_map(), output_file::map_addr, output_file::mapped_size, mINT32, mINT64, MIPS_WHIRL_PU_SECTION, section::name, section::shdr, Sizeof_PU_Infos(), strcmp(), and Write_PU_Infos().
Referenced by output_queue::flush(), IP_write_global_symtab(), Perform_Alias_Class_Annotation(), and Write_Global_Info().
| void WN_write_revision | ( | Output_File * | fl | ) |
Definition at line 1344 of file ir_bwrite.cxx.
References ELF_COMMENT, output_file::file_size, get_section(), ir_b_save_buf(), length, section::shdr, SHT_PROGBITS, strlen(), and Whirl_Revision.
Referenced by Close_Output_Info(), output_queue::flush(), and IP_write_global_symtab().
| void WN_write_strtab | ( | const void * | strtab, | |
| UINT64 | size, | |||
| Output_File * | fl | |||
| ) |
Definition at line 751 of file ir_bwrite.cxx.
References char, cur_section, output_file::file_size, get_section(), ir_b_align(), ir_b_save_buf(), MIPS_WHIRL_STRTAB, section::shdr, void, and WT_STRTAB.
Referenced by IP_write_global_symtab(), and Write_Global_Info().
| void WN_write_symtab | ( | PU_Info * | pu, | |
| Output_File * | fl | |||
| ) |
Definition at line 726 of file ir_bwrite.cxx.
References cur_section, output_file::cur_section, EC_IR_Scn_Write, ErrMsg(), output_file::file_name, output_file::file_size, ir_b_align(), ir_b_write_local_symtab(), mINT64, MIPS_WHIRL_PU_SECTION, section::name, PU_Info_proc_sym, PU_Info_state, PU_Info_subsect_offset, PU_Info_subsect_size, PU_lexical_level, Scope_tab, Set_PU_Info_state, section::shdr, St_Table, strcmp(), Subsect_InMem, Subsect_Written, void, and WT_SYMTAB.
Referenced by IP_WRITE_pu_internal(), output_queue::push(), and Write_PU_Info().
| void WN_write_tree | ( | PU_Info * | pu, | |
| WN_MAP | off_map, | |||
| Output_File * | fl | |||
| ) |
Definition at line 546 of file ir_bwrite.cxx.
References __alignof__, cur_section, output_file::cur_section, EC_IR_Scn_Write, ErrMsg(), output_file::file_name, output_file::file_size, ir_b_align(), ir_b_write_tree(), output_file::map_addr, MIPS_WHIRL_PU_SECTION, section::name, NULL, PU_Info_state, PU_Info_subsect_offset, PU_Info_subsect_ptr, PU_Info_subsect_size, PU_Info_tree_ptr, Set_Max_Region_Id(), Set_PU_Info_ac_internal_ptr, Set_PU_Info_alias_class_ptr, Set_PU_Info_state, section::shdr, strcmp(), Subsect_InMem, Subsect_Written, UINT, WN_StartAddress(), WT_AC_INTERNAL, WT_ALIAS_CLASS, WT_PREFETCH, and WT_TREE.
Referenced by IP_WRITE_pu_internal(), output_queue::push(), and Write_PU_Info().
Definition at line 1493 of file ir_bwrite.cxx.
References Current_DST, Index_To_Str(), IPA_irb_write_mod_ref_info(), IPA_write_summary(), Mod_Ref_Info_Table_Size(), Set_Error_Phase(), STR_Table_Size(), WN_write_dst(), WN_write_globals(), WN_write_PU_Infos(), and WN_write_strtab().
Referenced by Inliner(), ir_all(), ir_sel(), main(), PDGCS_terminate(), WFE_File_Finish(), and WGEN_File_Finish().
| static void write_output | ( | UINT64 | e_shoff, | |
| const typename ELF::Elf_Shdr & | strtab_sec, | |||
| Output_File * | fl, | |||
| const ELF & | tag | |||
| ) | [inline, static] |
Definition at line 310 of file ir_bwrite.cxx.
References Config_ELF_From_Target(), EC_IR_Scn_Write, EI_CLASS, EI_DATA, EI_VERSION, ELFCLASS64, ELFDATA2LSB, ELFDATA2MSB, ELFMAG, ErrMsg(), EV_CURRENT, FALSE, output_file::file_name, Get_Elf_Target_Machine(), Host_Byte_Sex, i, INT, output_file::map_addr, memcpy, memset, section::name, output_file::num_of_section, output_file::section_list, section::shdr, str, strcpy, strlen(), Target_ISA, and Use_32_Bit_Pointers.
Referenced by WN_close_output().
Definition at line 1433 of file ir_bwrite.cxx.
References Current_Map_Tab, MEM_local_nz_pool_ptr, MEM_POOL_Pop, MEM_POOL_Push, PU_Info_maptab, PU_Info_state, Subsect_InMem, WN_MAP32_Create, WN_MAP_ALIAS_CLASS, WN_MAP_Delete, WN_MAP_UNDEFINED, WN_write_depgraph(), WN_write_feedback(), WN_write_INT32_map(), WN_write_prefetch(), WN_write_symtab(), WN_write_tree(), WT_ALIAS_CLASS, and WT_FEEDBACK.
Referenced by Do_WOPT_and_CG_with_Regions(), Ipl_Processing(), ir_all(), ir_sel(), PDGCS_do_proc(), Post_LNO_Processing(), Preorder_annotate_PU_and_kids(), process_pu(), WFE_Assemble_Asm(), WFE_Finish_Function(), WGEN_Assemble_Asm(), WGEN_Finish_Function(), write_pu(), and write_pu_info().
Definition at line 152 of file ir_bwrite.cxx.
Referenced by ir_b_copy_file(), ir_b_save_buf(), and Ir_Lno_Signal_Handler().
Output_File* ir_output [static] |
Definition at line 1430 of file ir_bwrite.cxx.
void(* old_sigbus)(int) [static] |
void(* old_sigsegv)(int) [static] |
1.5.6