Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
ir_reader.cxx File Reference
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdarg.h>
#include <ctype.h>
#include <unistd.h>
#include <cmplrs/rcodes.h>
#include "wn_tree_util.h"
#include "defs.h"
#include "errors.h"
#include "srcpos.h"
#include "opcode.h"
#include "stab.h"
#include "const.h"
#include "targ_const.h"
#include "targ_sim.h"
#include "strtab.h"
#include "irbdata.h"
#include "wn.h"
#include "wn_simp.h"
#include "dwarf_DST.h"
#include "dwarf_DST_mem.h"
#include "ir_reader.h"
#include "tracing.h"
#include "opt_alias_mgr.h"
#include "wio.h"
#include "wintrinsic.h"
#include "wn_pragmas.h"
#include "wutil.h"
#include "region_util.h"
#include "dvector.h"
Include dependency graph for ir_reader.cxx:

Go to the source code of this file.

Classes

struct  IR_OPCODE_TABLE
struct  TOKEN
struct  DUMPDEP
struct  file_info

Defines

#define USE_STANDARD_TYPES
#define HASH_LEN   2413 /* prime number */
#define IR_MAX_ARGS   3 /* IR opcode has at most 3 arguments */
#define LINE_LEN   1024 /* maximum length of line */
#define OPCODE_has_alias_info(opc)
#define IR_dump_alias_info(opc)   (IR_alias_map != WN_MAP_UNDEFINED && OPCODE_has_alias_info(opc))
#define DUMPDEP_node(x)   (x)->node
#define DUMPDEP_id(x)   (x)->id
#define DUMPDEP_next(x)   ((x)->next)
#define ir_chk_kids(m, n)   {if (m != n) ir_error("wrong number of kids"); }

Typedefs

typedef struct DUMPDEP DUMPDEP
typedef struct DUMPDEPDUMPDEPp

Enumerations

enum  OPR_EXTENDED {
  OPR_END_BLOCK = OPERATOR_LAST+1, OPR_BODY = OPERATOR_LAST+2, OPR_NOOP = OPERATOR_LAST+3, OPR_THEN = OPERATOR_LAST+4,
  OPR_ELSE = OPERATOR_LAST+5, OPR_END_IF = OPERATOR_LAST+6, OPR_INIT = OPERATOR_LAST+7, OPR_COMP = OPERATOR_LAST+8,
  OPR_INCR = OPERATOR_LAST+9, OPR_END_COMPGOTO = OPERATOR_LAST+10, OPR_END_XGOTO = OPERATOR_LAST+11, OPR_LOC = OPERATOR_LAST+12,
  OPR_END_LINFO = OPERATOR_LAST+13, OPR_END_SWITCH = OPERATOR_LAST+14
}
enum  OPC_EXTENDED {
  OPC_END_BLOCK = OPCODE_LAST+1, OPC_BODY = OPCODE_LAST+2, OPC_NOOP = OPCODE_LAST+3, OPC_THEN = OPCODE_LAST+4,
  OPC_ELSE = OPCODE_LAST+5, OPC_END_IF = OPCODE_LAST+6, OPC_INIT = OPCODE_LAST+7, OPC_COMP = OPCODE_LAST+8,
  OPC_INCR = OPCODE_LAST+9, OPC_END_COMPGOTO = OPCODE_LAST+10, OPC_END_XGOTO = OPCODE_LAST+11, OPC_LOC = OPCODE_LAST+12,
  OPC_END_LINFO = OPCODE_LAST+13, OPC_END_SWITCH = OPCODE_LAST+14, MAX_OPCODE = OPCODE_LAST+15
}

Functions

char * Targ_Print (const char *fmt, TCON c)
static void ir_error (char *s)
static INT ir_get_expr_list (void)
static WNir_get_expr (void)
static WNir_get_stmt (void)
static void ir_skip_token (void)
static char * ir_read_line (char *buf, INT size, FILE *ir_file)
static void ir_match_token (OPERATOR opr)
static void ir_expect_token (OPERATOR opc)
static TOKENir_next_token (void)
static void ir_get_token (TOKEN *token)
static BOOL ir_insert_hash (char *s, IR_OPCODE_TABLE *irt)
static INT ir_lookup (char *s)
static void ir_build_hashtable (void)
static void ir_put_wn (WN *wn, INT indent)
static void ir_put_expr (WN *wn, INT indent)
static void ir_put_marker (char *str, INT indent)
static void ir_put_stmt (WN *wn, INT indent)
static void WN_TREE_put_stmt (WN *, INT)
static INT32 AddToDUMPDEP (WN *node)
void IR_reader_init (void)
BOOL IR_set_dump_order (BOOL prefix)
static void ir_print_filename (BOOL dump_filenames)
void IR_Dwarf_Gen_File_Table (BOOL dump_filenames)
void IR_Srcpos_Filename (SRCPOS srcpos, const char **fname, const char **dirname)
static void print_source (SRCPOS srcpos)
static void ir_put_st (ST_IDX st_idx)
static void ir_put_ty (TY_IDX ty)
static void ir_put_parm_keyword (ST *st)
void IR_put_func (WN *wn, FILE *f)
void dump_wn (WN *wn)
void fdump_wn (FILE *fp, WN *wn)
void dump_tree (WN *wn)
void dump_region_tree (WN *wn)
void dump_wn_no_st (WN *wn)
void fdump_wn_no_st (FILE *fp, WN *wn)
void dump_tree_no_st (WN *wn)
void fdump_tree (FILE *f, WN *wn)
void fdump_tree_no_st (FILE *f, WN *wn)
void fdump_tree_with_alias (FILE *f, const WN *wn, WN_MAP map, const struct ALIAS_MANAGER *am)
void enable_tree_freq_display (void)
void disable_tree_freq_display (void)
void fdump_tree_with_freq (FILE *f, const WN *wn, WN_MAP map)
void fdump_region_tree (FILE *f, WN *wn)
static void WN_TREE_put_expr (WN *wn, INT indent)
void WN_TREE_put_func (WN *wn, FILE *f)
void WN_TREE_fdump_tree (FILE *f, WN *wn)
void WN_TREE_dump_tree (WN *wn)
void Check_for_IR_Dump (INT phase, WN *pu, const char *phase_name)

Variables

IR_OPCODE_TABLE ir_opcode_table [1]
IR_OPCODE_TABLEopcode_hash [HASH_LEN]
static BOOL dump_parent_before_children = FALSE
BOOL IR_dump_map_info = FALSE
BOOL IR_dump_region = FALSE
BOOL IR_DUMPDEP_info = FALSE
BOOL IR_dump_line_numbers = FALSE
BOOL IR_dump_wn_addr = FALSE
WN_MAP IR_alias_map = WN_MAP_UNDEFINED
struct ALIAS_MANAGER * IR_alias_mgr = NULL
WN_MAP IR_freq_map = WN_MAP_UNDEFINED
DUMPDEPp IR_DUMPDEP_head = NULL
static FILE * ir_ofile
static INT ir_line
static BOOL follow_st
static USRCPOS last_srcpos
static BOOL is_initialized = FALSE
static WN_MAP ir_put_map = WN_MAP_UNDEFINED
static file_infofile_table = NULL
static char ** incl_table
static INT cur_file_index = 0
static BOOL file_table_generated = FALSE

Define Documentation

#define DUMPDEP_id (   x)    (x)->id

Definition at line 242 of file ir_reader.cxx.

Referenced by AddToDUMPDEP().

#define DUMPDEP_next (   x)    ((x)->next)

Definition at line 243 of file ir_reader.cxx.

Referenced by AddToDUMPDEP().

#define DUMPDEP_node (   x)    (x)->node

Definition at line 241 of file ir_reader.cxx.

Referenced by AddToDUMPDEP().

#define HASH_LEN   2413 /* prime number */

Definition at line 161 of file ir_reader.cxx.

#define ir_chk_kids (   m,
 
)    {if (m != n) ir_error("wrong number of kids"); }

Definition at line 397 of file ir_reader.cxx.

Definition at line 232 of file ir_reader.cxx.

#define IR_MAX_ARGS   3 /* IR opcode has at most 3 arguments */

Definition at line 162 of file ir_reader.cxx.

#define LINE_LEN   1024 /* maximum length of line */

Definition at line 166 of file ir_reader.cxx.

Referenced by IR_reader_init().

#define OPCODE_has_alias_info (   opc)
Value:
(OPCODE_is_load(opc) ||\
                                         OPCODE_is_store(opc) ||\
                                         OPCODE_operator(opc) == OPR_PARM)

Definition at line 228 of file ir_reader.cxx.

Referenced by ir_put_wn().

Definition at line 79 of file ir_reader.cxx.


Typedef Documentation

typedef struct DUMPDEP DUMPDEP
typedef struct DUMPDEP * DUMPDEPp

Enumeration Type Documentation

Enumerator:
OPC_END_BLOCK 
OPC_BODY 
OPC_NOOP 
OPC_THEN 
OPC_ELSE 
OPC_END_IF 
OPC_INIT 
OPC_COMP 
OPC_INCR 
OPC_END_COMPGOTO 
OPC_END_XGOTO 
OPC_LOC 
OPC_END_LINFO 
OPC_END_SWITCH 
MAX_OPCODE 

Definition at line 133 of file ir_reader.cxx.

Enumerator:
OPR_END_BLOCK 
OPR_BODY 
OPR_NOOP 
OPR_THEN 
OPR_ELSE 
OPR_END_IF 
OPR_INIT 
OPR_COMP 
OPR_INCR 
OPR_END_COMPGOTO 
OPR_END_XGOTO 
OPR_LOC 
OPR_END_LINFO 
OPR_END_SWITCH 

Definition at line 116 of file ir_reader.cxx.


Function Documentation

static INT32 AddToDUMPDEP ( WN node) [static]

Definition at line 255 of file ir_reader.cxx.

References DUMPDEP_id, DUMPDEP_next, DUMPDEP_node, DUMPDEP::node, NULL, and TYPE_L_ALLOC.

Referenced by ir_put_wn().

void Check_for_IR_Dump ( INT  phase,
WN pu,
const char *  phase_name 
)

Definition at line 1898 of file ir_reader.cxx.

References CURRENT_SYMTAB, fdump_tree(), fprintf(), Get_Trace(), GLOBAL_SYMTAB, Print_symtab(), TFile, TKIND_IR, and TKIND_SYMTAB.

Referenced by LNO_Processing(), Preprocess_PU(), and WOPT_Processing().

Here is the call graph for this function:

void disable_tree_freq_display ( void  )

Definition at line 1582 of file ir_reader.cxx.

References IR_freq_map, and WN_MAP_UNDEFINED.

void dump_region_tree ( WN wn)

Definition at line 1491 of file ir_reader.cxx.

References fdump_tree(), IR_dump_region, and TRUE.

Here is the call graph for this function:

void dump_tree ( WN wn)

Definition at line 1485 of file ir_reader.cxx.

References fdump_tree().

Referenced by dump_tree_no_st().

Here is the call graph for this function:

void dump_tree_no_st ( WN wn)

Definition at line 1523 of file ir_reader.cxx.

References dump_tree(), FALSE, follow_st, IR_reader_init(), and is_initialized.

Here is the call graph for this function:

void dump_wn ( WN wn)

Definition at line 1461 of file ir_reader.cxx.

References IR_Dwarf_Gen_File_Table(), ir_ofile, ir_put_wn(), IR_reader_init(), is_initialized, and TRUE.

Referenced by cwh_block_dump(), and dump_wn_no_st().

Here is the call graph for this function:

void dump_wn_no_st ( WN wn)

Definition at line 1499 of file ir_reader.cxx.

References dump_wn(), FALSE, follow_st, IR_reader_init(), and is_initialized.

Here is the call graph for this function:

void enable_tree_freq_display ( void  )

Definition at line 1577 of file ir_reader.cxx.

References IR_freq_map, and WN_MAP_FEEDBACK.

void fdump_region_tree ( FILE *  f,
WN wn 
)

