Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
w2c_driver.cxx File Reference
#include <sys/elf_whirl.h>
#include <time.h>
#include "whirl2c_common.h"
#include "config_clist.h"
#include "config_list.h"
#include "w2cf_parentize.h"
#include "file_util.h"
#include "flags.h"
#include "timing.h"
#include "wn_lower.h"
#include "PUinfo.h"
#include "ty2c.h"
#include "st2c.h"
#include "tcon2c.h"
#include "wn2c.h"
#include "w2c_driver.h"
#include "unparse_target_c.h"
#include <string>
#include <stdio.h>
Include dependency graph for w2c_driver.cxx:

Go to the source code of this file.

Defines

#define MAX_LINE_LEN   2000
#define W2C_Extension(i)
#define W2C_MAX_SKIP_ITEMS   128
#define MAX_FNAME_LENGTH   256-7 /* allow for suffix ".w2c.c\0" */
#define MAX_ANL_FNAME_LENGTH   256-5 /* allow for suffix ".anl\0" */

Functions

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_W2c_Output_File (W2C_FILE_KIND kind)
static void Close_W2c_Output_File (W2C_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 W2C_Undo_Whirl_Side_Effects (void)
static void W2C_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 W2C_Should_Emit_Nested_PUs (void)
void W2C_Process_Command_Line (INT phase_argc, char *const phase_argv[], INT argc, char *const argv[])
void W2C_Init (void)
void W2C_Push_PU (const WN *pu, WN *body_part_of_interest)
void W2C_Pop_PU (void)
void W2C_Mark_Loads (void)
void W2C_Nomark_Loads (void)
void W2C_Set_Prompf_Emission (const WN_MAP *construct_map)
void W2C_Set_Frequency_Map (WN_MAP frequency_map)
const char * W2C_Get_Transformed_Src_Path (void)
void W2C_Set_Purple_Emission (void)
void W2C_Reset_Purple_Emission (void)
void W2C_def_TY (FILE *outfile, TY_IDX ty)
void W2C_Translate_Global_Types (FILE *outfile)
void W2C_write_init (FILE *outfile)
void W2C_Translate_Global_Defs (FILE *outfile)
const char * W2C_Object_Name (const ST *func_st)
void W2C_Translate_Stid_Lhs (char *strbuf, UINT bufsize, const ST *stid_st, STAB_OFFSET stid_ofst, TY_IDX stid_ty, TYPE_ID stid_mtype)
void W2C_Translate_Istore_Lhs (char *strbuf, UINT bufsize, const WN *lhs, STAB_OFFSET istore_ofst, TY_IDX istore_ty_idx, TYPE_ID istore_mtype)
void W2C_Translate_Wn (FILE *outfile, const WN *wn)
void W2C_Translate_Wn_Str (char *strbuf, UINT bufsize, const WN *wn)
void W2C_Translate_Purple_Main (FILE *outfile, const WN *pu, const char *region_name)
void W2C_Fini (void)
void W2C_Outfile_Init (BOOL emit_global_decls)
void W2C_Outfile_Translate_Pu (WN *pu, BOOL emit_global_decls)
void W2C_Outfile_Fini (BOOL emit_global_decls)
void W2C_Cleanup (void)

Variables

static const char * W2C_File_Extension [W2C_NUM_FILES]
static const char * W2C_Cite_Extension [W2C_NUM_FILES]
static const char * W2C_Prompf_Extension [W2C_NUM_FILES]
static W2CF_SKIP_ITEM Skip [W2C_MAX_SKIP_ITEMS+1]
static INT Next_Skip_Item = 0
static BOOL W2C_Outfile_Initialized = FALSE
static BOOL W2C_Initialized = FALSE
static CONTEXT Global_Context = INIT_CONTEXT
static const char * W2C_Progname = ""
static const char * W2C_File_Name [W2C_NUM_FILES]
static BOOL File_Is_Created [W2C_NUM_FILES]
static MEM_POOL W2C_Parent_Pool
FILE * W2C_File [W2C_NUM_FILES] = {NULL, NULL, NULL, NULL}
BOOL W2C_Enabled = TRUE
BOOL W2C_Verbose = TRUE
BOOL W2C_No_Pragmas = FALSE
BOOL W2C_Emit_Adims = FALSE
BOOL W2C_Emit_Prefetch = FALSE
BOOL W2C_Emit_All_Regions = FALSE
BOOL W2C_Emit_Linedirs = FALSE
BOOL W2C_Emit_Nested_PUs = FALSE
BOOL W2C_Emit_Frequency = FALSE
BOOL W2C_Emit_Cgtag = FALSE
BOOL W2C_Lower_Fortran = FALSE
BOOL W2C_Emit_Omp = FALSE
INT32 W2C_Line_Length = 0
BOOL W2C_Only_Mark_Loads = FALSE
BOOL W2C_Purple_Emission = FALSE
BOOL W2C_Prompf_Emission = FALSE
const WN_MAPW2C_Construct_Map = NULL
WN_MAP W2C_Frequency_Map = WN_MAP_UNDEFINED
BOOL W2C_Cplus_Initializer = FALSE
Unparse_TargetW2X_Unparse_Target = NULL

Define Documentation

#define MAX_ANL_FNAME_LENGTH   256-5 /* allow for suffix ".anl\0" */
#define MAX_FNAME_LENGTH   256-7 /* allow for suffix ".w2c.c\0" */
#define MAX_LINE_LEN   2000

Definition at line 88 of file w2c_driver.cxx.

Referenced by W2C_Outfile_Init().

#define W2C_Extension (   i)
#define W2C_MAX_SKIP_ITEMS   128

Definition at line 135 of file w2c_driver.cxx.

Referenced by W2C_Push_PU().


Function Documentation

static void Begin_New_Locations_File ( void  ) [static]

Definition at line 399 of file w2c_driver.cxx.

References NULL, Open_W2c_Output_File(), W2C_File, W2C_File_Name, W2C_LOC_FILE, W2C_Prompf_Emission, and Write_String().

Referenced by W2C_Outfile_Init().

Here is the call graph for this function:

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

Definition at line 588 of file w2c_driver.cxx.

References fprintf(), and W2C_Outfile_Initialized.

Referenced by W2C_Outfile_Fini(), and W2C_Outfile_Translate_Pu().

Here is the call graph for this function:

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

Definition at line 608 of file w2c_driver.cxx.

References fprintf(), NULL, and PUinfo_current_func.

Referenced by W2C_Pop_PU(), W2C_Translate_Wn(), and W2C_Translate_Wn_Str().

Here is the call graph for this function:

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

Definition at line 345 of file w2c_driver.cxx.

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

Referenced by Close_W2c_Output_File(), and Move_Locations_To_Anl_File().

Here is the call graph for this function:

static void Close_W2c_Output_File ( W2C_FILE_KIND  kind) [static]

Definition at line 377 of file w2c_driver.cxx.

References Close_File(), kind, NULL, W2C_File, and W2C_File_Name.

Referenced by End_Locations_File(), W2C_Cleanup(), and W2C_Outfile_Fini().

Here is the call graph for this function:

static void Continue_Locations_File ( void  ) [static]

Definition at line 457 of file w2c_driver.cxx.

References NULL, Open_W2c_Output_File(), W2C_File_Name, and W2C_LOC_FILE.

Referenced by W2C_Outfile_Fini(), and W2C_Outfile_Translate_Pu().

Here is the call graph for this function:

static void End_Locations_File ( void  ) [static]

Definition at line 428 of file w2c_driver.cxx.

References Close_W2c_Output_File(), NULL, Open_W2c_Output_File(), Terminate_Token_Buffer(), W2C_File, W2C_File_Name, W2C_LOC_FILE, W2C_Prompf_Emission, and Write_String().

Referenced by W2C_Fini().

Here is the call graph for this function:

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

Definition at line 470 of file w2c_driver.cxx.

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

Referenced by W2C_Outfile_Fini().

Here is the call graph for this function:

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

Definition at line 315 of file w2c_driver.cxx.

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

Referenced by Move_Locations_To_Anl_File(), and Open_W2c_Output_File().

Here is the call graph for this function:

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

Definition at line 330 of file w2c_driver.cxx.

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

Referenced by Open_W2c_Output_File().

Here is the call graph for this function:

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

Definition at line 300 of file w2c_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_Filename_Options ( const char *  src_filename,
const char *  irb_filename 
) [static]
void W2C_Cleanup ( void  )

Definition at line 1347 of file w2c_driver.cxx.

References Close_W2c_Output_File(), NULL, unlink, W2C_DOTC_FILE, W2C_DOTH_FILE, W2C_File_Name, and W2C_LOC_FILE.

Referenced by Cleanup_Files().

Here is the call graph for this function:

void W2C_def_TY ( FILE *  outfile,
TY_IDX  ty 
)

Definition at line 817 of file w2c_driver.cxx.

References W2C_DOTC_FILE, and W2C_File_Name.

Referenced by Anl_Init().

void W2C_Mark_Loads ( void  )

Definition at line 788 of file w2c_driver.cxx.

References TRUE, and W2C_Only_Mark_Loads.

void W2C_Nomark_Loads ( void  )

Definition at line 795 of file w2c_driver.cxx.

References FALSE, and W2C_Only_Mark_Loads.

const char* W2C_Object_Name ( const ST func_st)

Definition at line 893 of file w2c_driver.cxx.

References W2CF_Symtab_Nameof_St().

Referenced by W2CF_TRANSLATOR::Transformed_Symname_To_String(), WN2C_Append_Purple_Funcinfo(), and WN2C_block().

Here is the call graph for this function:

void W2C_Reset_Purple_Emission ( void  )

Definition at line 831 of file w2c_driver.cxx.

References FALSE, and W2C_Purple_Emission.

void W2C_Set_Frequency_Map ( WN_MAP  frequency_map)

Definition at line 810 of file w2c_driver.cxx.

References W2C_Frequency_Map.

Referenced by Post_LNO_Processing().

void W2C_Set_Prompf_Emission ( const WN_MAP construct_map)

Definition at line 802 of file w2c_driver.cxx.

References TRUE, W2C_Construct_Map, and W2C_Prompf_Emission.

Referenced by load_components().

void W2C_Set_Purple_Emission ( void  )

Definition at line 824 of file w2c_driver.cxx.

References TRUE, and W2C_Purple_Emission.

Definition at line 628 of file w2c_driver.cxx.

References W2C_Emit_Nested_PUs.

Referenced by Post_LNO_Processing(), and Prompf_Emit_Whirl_to_Source().

void W2C_Translate_Global_Defs ( FILE *  outfile)

Definition at line 877 of file w2c_driver.cxx.

References Check_Initialized(), outfile, W2C_DOTH_FILE, W2C_File, W2C_Undo_Whirl_Side_Effects(), and WN2C_translate_file_scope_defs().

Here is the call graph for this function:

void W2C_Translate_Global_Types ( FILE *  outfile)

Definition at line 854 of file w2c_driver.cxx.

References Check_Initialized(), outfile, W2C_DOTH_FILE, W2C_File, W2C_Undo_Whirl_Side_Effects(), and WN2C_translate_structured_types().

Here is the call graph for this function:

void W2C_Translate_Istore_Lhs ( char *  strbuf,
UINT  bufsize,
const WN lhs,
STAB_OFFSET  istore_ofst,
TY_IDX  istore_ty_idx,
TYPE_ID  istore_mtype 
)
void W2C_Translate_Stid_Lhs ( char *  strbuf,
UINT  bufsize,
const ST stid_st,
STAB_OFFSET  stid_ofst,
TY_IDX  stid_ty,
TYPE_ID  stid_mtype 
)

Definition at line 900 of file w2c_driver.cxx.

References INIT_CONTEXT, New_Token_Buffer(), Str_Write_And_Reclaim_Tokens(), W2C_Undo_Whirl_Side_Effects(), and WN2C_stid_lhs().

Referenced by W2CF_TRANSLATOR::Stid_Lhs_To_String().

Here is the call graph for this function:

void W2C_write_init ( FILE *  outfile)

Definition at line 867 of file w2c_driver.cxx.

References Check_Initialized().

Here is the call graph for this function:


Variable Documentation

Initial value:
 
                                          {FALSE, FALSE, FALSE, FALSE, FALSE}

Definition at line 147 of file w2c_driver.cxx.

Referenced by Open_W2c_Output_File(), and W2C_Fini().

Definition at line 143 of file w2c_driver.cxx.

INT Next_Skip_Item = 0 [static]

Definition at line 137 of file w2c_driver.cxx.

Referenced by W2C_Pop_PU(), and W2C_Push_PU().

Definition at line 136 of file w2c_driver.cxx.

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

Definition at line 109 of file w2c_driver.cxx.

Definition at line 162 of file w2c_driver.cxx.

Referenced by W2C_Process_Command_Line(), and WN2C_do_loop().

Definition at line 164 of file w2c_driver.cxx.

Referenced by W2C_Process_Command_Line(), and WN2C_is_omp().

Definition at line 153 of file w2c_driver.cxx.

Referenced by W2C_Fini(), and W2C_Process_Command_Line().

Initial value:
 
{
   ".c",       
   ".w2c.h",   
   ".w2c.c",   
   ".w2c.loc",  
   ".global_data.c", 
}

Definition at line 99 of file w2c_driver.cxx.

Definition at line 142 of file w2c_driver.cxx.

Referenced by Check_Initialized(), W2C_Fini(), W2C_Init(), and W2C_Outfile_Init().

Definition at line 165 of file w2c_driver.cxx.

Referenced by W2C_Fini(), W2C_Init(), and W2C_Process_Command_Line().

Definition at line 149 of file w2c_driver.cxx.

const char* W2C_Progname = "" [static]

Definition at line 144 of file w2c_driver.cxx.

Referenced by W2C_Fini(), W2C_Outfile_Init(), and W2C_Process_Command_Line().

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

Definition at line 119 of file w2c_driver.cxx.

Definition at line 154 of file w2c_driver.cxx.

Referenced by W2C_Fini(), W2C_Outfile_Init(), and W2C_Process_Command_Line().

Definition at line 174 of file w2c_driver.cxx.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines