e_createModuleDebugInfoPrinterPass,//Decodes module-level debug info
e_createNoAAPass,//No Alias Analysis (always returns 'may' alias)
e_createNoPathProfileInfoPass,//No Path Profile Information
e_createNoProfileInfoPass,//No Profile Information
e_createObjCARCAliasAnalysisPass,//ObjC-ARC-Based Alias Analysis
e_createPathProfileLoaderPass,//Loads information from a path profile dump file
e_createPathProfileVerifierPass,//Verifies path profiling information
e_createPostDomOnlyPrinterPass,//Print postdominance tree of function to 'dot' file (with no function bodies)
e_createPostDomPrinterPass,//Print postdominance tree of function to 'dot' file
e_createProfileEstimatorPass,//Estimate profiling information
e_createProfileLoaderPass,//Load profile information from llvmprof.out
e_createProfileVerifierPass,//Verify profiling information
e_createRegionInfoPass,//Detect single entry single exit regions
e_createRegionOnlyPrinterPass,//Print regions of function to 'dot' file (with no function bodies)
e_createRegionPrinterPass,//Print regions of function to 'dot' file
e_createScalarEvolutionAliasAnalysisPass,//ScalarEvolution-based Alias Analysis
e_createTypeBasedAliasAnalysisPass//Type-Based Alias Analysis
}enumAnalysisPasses;
/* Available LLVM (v. 3.1) Transform Passes */
typedefenum{
t_createAggressiveDCEPass,//This pass uses the SSA based Aggressive DCE algorithm
t_createArgumentPromotionPass,//Promotes "by reference" arguments to be passed by value if the number of elements passed is smaller or equal to maxElement
t_createInternalizePass,//Loops over all of the functions in the input module, internalizing all globals
t_createIPConstantPropagationPass,//Propagates constants from call sites into the bodies of functions
t_createIPSCCPPass,//Propagates constants from call sites into the bodies of functions, and keeps track of whether basic blocks are executable in the process
t_createJumpThreadingPass,//Thread control through mult-pred/multi-succ blocks where some preds always go to some succ
t_createLCSSAPass,//This pass inserts phi nodes at loop boundaries to simplify other loop optimizations
t_createLICMPass,//Loop invariant code motion and memory promotion pass
t_createLoopDeletionPass,//Performs DCE of non-infinite loops that it can prove are dead
t_createLoopExtractorPass,//Extracts all natural loops from the program into a function if it can
t_createLoopIdiomPass,//Recognizes and replaces idioms in loops
t_createLoopInstSimplifyPass,//Simplifies instructions in a loop's body
t_createPartialInliningPass,//Inlines parts of functions
t_createPromoteMemoryToRegisterPass,//This pass is used to promote memory references to be register references
t_createPruneEHPass,//Return a new pass object which transforms invoke instructions into calls, if the callee can _no t_ unwind the stack
t_createReassociatePass,//This pass reassociates commutative expressions in an order that is designed to promote better constant propagation, GCSE, LICM, PRE...
t_createScalarReplAggregatesPass,//Break up alloca's of aggregates into multiple allocas if possible.
Intusemcjit;// Should I use MC-JIT implementation (experimental)?
enumRegAllocatorregallocator;// Active register allocator (predicate register_allocator/1)
}struc_enginebuilder;
}codegen_struc;
// struct for configuration predicates -- all fields are modified by configuration predicates (JIT_ConfigPreds.c)
struct{
enumExecModesexecution_mode;// Active execution mode
enumFrequencyTypefrequency_type;// Active frequency type
Floatfrequency_bound;// Bound to become clauses as hot
Floatprofiling_startp;// Bound to init monitoring and trace building
enumMainClauseTypemainclause_ty;// Types of clauses that can be head on traces
COUNTncores;// Number of cores on processor -- used to determine default 'compilation_threads' (compilation_threads = ncores - 1)
COUNTcompilation_threads;// Number of compilation threads (used only if 'execution_mode' is 'CONTINUOUS_COMPILATION')
pthread_t*threaded_compiler_threads;// List of threads (size = 'compilation_threads'). Used by function 'pthread_create'. Used on 'CONTINUOUS_COMPILATION' mode
CELL*posthreads;// Used to determine which threads are free/busy
Inttorecompile;// Should I recompile traces?
Intcurrent_displacement;// Jump displacement to run yaam opcodes on absmi. Zero is the default value and will make standard yaam opcodes are executed. 'TOTAL_OF_OPCODES' is the value after any clause become critical and will make 'traced_' yaam opcodes are executed.
COUNTTOTAL_OF_OPCODES;// Total of yaam opcodes. I must determine this dynamically due to several '#define' statements. Used to determine 'current_displacement' after any clause become critical.
Intuseonlypi;// Execute only 'traced_' yaam opcodes. Don't compile. WARNING: if you enable this field (predicate only_profiled_interpreter/0), the system performance will decrease considerably. Use only to determine the actual cost of running such opcodes.
}config_struc;
#if YAP_STAT_PREDS
// struct for statistic predicates -- all fields are modified by statistic predicates (JIT_StatisticPreds.c)
struct{
intpapi_initialized;// Was PAPI initialized? Used on predicate 'statistics_jit/0' -- if 1, PAPI results will be emitted
intpapi_eventset;// PAPI event set
longlong*papi_values;// List of collected performance counter values
short*papi_valid_values;// List of performance counters that will be collected
intpapi_event_type;// Type of event that will be collected -- 'papi_event_type' involves what performance counters will be within 'papi_valid_values'
// struct for debug predicates -- all fields are modified by debug predicates (JIT_DebugPreds.c)
struct{
/* Here, one 'PrinttStruc' for each yaam opcode on 'YapAppliedOpcodes.h' */
#define OPCODE(OP,TYPE) \
PrinttStrucpyaam_##OP;
#include"YapAppliedOpcodes.h"
#undef OPCODE
/* Here, one 'PrinttStruc' for each basic block on 'AppliedBasicBlocks.h' */
#define BBLOCK(BB) \
PrinttStrucpbbs_##BB;
#include"Yap_AppliedBasicBlocks.h"
#undef BBLOCK
/* This 'PrinttStruc' inform system whether head-clauses on traces should be printed */
PrinttStrucpmainclause_on_head;
/* Fields to treat intermediate code */
struct{
Intprint_to_std;// Should intermediate code be printed on std (stdout, stderr)? Default:: print_to_std = 0 (don't print to stdout nor stderr)
Intprint_to_file;// Should intermediate code be printed on file? Default:: print_to_file = 0 (don't print to file)
CELLstd_name;// if 'print_to_std' = 'yes', where should intermediate code be printed?
CELLfile_name;// if 'print_to_file' = 'yes', what file should intermediate code be printed?
}pprint_intermediate;
/* Fields to treat llva code */
struct{
Intprint_llva_before;// Should llva code be printed before optimizing module?
Intprint_llva_after;// Shoud llva code be printed after optimizing module?
}pprint_llva;
/* Fields for predicate print_me/2 */
struct{
CELLinterpreted_backtrack;// msg to print when backtrack on standard yaam opcodes occur
CELLprofiled_interpreted_backtrack;// msg to print when backtrack on 'traced_' yaam opcodes occur
CELLnative_backtrack;// msg to print when backtrack on native code occur
CELLinterpreted_treat_heap;// msg to print when heap is treated on interpreter (standard and 'traced_' yaam opcodes)
CELLnative_treat_heap;// msg to print when heap is treated on native code
CELLinterpreted_treat_trail;// msg to print when trail is treated on interpreter (standard and 'traced_' yaam opcodes)
CELLnative_treat_trail;// msg to print when trail is treated on native code
CELLcriticals;// msg to print when any clause becomes critical
CELLat_compilation;// msg to print before compilation
CELLat_recompilation;// msg to print before recompilation
CELLnativerun_init;// msg to print when native code is about to be run
CELLnativerun_exit_by_success;// msg to print when native code exits by success, ie., basic block nonexistent in native code (allows rebuilding and recompilation of traces)
CELLnativerun_exit_by_fail;// msg to print when native code exits byfail, ie., exits to treat trail or heap (don't allow rebuilding and recompilation of traces)
}pprint_me;
/* Messages on all predicates */
struct{
Intinfo_msgs;// Should I allow info messages?
Intsuccess_msgs;// Should I allow success messages?
Intwarning_msgs;// Should I allow warning messages?
Interror_msgs;// Should I allow error messages?
}act_predicate_msgs;
/* Actions on all predicates */
struct{
Intexit_on_warning;// Should I exit when any warning occur?
Intdisable_on_warning;// Shouldn't I adjust appropriate values when any warning occur (implies 'exit_on_warning' = 'false')
Intexit_on_error;// Should I exit when any error occur?
SIMPLE_ENTRY,// first basic block of any yaam opcode
SIMPLE,// any other basic block of any yaam opcode
CONDITIONAL_HEADER,// basic block of any 'if' statement of any yaam opcode
MULTIPLE_DESTINY// basic block of many destinations (elementary block). Returns from native code to interpreter always will occur here
}BlockTy;
/* Struct to represent individual basic blocks within traces */
typedefstructblocks_context{
union{
/* Fields for SIMPLE_ENTRY blocks */
struct{
UIntid;// block identifier (Yap_BasicBlocks.h)
char*label_entry;// entry label -- destinations of jumps from others 'SIMPLE_ENTRY' or 'SIMPLE' blocks
char*label_destiny;// destiny label -- where should I jump after I run?
}eb;
/* Fields for SIMPLE blocks */
struct{
UIntid;// block identifier (Yap_BasicBlocks.h)
char*label_destiny;// destiny label -- where should I jump after I run?
}sb;
/* Fields for CONDITIONAL_HEADER blocks */
struct{
char*exp;// expression of 'if' statement
structblocks_context*_if;// destination if 'exp' is true
structblocks_context*_else;// destination if 'exp' is false
}kb;
/* Fields for MULTIPLE_DESTINY blocks */
struct{
UIntid;// block identifier (Yap_BasicBlocks.h)
COUNTnfaillabels;// number of destinations caused by backtrack on native code
struct{
UInt*p;
char**labels;
}faildestiny;// destinations caused by backtrack on native code
COUNTndest;// number of destinations that not be backtrack
struct{
UInt*p;
char**labels;
}destiny;// destinations that not be backtrack
}mdb;
/* Fields for untyped blocks */
struct{
CELLheader;// just for aiding after treating 'CONDITIONAL_HEADER' blocks
}xb;
}u;
BlockTyblockty;// Basic block type
CELLthisp;// Value of PREG. Inside traces, basic blocks are only different from each other if 'id' and 'blockty' are different
CELLprev;// Previous basic block
CELLnext;// Next basic block
}BlocksContext;
/* Struct to represent fully traces */
typedefstructtrace_context{
COUNTn;// number of basic blocks
CELLtracesize;// For statistics... list of size (bytes) of each trace
BlocksContext*bc;// basic blocks context
}TraceContext;
/* Struct to represent Intermediatecode Area */
typedefstructintermediatecode_context{
COUNTn;// Total of traces stored
struct{
TraceContext**t;// List of pointers to traces -- total of 'n'
COUNT*ok;// List of traces ok (traces constructed and compiled at least once)
COUNT*isactive;// List of active traces (traces under construction). Initialized to zero
BlocksContext**lastblock;// List of last block added on each trace
#if YAP_STAT_PREDS
double*profiling_time;// For statistics... list of profiling time of each trace
#endif
}area;
}IntermediatecodeContext;
/* Struct to represent Nativecode Area */
typedefstructnative_context{
COUNTn;// Total of traces compiled (is not necessarily equal to 'IntermediatecodeContext.n')
struct{
void**p;// List of pointers to compiled codes -- total of 'n'
COUNT*ok;// List of compiled codes ok (traces constructed and compiled at least once)
CELL*pc;// List of first heads of each compiled code
#if YAP_STAT_PREDS
COUNT*nrecomp;// For statistics... number of recompilations of each compiled code (max '1' if recompilation is disabled)
double**compilation_time;// For statistics... list of compilation time of each compiled code on each recompilation
CELL**native_size_bytes;// For statistics... list of native size (bytes) of each compiled code on each recompilation
CELL**trace_size_bytes;// For statistics... list of trace size (bytes) of each trace on each recompilation
#endif
}area;
#if YAP_STAT_PREDS
COUNT*runs;// List of calls of each compiled code
double*t_runs;// List of execution time of each compiled code
COUNT*success;// List of exit by success of each compiled code
#endif
}NativeContext;
/*
*Controlflagsformanagingintermediatecode*
*fromtracesstoredonIntermediatecodeArea*
*IntermediatecodeAreastorestracesrepresentedas*
*basicblockssequence*
*/
typedefstructcontrol_flags_context{
COUNTnemited;
char**emited_blocks;
shortemit;
shortleastonce;
char*clabel;
COUNTlabelidx;
COUNTprintlabel;
char**entries;
COUNTnentries;
}ControlFlagsContext;
/* Struct associated to 'jit_handler' opcode */
typedefstructjit_handl_context{
/* Main yaam opcode features -- used by predicate 'main_clause_ty/1' */
struct{
CELLisground;// Does clause whose head is this 'jit_handler' have calls ('fcall' or 'call' opcode)? If 'yes', isground is '0'. Used when 'main_clause_ty(hot_and_callee)'
CELLclausesize;// Is clause whose head is this 'jit_handler' greater than other clauses? Used when ''main_clause_ty(hot_and_greater)'
CELLbacktrack_counter;// Does clause whose head is this 'jit_handler' have fewer backtracks on history than other clauses? Used when ''main_clause_ty(hot_and_fewer)'
}mf;
/* Frequency Instrumenters -- only one is used */
struct{
union{
COUNTc;// counter
CELLt;// time
}bcst;// balance, counter, crossover, time
}fi;
/* Reverse pointers to code areas ('Intermediatecode Area' and 'Native Area') */
struct{
COUNTtaddress;// intermediatecode area
COUNTnaddress;// native area
}caa;
/* Fields for aiding trace construction and compilation */
struct{
char*cmd;// Argument to program 'echo' (called by fork on JIT_Compiler.cpp). Its value is C code that represent traces that will be compiled. Its value is freed after compilation.
ControlFlagsContext*cf;// Pointer to ControlFlagsContext. Just used here.
}tcc;
/* Fields for managing JIT -- recompilation and threads */