Definition at line 1595 of file ir_reader.cxx.

References fdump_tree(), IR_dump_region, and TRUE.

Referenced by Do_WOPT_and_CG_with_Regions(), LNO_Processing(), Post_Process_Backend(), and WOPT_Processing().

Here is the call graph for this function:

void fdump_tree_no_st ( FILE *  f,
WN wn 
)

Definition at line 1556 of file ir_reader.cxx.

References FALSE, fdump_tree(), follow_st, IR_reader_init(), and is_initialized.

Here is the call graph for this function:

void fdump_tree_with_alias ( FILE *  f,
const WN wn,
WN_MAP  map,
const struct ALIAS_MANAGER *  am 
)

Definition at line 1566 of file ir_reader.cxx.

References fdump_tree(), IR_alias_map, and IR_alias_mgr.

Here is the call graph for this function:

void fdump_tree_with_freq ( FILE *  f,
const WN wn,
WN_MAP  map 
)

Definition at line 1587 of file ir_reader.cxx.

References fdump_tree(), and IR_freq_map.

Here is the call graph for this function:

void fdump_wn ( FILE *  fp,
WN wn 
)

Definition at line 1473 of file ir_reader.cxx.

References fp, IR_Dwarf_Gen_File_Table(), ir_ofile, ir_put_wn(), IR_reader_init(), is_initialized, and TRUE.

Here is the call graph for this function:

void fdump_wn_no_st ( FILE *  fp,
WN wn 
)

Definition at line 1509 of file ir_reader.cxx.

References FALSE, follow_st, fp, IR_Dwarf_Gen_File_Table(), ir_ofile, ir_put_wn(), IR_reader_init(), is_initialized, and TRUE.

Here is the call graph for this function:

static void ir_build_hashtable ( void  ) [static]
static void ir_error ( char *  s) [static]

Definition at line 399 of file ir_reader.cxx.

References exit(), fprintf(), ir_line, and RC_INTERNAL_ERROR.

Here is the call graph for this function:

static void ir_expect_token ( OPERATOR  opc) [static]
static WN* ir_get_expr ( void  ) [static]
static INT ir_get_expr_list ( void  ) [static]
static WN* ir_get_stmt ( void  ) [static]
static void ir_get_token ( TOKEN token) [static]
static BOOL ir_insert_hash ( char *  s,
IR_OPCODE_TABLE irt 
) [static]
static INT ir_lookup ( char *  s) [static]
static void ir_match_token ( OPERATOR  opr) [static]
static TOKEN* ir_next_token ( void  ) [static]
void IR_put_func ( WN wn,
FILE *  f 
)

Definition at line 1438 of file ir_reader.cxx.

References ir_ofile, and ir_put_stmt().

Referenced by fdump_tree(), and ir_b2a_process_PUs().

Here is the call graph for this function:

static void ir_put_marker ( char *  str,
INT  indent 
) [static]

Definition at line 1240 of file ir_reader.cxx.

References fprintf(), and ir_ofile.

Referenced by ir_put_stmt(), and WN_TREE_put_stmt().

Here is the call graph for this function:

static void ir_put_parm_keyword ( ST st) [static]

Definition at line 850 of file ir_reader.cxx.

References FmtAssert, fprintf(), free(), ir_ofile, STC_val(), Targ_String_Address(), and Targ_String_Length().

Referenced by ir_put_wn().

Here is the call graph for this function:

static void ir_put_st ( ST_IDX  st_idx) [static]

Definition at line 792 of file ir_reader.cxx.

References CLASS_CONST, follow_st, fprintf(), ir_ofile, name, NULL, ST_class(), ST_index(), ST_level(), ST_name(), St_Table, STC_val(), and Targ_Print().

Referenced by ir_put_wn().

Here is the call graph for this function:

static void ir_put_ty ( TY_IDX  ty) [static]

Definition at line 831 of file ir_reader.cxx.

References fprintf(), ir_ofile, TY_align(), TY_id(), TY_is_const(), TY_is_restrict(), TY_is_volatile(), and TY_name().

Referenced by ir_put_wn().

Here is the call graph for this function:

static void ir_put_wn ( WN wn,
INT  indent 
) [static]

Definition at line 874 of file ir_reader.cxx.

References AddToDUMPDEP(), CLASS_PREG, Current_Map_Tab, CURRENT_SYMTAB, DISTRIBUTE_BLOCK, DISTRIBUTE_CYCLIC_CONST, DISTRIBUTE_CYCLIC_EXPR, DISTRIBUTE_STAR, Float_Preg_Min_Offset, follow_st, fprintf(), get_iolibrary_name(), handle, Index_To_Str(), INITO_IDX_index(), INITO_st_idx(), Inito_Table, INTRINSIC_name, IOITEM_name, IOSTATEMENT_name, IR_dump_line_numbers, IR_dump_map_info, IR_dump_wn_addr, IR_DUMPDEP_info, IR_freq_map, ir_ofile, ir_put_map, ir_put_parm_keyword(), ir_put_st(), ir_put_ty(), Is_True, Last_Dedicated_Preg_Offset, NULL, OPC_COMMENT, OPC_IO, OPC_IO_ITEM, OPC_LABEL, OPC_PRAGMA, OPC_XPRAGMA, OPCODE_has_1ty(), OPCODE_has_2offsets(), OPCODE_has_2ty(), OPCODE_has_alias_info, OPCODE_has_bits(), OPCODE_has_ereg_supp(), OPCODE_has_esize(), OPCODE_has_field_id(), OPCODE_has_flags(), OPCODE_has_inumber(), OPCODE_has_label(), OPCODE_has_last_label(), OPCODE_has_ndim(), OPCODE_has_num_entries(), OPCODE_has_offset(), OPCODE_has_sym(), OPCODE_has_value(), OPCODE_is_call(), OPCODE_is_scf(), OPCODE_is_stmt(), OPCODE_mapcat(), OPCODE_name(), OPCODE_operator(), OPR_ARRAYEXP, OPR_ASM_INPUT, OPR_ASM_STMT, OPR_COMPOSE_BITS, OPR_EXTRACT_BITS, OPR_ILDBITS, OPR_INTCONST, OPR_INTRINSIC_CALL, OPR_INTRINSIC_OP, OPR_ISTBITS, OPR_LDBITS, OPR_PARM, OPR_PRAGMA, OPR_REGION, OPR_STBITS, OPR_XPRAGMA, Preg_Is_Dedicated, Preg_Name(), Preg_Offset_Is_Float, Preg_Offset_Is_Int, PREG_Table_Size(), ST_class(), ST_name(), St_Table, WN::ty_fields, WN::u3, USRCPOS_column, USRCPOS_linenum, USRCPOS_srcpos, WN_Asm_Clobbers_Cc, WN_Asm_Clobbers_Mem, WN_asm_input_constraint(), WN_asm_opnd_num(), WN_asm_string(), WN_Asm_Volatile, WN_bit_offset(), WN_bit_size(), WN_call_flag(), WN_const_val(), WN_cvtl_bits(), WN_element_size(), WN_ereg_supp(), WN_field_id(), WN_flag(), WN_Get_Linenum(), WN_intrinsic(), WN_IO_Library, WN_kid_count(), WN_label_number(), WN_last_label(), WN_load_addr_ty(), WN_loop_depth(), WN_loop_trip_est(), WN_MAP32_Get, WN_MAP64_Get, WN_MAP_ALIAS_CLASS, WN_MAP_Get, WN_MAP_Get_Kind, WN_map_id(), WN_MAP_KIND_INT32, WN_MAP_KIND_INT64, WN_MAP_KIND_VOIDP, WN_MAP_UNDEFINED, WN_num_dim, WN_num_entries(), WN_offset(), WN_opcode(), WN_PARM_BY_REFERENCE, WN_PARM_BY_VALUE, WN_PARM_CHECK_CONTIG_FLAG, WN_PARM_COPY_IN, WN_PARM_COPY_IN_COPY_OUT, WN_PARM_COPY_IN_MAKE_DV, WN_PARM_DUMMY, WN_PARM_IS_KILLED, WN_PARM_MAKE_DV, WN_PARM_MAKE_NEW_DV, WN_PARM_NOT_EXPOSED_USE, WN_PARM_OUT, WN_PARM_PASS_ADDRESS, WN_PARM_PASS_ADDRESS_FROM_DV, WN_PARM_PASS_DV, WN_PARM_PASS_DV_COPY, WN_PARM_PASS_SECTION_ADDRESS, WN_PARM_PASSED_NOT_SAVED, WN_PARM_READ_ONLY, WN_pragma(), WN_pragma_arg1(), WN_pragma_arg2(), WN_PRAGMA_ASM_CONSTRAINT, WN_pragma_asm_constraint(), WN_pragma_asm_copyout_preg(), WN_pragma_asm_opnd_num(), WN_pragma_distr_type(), WN_PRAGMA_DISTRIBUTE, WN_PRAGMA_DISTRIBUTE_RESHAPE, WN_pragma_flags(), WN_pragma_index(), WN_pragma_preg(), WN_PRAGMA_REDISTRIBUTE, WN_pragmas, WN_region_id(), WN_region_kind(), WN_st(), WN_st_idx(), and WN_ty().

Referenced by dump_wn(), fdump_wn(), fdump_wn_no_st(), ir_put_expr(), ir_put_stmt(), WN_TREE_put_expr(), and WN_TREE_put_stmt().

static char* ir_read_line ( char *  buf,
INT  size,
FILE *  ir_file 
) [static]

Definition at line 327 of file ir_reader.cxx.

References dump_parent_before_children.

Referenced by Configure(), and main().

static void ir_skip_token ( void  ) [static]
void IR_Srcpos_Filename ( SRCPOS  srcpos,
const char **  fname,
const char **  dirname 
)
static void print_source ( SRCPOS  srcpos) [static]
char* Targ_Print ( const char *  fmt,
TCON  c 
)

Definition at line 2934 of file targ_const.cxx.

void WN_TREE_dump_tree ( WN wn)

Definition at line 1889 of file ir_reader.cxx.

References WN_TREE_fdump_tree().

Here is the call graph for this function:

static void WN_TREE_put_expr ( WN wn,
INT  indent 
) [static]
void WN_TREE_put_func ( WN wn,
FILE *  f 
)

Definition at line 1853 of file ir_reader.cxx.

References ir_ofile, and WN_TREE_put_stmt().

Referenced by WN_TREE_fdump_tree().

Here is the call graph for this function:


Variable Documentation

INT cur_file_index = 0 [static]

Definition at line 421 of file ir_reader.cxx.

Referenced by print_source().

file_info* file_table = NULL [static]

Definition at line 419 of file ir_reader.cxx.

Definition at line 422 of file ir_reader.cxx.

char** incl_table [static]

Definition at line 420 of file ir_reader.cxx.

Definition at line 224 of file ir_reader.cxx.

Referenced by fdump_tree_with_alias().

struct ALIAS_MANAGER* IR_alias_mgr = NULL

Definition at line 225 of file ir_reader.cxx.

Referenced by fdump_tree_with_alias().

Definition at line 221 of file ir_reader.cxx.

Referenced by ir_put_wn(), and main().

Definition at line 218 of file ir_reader.cxx.

Referenced by ir_put_wn(), and main().

Definition at line 219 of file ir_reader.cxx.

Referenced by dump_region_tree(), and fdump_region_tree().

Definition at line 222 of file ir_reader.cxx.

Referenced by ir_put_wn().

Definition at line 246 of file ir_reader.cxx.

Definition at line 220 of file ir_reader.cxx.

Referenced by ir_put_wn().

INT ir_line [static]

Definition at line 300 of file ir_reader.cxx.

Referenced by ir_error().

Definition at line 158 of file ir_reader.cxx.

Definition at line 308 of file ir_reader.cxx.

Referenced by ir_put_wn().

USRCPOS last_srcpos [static]

Definition at line 306 of file ir_reader.cxx.

Definition at line 164 of file ir_reader.cxx.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines