Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
w2f_driver.cxx File Reference
#include <iostream>
#include <sys/elf_whirl.h>
#include <time.h>
#include <errno.h>
#include "whirl2f_common.h"
#include "config_opt.h"
#include "config_flist.h"
#include "config_list.h"
#include "w2cf_parentize.h"
#include "file_util.h"
#include "flags.h"
#include "timing.h"
#include "wn_lower.h"
#include "wn_tree_util.h"
#include "const.h"
#include "PUinfo.h"
#include "st2f.h"
#include "wn2f.h"
#include "wn2f_stmt.h"
#include "wn2f_pragma.h"
#include "unparse_target_ftn.h"
Include dependency graph for w2f_driver.cxx:

Go to the source code of this file.

Classes

struct  enter_fld
struct  enter_st
struct  build_type_mod_map

Defines

#define DEB_Whirl2f_IR_TY_W2F_Outfile_Translate_Pu   0
#define W2F_Extension(i)
#define W2F_MAX_SKIP_ITEMS   128
#define MAX_FNAME_LENGTH   256-7 /* allow for suffix ".w2f.f\0" */
#define MAX_ANL_FNAME_LENGTH   256-5 /* allow for suffix ".anl\0" */

Functions

static void Process_Command_Line (INT argc, char **argv)
static void Process_Filename_Options (const char *src_filename, const char *irb_filename)
static FILE * Open_Read_File (const char *filename)
static FILE * Open_Append_File (const char *filename)
static FILE * Open_Create_File (const char *filename)
static void Close_File (const char *filename, FILE *afile)
static void Open_W2f_Output_File (W2F_FILE_KIND kind)
static void Close_W2f_Output_File (W2F_FILE_KIND kind)
static void Begin_New_Locations_File (void)
static void End_Locations_File (void)
static void Continue_Locations_File (void)
static void Move_Locations_To_Anl_File (const char *loc_fname)
static void W2F_Undo_Whirl_Side_Effects (void)
static void W2F_Enter_Global_Symbols (void)
static BOOL Check_Outfile_Initialized (const char *caller_name)
static BOOL Check_Initialized (const char *caller_name)
static BOOL Check_PU_Pushed (const char *caller_name)
BOOL W2F_Should_Emit_Nested_PUs (void)
void W2F_Process_Command_Line (INT phase_argc, char *phase_argv[], INT argc, char *argv[])
void W2F_Init (void)
void W2F_Push_PU (WN *pu, WN *body_part_of_interest)
void W2F_Pop_PU (void)
void W2F_Mark_Loads (void)
void W2F_Nomark_Loads (void)
void W2F_Set_Prompf_Emission (WN_MAP *construct_map)
void W2F_Set_Frequency_Map (WN_MAP frequency_map)
const char * W2F_Get_Transformed_Src_Path (void)
void W2F_Set_Purple_Emission (void)
void W2F_Reset_Purple_Emission (void)
void W2F_def_ST (FILE *outfile, ST *st)
const char * W2F_Object_Name (ST *func_st)
void W2F_Translate_Stid_Lhs (char *strbuf, UINT bufsize, ST *stid_st, STAB_OFFSET stid_ofst, TY_IDX stid_ty, TYPE_ID stid_mtype)
void W2F_Translate_Istore_Lhs (char *strbuf, UINT bufsize, WN *lhs, STAB_OFFSET istore_ofst, TY_IDX istore_addr_ty, TYPE_ID istore_mtype)
void W2F_Translate_Wn (FILE *outfile, WN *wn)
void W2F_Translate_Wn_Str (char *strbuf, UINT bufsize, WN *wn)
void W2F_Translate_Purple_Main (FILE *outfile, WN *pu, const char *region_name)
void W2F_Fini (void)
void W2F_Outfile_Init (void)
void W2F_Outfile_Translate_Pu (WN *pu)
void W2F_Outfile_Fini (void)
void W2F_Cleanup (void)

Variables

static char * W2F_File_Extension [W2F_NUM_FILES]
static char * W2F_Cite_Extension [W2F_NUM_FILES]
static char * W2F_Prompf_Extension [W2F_NUM_FILES]
static W2CF_SKIP_ITEM Skip [W2F_MAX_SKIP_ITEMS+1]
static INT Next_Skip_Item = 0
static BOOL W2F_Initialized = FALSE
static BOOL W2F_Outfile_Initialized = FALSE
static FORMAT_KIND W2F_Format_Kind = F77_ANSI_FORMAT
static WN2F_CONTEXT Global_Context = INIT_WN2F_CONTEXT
static char * W2F_Progname = ""
static const char * W2F_File_Name [W2F_NUM_FILES] = {NULL, NULL, NULL}
static BOOL File_Is_Created [W2F_NUM_FILES] = {FALSE, FALSE, FALSE}
static MEM_POOL W2F_Parent_Pool
FILE * W2F_File [W2F_NUM_FILES] = {NULL, NULL, NULL}
BOOL W2F_Enabled = TRUE
BOOL W2F_Verbose = TRUE
BOOL W2F_Old_F77 = FALSE
BOOL W2F_Ansi_Format = TRUE
BOOL W2F_No_Pragmas = FALSE
BOOL W2F_Emit_Prefetch = FALSE
BOOL W2F_Emit_All_Regions = FALSE
BOOL W2F_Emit_Linedirs = FALSE
BOOL W2F_Emit_Nested_PUs = TRUE
BOOL W2F_Emit_Frequency = FALSE
BOOL W2F_Emit_Cgtag = FALSE
BOOL W2F_Emit_Pcf = FALSE
BOOL W2F_Emit_Omp = FALSE
INT32 W2F_Line_Length = 0
BOOL W2F_OpenAD
char W2F_activeType [W2F_ACTIVE_TYPE_LEN]
BOOL W2F_Only_Mark_Loads = FALSE
BOOL WN2F_F90_pu = FALSE
BOOL W2F_Purple_Emission = FALSE
BOOL W2F_Prompf_Emission = FALSE
WN_MAPW2F_Construct_Map = NULL
WN_MAP W2F_Frequency_Map = WN_MAP_UNDEFINED
Unparse_TargetW2X_Unparse_Target = NULL
TyIdxToStIdxMap tyidx_modidx

Define Documentation

Definition at line 85 of file w2f_driver.cxx.

#define MAX_ANL_FNAME_LENGTH   256-5 /* allow for suffix ".anl\0" */
#define MAX_FNAME_LENGTH   256-7 /* allow for suffix ".w2f.f\0" */
#define W2F_Extension (   i)
#define W2F_MAX_SKIP_ITEMS   128

Definition at line 131 of file w2f_driver.cxx.

Referenced by W2F_Push_PU().


Function Documentation

static void Begin_New_Locations_File ( void  ) [static]

Definition at line 438 of file w2f_driver.cxx.

References NULL, Open_W2f_Output_File(), W2F_File, W2F_File_Name, W2F_LOC_FILE, W2F_Prompf_Emission, and Write_String().

Referenced by W2F_Outfile_Init().

Here is the call graph for this function:

static BOOL Check_Initialized ( const char *  caller_name) [static]

Definition at line 695 of file w2f_driver.cxx.

References fprintf(), and W2F_Initialized.

Referenced by W2F_def_ST(), W2F_Fini(), W2F_Pop_PU(), W2F_Push_PU(), W2F_Translate_Purple_Main(), W2F_Translate_Wn(), and W2F_Translate_Wn_Str().

Here is the call graph for this function:

static BOOL Check_Outfile_Initialized ( const char *  caller_name) [static]

Definition at line 685 of file w2f_driver.cxx.

References fprintf(), and W2F_Outfile_Initialized.

Referenced by W2F_Outfile_Fini(), and W2F_Outfile_Translate_Pu().

Here is the call graph for this function:

static BOOL Check_PU_Pushed ( const char *  caller_name) [static]

Definition at line 705 of file w2f_driver.cxx.

References fprintf(), NULL, and PUinfo_current_func.

Referenced by W2F_Pop_PU(), W2F_Translate_Wn(), and W2F_Translate_Wn_Str().

Here is the call graph for this function:

static void Close_File ( const char *  filename,
FILE *  afile 
) [static]

Definition at line 384 of file w2f_driver.cxx.

References EC_Src_Close, ErrMsg(), errno, ERROR_LINE_UNKNOWN, NULL, Same_File(), and Set_Error_Line().

Referenced by Close_W2f_Output_File(), and Move_Locations_To_Anl_File().

Here is the call graph for this function:

static void Close_W2f_Output_File ( W2F_FILE_KIND  kind) [static]

Definition at line 416 of file w2f_driver.cxx.

References Close_File(), kind, NULL, W2F_File, and W2F_File_Name.

Referenced by End_Locations_File(), W2F_Cleanup(), and W2F_Outfile_Fini().

Here is the call graph for this function:

static void Continue_Locations_File ( void  ) [static]

Definition at line 496 of file w2f_driver.cxx.

References NULL, Open_W2f_Output_File(), W2F_File_Name, and W2F_LOC_FILE.

Referenced by W2F_Outfile_Translate_Pu().

Here is the call graph for this function:

static void End_Locations_File ( void  ) [static]

Definition at line 467 of file w2f_driver.cxx.

References Close_W2f_Output_File(), NULL, Open_W2f_Output_File(), Terminate_Token_Buffer(), W2F_File, W2F_File_Name, W2F_LOC_FILE, W2F_Prompf_Emission, and Write_String().

Referenced by W2F_Fini().

Here is the call graph for this function:

static void Move_Locations_To_Anl_File ( const char *  loc_fname) [static]

Definition at line 509 of file w2f_driver.cxx.

References Close_File(), EOF, Last_Pathname_Component(), MAX_ANL_FNAME_LENGTH, New_Extension(), Open_Append_File(), and Open_Read_File().

Referenced by W2F_Outfile_Fini().

Here is the call graph for this function:

static FILE* Open_Append_File ( const char *  filename) [static]

Definition at line 354 of file w2f_driver.cxx.

References EC_IR_Open, ErrMsg(), errno, f, and NULL.

Referenced by Move_Locations_To_Anl_File(), and Open_W2f_Output_File().

Here is the call graph for this function:

static FILE* Open_Create_File ( const char *  filename) [static]

Definition at line 369 of file w2f_driver.cxx.

References EC_IR_Open, ErrMsg(), errno, f, and NULL.

Referenced by Open_W2f_Output_File().

Here is the call graph for this function:

static FILE* Open_Read_File ( const char *  filename) [static]

Definition at line 339 of file w2f_driver.cxx.

References EC_IR_Open, ErrMsg(), errno, f, and NULL.

Referenced by Move_Locations_To_Anl_File().

Here is the call graph for this function:

static void Process_Command_Line ( INT  argc,
char **  argv 
) [static]

Definition at line 189 of file w2f_driver.cxx.

References exit(), FALSE, fprintf(), NULL, Show_OPT_Warnings, TRUE, W2F_ACTIVE_TYPE_LEN, W2F_activeType, and W2F_OpenAD.

Here is the call graph for this function:

static void Process_Filename_Options ( const char *  src_filename,
const char *  irb_filename 
) [static]
void W2F_Cleanup ( void  )

Definition at line 1473 of file w2f_driver.cxx.

References Close_W2f_Output_File(), NULL, unlink, W2F_File_Name, W2F_FTN_FILE, and W2F_LOC_FILE.

Referenced by Cleanup_Files().

Here is the call graph for this function:

void W2F_def_ST ( FILE *  outfile,
ST st 
)

Definition at line 944 of file w2f_driver.cxx.

References Check_Initialized(), New_Token_Buffer(), ST2F_decl_translate(), W2F_File, W2F_LOC_FILE, W2F_Undo_Whirl_Side_Effects(), and Write_And_Reclaim_Tokens().

Here is the call graph for this function:

static void W2F_Enter_Global_Symbols ( void  ) [static]

Definition at line 644 of file w2f_driver.cxx.

References For_all(), GLOBAL_SYMTAB, St_Table, Ty_Table, and W2CF_Symtab_Nameof_St().

Referenced by W2F_Init().

Here is the call graph for this function:

Definition at line 923 of file w2f_driver.cxx.

References W2F_File_Name, and W2F_FTN_FILE.

Referenced by Anl_Init().

void W2F_Mark_Loads ( void  )

Definition at line 894 of file w2f_driver.cxx.

References TRUE, and W2F_Only_Mark_Loads.

void W2F_Nomark_Loads ( void  )

Definition at line 901 of file w2f_driver.cxx.

References FALSE, and W2F_Only_Mark_Loads.

const char* W2F_Object_Name ( ST func_st)

Definition at line 959 of file w2f_driver.cxx.

References W2CF_Symtab_Nameof_St().

Referenced by W2CF_TRANSLATOR::Transformed_Symname_To_String(), WN2F_Append_Purple_Funcinfo(), WN2F_Append_Purple_Xsym(), and WN2F_Exit_PU_Block().

Here is the call graph for this function:

void W2F_Reset_Purple_Emission ( void  )

Definition at line 937 of file w2f_driver.cxx.

References FALSE, and W2F_Purple_Emission.

void W2F_Set_Frequency_Map ( WN_MAP  frequency_map)

Definition at line 916 of file w2f_driver.cxx.

References W2F_Frequency_Map.

Referenced by Post_LNO_Processing().

void W2F_Set_Prompf_Emission ( WN_MAP construct_map)

Definition at line 908 of file w2f_driver.cxx.

References TRUE, W2F_Construct_Map, and W2F_Prompf_Emission.

Referenced by load_components().

void W2F_Set_Purple_Emission ( void  )

Definition at line 930 of file w2f_driver.cxx.

References TRUE, and W2F_Purple_Emission.

Definition at line 725 of file w2f_driver.cxx.

References W2F_Emit_Nested_PUs.

Referenced by Post_LNO_Processing(), and Prompf_Emit_Whirl_to_Source().

void W2F_Translate_Istore_Lhs ( char *  strbuf,
UINT  bufsize,
WN lhs,
STAB_OFFSET  istore_ofst,
TY_IDX  istore_addr_ty,
TYPE_ID  istore_mtype 
)
void W2F_Translate_Stid_Lhs ( char *  strbuf,
UINT  bufsize,
ST stid_st,
STAB_OFFSET  stid_ofst,
TY_IDX  stid_ty,
TYPE_ID  stid_mtype 
)

Variable Documentation

Definition at line 143 of file w2f_driver.cxx.

Referenced by Open_W2f_Output_File(), and W2F_Fini().

Definition at line 140 of file w2f_driver.cxx.

INT Next_Skip_Item = 0 [static]

Definition at line 133 of file w2f_driver.cxx.

Referenced by W2F_Pop_PU(), and W2F_Push_PU().

Definition at line 132 of file w2f_driver.cxx.

Definition at line 165 of file w2f_driver.cxx.

Referenced by Process_Command_Line(), and TY2F_scalar().

Initial value:
 
{
   ".c",                
   "-after-lno.f",      
   ".loc"               
}

Definition at line 108 of file w2f_driver.cxx.

Definition at line 154 of file w2f_driver.cxx.

Referenced by W2F_Fini(), and W2F_Process_Command_Line().

Definition at line 159 of file w2f_driver.cxx.

Referenced by W2F_Process_Command_Line(), and WN2F_do_loop().

Definition at line 161 of file w2f_driver.cxx.

Referenced by W2F_Process_Command_Line(), and WN2F_is_omp().

Definition at line 160 of file w2f_driver.cxx.

Referenced by W2F_Process_Command_Line().

Definition at line 148 of file w2f_driver.cxx.

Referenced by W2F_Fini(), and W2F_Process_Command_Line().

Initial value:
 
{
   ".f",       
   ".w2f.f",   
   ".w2f.loc"  
}

Definition at line 100 of file w2f_driver.cxx.

Definition at line 137 of file w2f_driver.cxx.

Referenced by Check_Initialized(), W2F_Fini(), W2F_Init(), and W2F_Outfile_Init().

Definition at line 162 of file w2f_driver.cxx.

Referenced by W2F_Fini(), W2F_Init(), and W2F_Process_Command_Line().

Definition at line 144 of file w2f_driver.cxx.

Initial value:
 
{
   ".c",         
   ".m",         
   ".anl_srcpos" 
}

Definition at line 116 of file w2f_driver.cxx.

Definition at line 149 of file w2f_driver.cxx.

Referenced by W2F_Fini(), W2F_Outfile_Init(), and W2F_Process_Command_Line().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines