This commit is contained in:
Vítor Santos Costa 2015-01-18 02:46:03 +00:00
parent e40c248c16
commit 67609ed1ce
9 changed files with 672 additions and 562 deletions

View File

@ -1,4 +1,4 @@
#include "JIT_Compiler.hh"
#include "JIT_Compiler.hpp"
#include <unistd.h>
#include <sys/wait.h>
#include <fcntl.h>
@ -14,41 +14,41 @@ using namespace std;
free(cmd1); \
free(cmd2);
#define ADD_PASS_ACCORDING_TO_KIND() \
#define ADD_PASS_ACCORDING_TO_KIND() \
switch (Kind) { \
case PT_BasicBlock: \
fprintf(stderr, "Oops -- basicblock printer\n"); \
exit(1); \
case PT_Region: \
Pass.add(new RegionPassPrinter(PI)); \
Pass.add(new RegionPassPrinter(PInfo)); \
break; \
case PT_Loop: \
Pass.add(new LoopPassPrinter(PI)); \
Pass.add(new LoopPassPrinter(PInfo)); \
break; \
case PT_Function: \
Pass.add(new FunctionPassPrinter(PI)); \
Pass.add(new FunctionPassPrinter(PInfo)); \
break; \
case PT_CallGraphSCC: \
Pass.add(new CallGraphSCCPassPrinter(PI)); \
Pass.add(new CallGraphSCCPassPrinter(PInfo)); \
break; \
default: \
Pass.add(new ModulePassPrinter(PI)); \
Pass.add(new ModulePassPrinter(PInfo)); \
break; \
}
#define TREAT_CASE_FOR(PASS) \
PI = PassRegistry::getPassRegistry()->getPassInfo(PASS->getPassID()); \
PInfo = PassRegistry::getPassRegistry()->getPassInfo(PASS->getPassID()); \
Kind = PASS->getPassKind(); \
ADD_PASS_ACCORDING_TO_KIND();
#include "PassPrinters.hh"
#include "PassPrinters.hpp"
void JIT_Compiler::analyze_module(llvm::Module* &M)
{
PassManager Pass; // 'Pass' stores analysis passes to be applied
TargetLibraryInfo *TLI = new TargetLibraryInfo(Triple(M->getTargetTriple()));
const PassInfo *PI;
const PassInfo *PInfo;
PassKind Kind;
Pass.add(TLI); // First, I add on 'Pass' the Target Info of Module
@ -876,7 +876,7 @@ void* JIT_Compiler::compile_all(LLVMContext* &Context, yamop* p)
/* Here, we know that Module was be successfully compiled, so... */
// 1. execute all of the static constructors or destructors for program
EE->runStaticConstructorsDestructors(false);
global++;
// global++; what is this?
close(Output);
remove(outputfilename);

View File

@ -2,6 +2,9 @@ dnl
dnl JIT CONFIGURATION
dnl
AC_ARG_VAR( LLVM_CONFIG, [ full path to llvm-config program ])
AC_SUBST(JITFLAGS)
AC_SUBST(JITLD)
AC_SUBST(JITLIBS)
@ -13,99 +16,105 @@ AC_SUBST(JITANALYSISPREDS)
AC_SUBST(JITTRANSFORMPREDS)
AC_SUBST(JITCODEGENPREDS)
AC_SUBST(PAPILIB)
AC_ARG_ENABLE(jit,
[ --enable-jit support just-in-time (JIT) compilation],
yap_jit="$enableval", yap_jit=no)
[ --enable-jit support just-in-time (JIT) compilation],
yap_jit="$enableval", yap_jit=no)
AC_ARG_ENABLE(debug-predicates,
[ --enable-debug-predicates support debug predicates ],
dbg_preds="$enableval", dbg_preds=no)
[ --enable-debug-predicates support debug predicates ],
dbg_preds="$enableval", dbg_preds=no)
AC_ARG_ENABLE(statistic-predicates,
[ --enable-statistic-predicates support statistic predicates ],
stat_preds="$enableval", stat_preds=no)
[ --enable-statistic-predicates support statistic predicates ],
stat_preds="$enableval", stat_preds=no)
if test "$yap_jit" = "yes"
then
AC_CHECK_PROG(LLVM, llvm-config, [yes],[no])
if test "$LLVM" = "no" ;then
AC_MSG_ERROR([--enable-jit was given, but test for LLVM 3.5 failed])
else
LLVM_VERSION="`llvm-config --version`"
if test "$LLVM_VERSION" != "3.5.0";then
AC_MSG_ERROR([Test for LLVM 3.5 failed])
fi
fi
AC_CHECK_PROG(CLANG, clang, [yes],[no])
if test "$CLANG" = "no" ;then
AC_MSG_ERROR([--enable-jit was given, but test for clang faild])
fi
YAP_EXTRAS="$YAP_EXTRAS -DYAP_JIT=1"
JITCOMPILER="JIT_Compiler.o"
JITCONFIGPREDS="jit_configpreds.o"
JITANALYSISPREDS="jit_analysispreds.o"
JITTRANSFORMPREDS="jit_transformpreds.o"
JITCODEGENPREDS="jit_codegenpreds.o"
JITFLAGS="`llvm-config --cxxflags`"
JITLD="`llvm-config --ldflags`"
JITLIBS="`llvm-config --libs all` -pthread -lffi -lz"
#assumes we have r on path
AC_CHECK_PROGS(LLVM_CONFIG, llvm-config , "no" )
AC_CHECK_PROGS(CLANG, clang , [no] )
elif test "$yap_jit" = "no"
then
LLVM_CONFIG=
CLANG=no
else
AC_PATH_PROG(LLVM_CONFIG, llvm-config ,"no", [ "$yap_jit"/bin ] )
AC_PATH_PROG(CLANG, clang, "no", [ "$yap_jit"/bin ] )
fi
if test "$dbg_preds" = "yes"
then
if test x"$LLVM_CONFIG" != x ;then
#nothing
if test x"$LLVM_CONFIG" = x"no" ;then
AC_MSG_ERROR([--enable-jit was given, but test for LLVM 3.5 failed])
else
LLVM_VERSION="`$LLVM_CONFIG --version`"
if test "$LLVM_VERSION" != "3.5.0";then
AC_MSG_ERROR([Test for LLVM 3.5 failed])
fi
if test "$yap_jit" = "no"
then
AC_MSG_ERROR([--enable-debug-predicates was given, but --enable-jit was not given])
if test "$CLANG" = "no" ;then
AC_MSG_ERROR([--enable-jit was given, but test for clang faild])
fi
fi
YAP_EXTRAS="$YAP_EXTRAS -DYAP_DBG_PREDS=1"
JITDEBUGPREDS="jit_debugpreds.o"
YAP_EXTRAS="$YAP_EXTRAS -DYAP_JIT=1"
JITCOMPILER="JIT_Compiler.o"
JITCONFIGPREDS="jit_configpreds.o"
JITANALYSISPREDS="jit_analysispreds.o"
JITTRANSFORMPREDS="jit_transformpreds.o"
JITCODEGENPREDS="jit_codegenpreds.o"
JITFLAGS="`$LLVM_CONFIG --cxxflags`"
JITLD="`$LLVM_CONFIG --ldflags`"
JITLIBS="`$LLVM_CONFIG --libs all` -pthread -lffi -lz"
fi
fi
if test "$stat_preds" = "yes"
then
if test x"$dbg_preds" = x"yes"
then
if test "$yap_jit" = "no"
then
AC_MSG_ERROR([--enable-statistic-predicates was given, but --enable-jit was not given])
if test "$yap_jit" = "no"
then
fi
AC_MSG_ERROR([--enable-debug-predicates was given, but --enable-jit was not given])
AC_CHECK_HEADER([papi.h],
[],
[if test "$stat_preds" != "no"; then
AC_MSG_ERROR(
[--enable-statistic-predicates was given, but papi.h not found])
fi
])
AC_CHECK_LIB([papi], [PAPI_start],
[if test "$stat_preds" != "no"; then
PAPILIB="-lpapi"
fi
],
[if test "$stat_preds" != "no"; then
AC_MSG_ERROR(
[--enable-statistic-predicates was given, but test for papi failed])
fi
])
YAP_EXTRAS="$YAP_EXTRAS -DYAP_STAT_PREDS=1"
JITSTATISTICPREDS="jit_statisticpreds.o"
PAPILIB="-lpapi"
fi
YAP_EXTRAS="$YAP_EXTRAS -DYAP_DBG_PREDS=1"
JITDEBUGPREDS="jit_debugpreds.o"
fi
if test x"$stat_preds" = x"yes"
then
if test "$yap_jit" = "no"
then
AC_MSG_ERROR([--enable-statistic-predicates was given, but --enable-jit was not given])
fi
AC_CHECK_HEADER([papi.h],
[],
[if test "$stat_preds" != "no"; then
AC_MSG_ERROR(
[--enable-statistic-predicates was given, but papi.h not found])
fi
])
AC_CHECK_LIB([papi], [PAPI_start],
[if test "$stat_preds" != "no"; then
PAPILIB="-lpapi"
fi
],
[if test "$stat_preds" != "no"; then
AC_MSG_ERROR(
[--enable-statistic-predicates was given, but test for papi failed])
fi
])
YAP_EXTRAS="$YAP_EXTRAS -DYAP_STAT_PREDS=1"
JITSTATISTICPREDS="jit_statisticpreds.o"
PAPILIB="-lpapi"
fi

View File

@ -15,71 +15,71 @@
* Last rev: 2013-10-18 *
*************************************************************************/
#include "jit_predicates.hh"
#include "jit_predicates.hpp"
#include <string.h>
#define N_ANALYSIS_PASSES 33
// Disable one (passed by argument) LLVM analysis pass
static Int p_disable_analysis_pass(void);
static Int p_disable_analysis_pass( USES_REGS1 );
// Enable one (passed by argument) LLVM analysis pass
static Int p_analysis_pass(void);
static Int p_analysis_pass( USES_REGS1 );
// Enable one (passed by argument) LLVM analysis pass
static Int p_enable_analysis_pass(void);
static Int p_enable_analysis_pass( USES_REGS1 );
// Enable a list (passed by argument) of LLVM analysis passes
static Int p_analysis_passes(void);
static Int p_analysis_passes( USES_REGS1 );
// Enable all available LLVM analysis passes
static Int p_enable_all_analysis_passes(void);
static Int p_enable_all_analysis_passes( USES_REGS1 );
// Disable all available LLVM analysis passes
static Int p_disable_all_analysis_passes(void);
static Int p_disable_all_analysis_passes( USES_REGS1 );
// Enable LLVM statistics
static Int p_enable_stats(void);
static Int p_enable_stats( USES_REGS1 );
// Enable elapsed time of each LLVM's task
static Int p_enable_time_passes(void);
static Int p_enable_time_passes( USES_REGS1 );
// Checks generated modules are correct (before optimize it). Use only if you suspect that any module has been generated incorrectly.
static Int p_enable_module_correctness(void);
static Int p_enable_module_correctness( USES_REGS1 );
// Same as 'p_enable_module_correctness', but accepts one argument, which defines when modules are checked.
// Valid values are those defined by 'enumPointToVerifiy' on 'amidefs.h'
static Int p_enable_module_correctness1(void);
static Int p_enable_module_correctness1( USES_REGS1 );
// Same as 'p_enable_module_correctness' with ARG1 = NOPOINT
static Int p_verify_module_nopoint(void);
static Int p_verify_module_nopoint( USES_REGS1 );
// Same as 'p_enable_module_correctness' with ARG1 = BEFORE
static Int p_verify_module_before(void);
static Int p_verify_module_before( USES_REGS1 );
// Same as 'p_enable_module_correctness' with ARG1 = AFTER
static Int p_verify_module_after(void);
static Int p_verify_module_after( USES_REGS1 );
// Same as 'p_enable_module_correctness' with ARG1 = BOTH
static Int p_verify_module_both(void);
static Int p_verify_module_both( USES_REGS1 );
// Disable LLVM statistics
static Int p_disable_stats(void);
static Int p_disable_stats( USES_REGS1 );
// Disable elapsed time of each LLVM's task
static Int p_disable_time_passes(void);
static Int p_disable_time_passes( USES_REGS1 );
// Don't check generated modules are correct
static Int p_disable_module_correctness(void);
static Int p_disable_module_correctness( USES_REGS1 );
// Set output file where analysis results are emitted. 'stderr' and 'stdout' are valid values
static Int p_analysis_output_file(void);
static Int p_analysis_output_file( USES_REGS1 );
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
static Int
p_disable_analysis_pass(void)
p_disable_analysis_pass( USES_REGS1 )
{
// First: stores what analysis pass should be disabled
@ -181,10 +181,10 @@ p_disable_analysis_pass(void)
}
static Int
p_analysis_pass(void)
p_analysis_pass( USES_REGS1 )
{
// First: disables analysis pass (if be active)
p_disable_analysis_pass();
p_disable_analysis_pass( PASS_REGS1 );
// Second: valids argument and inserts new analysis pass
// valid values for ARG1 are 'integer' and 'atom'
@ -269,13 +269,13 @@ p_analysis_pass(void)
}
static Int
p_enable_analysis_pass(void)
p_enable_analysis_pass( USES_REGS1 )
{
return p_analysis_pass();
return p_analysis_pass( PASS_REGS1 );
}
static Int
p_analysis_passes(void)
p_analysis_passes( USES_REGS1 )
{
int i = 0, j = 0;
char *tmp;
@ -415,7 +415,7 @@ p_analysis_passes(void)
}
static Int
p_enable_all_analysis_passes(void)
p_enable_all_analysis_passes( USES_REGS1 )
{
// Same as 'analysis_passes(all)'
// First, disable all analysis passes
@ -434,7 +434,7 @@ p_enable_all_analysis_passes(void)
}
static Int
p_disable_all_analysis_passes(void)
p_disable_all_analysis_passes( USES_REGS1 )
{
// Just empty 'ExpEnv.analysis_struc.act_an'
if (ExpEnv.analysis_struc.act_an) free(ExpEnv.analysis_struc.act_an);
@ -444,28 +444,28 @@ p_disable_all_analysis_passes(void)
}
static Int
p_enable_stats(void)
p_enable_stats( USES_REGS1 )
{
ExpEnv.analysis_struc.stats_enabled = 1;
return TRUE;
}
static Int
p_enable_time_passes(void)
p_enable_time_passes( USES_REGS1 )
{
ExpEnv.analysis_struc.time_pass_enabled = 1;
return TRUE;
}
static Int
p_enable_module_correctness(void)
p_enable_module_correctness( USES_REGS1 )
{
ExpEnv.analysis_struc.pointtoverifymodule = AFTER;
return TRUE;
}
static Int
p_enable_module_correctness1(void)
p_enable_module_correctness1( USES_REGS1 )
{
Term t = Deref(ARG1);
char *tmp;
@ -499,7 +499,7 @@ p_enable_module_correctness1(void)
}
static Int
p_verify_module_nopoint(void)
p_verify_module_nopoint( USES_REGS1 )
{
// Same as 'enable_module_correctness(nopoint)'
ExpEnv.analysis_struc.pointtoverifymodule = NOPOINT;
@ -507,7 +507,7 @@ p_verify_module_nopoint(void)
}
static Int
p_verify_module_before(void)
p_verify_module_before( USES_REGS1 )
{
// Same as 'enable_module_correctness(before)'
ExpEnv.analysis_struc.pointtoverifymodule = BEFORE;
@ -515,7 +515,7 @@ p_verify_module_before(void)
}
static Int
p_verify_module_after(void)
p_verify_module_after( USES_REGS1 )
{
// Same as 'enable_module_correctness(after)'
ExpEnv.analysis_struc.pointtoverifymodule = AFTER;
@ -523,7 +523,7 @@ p_verify_module_after(void)
}
static Int
p_verify_module_both(void)
p_verify_module_both( USES_REGS1 )
{
// Same as 'enable_module_correctness(both)'
ExpEnv.analysis_struc.pointtoverifymodule = BOTH;
@ -531,28 +531,28 @@ p_verify_module_both(void)
}
static Int
p_disable_stats(void)
p_disable_stats( USES_REGS1 )
{
ExpEnv.analysis_struc.stats_enabled = 0;
return TRUE;
}
static Int
p_disable_time_passes(void)
p_disable_time_passes( USES_REGS1 )
{
ExpEnv.analysis_struc.time_pass_enabled = 0;
return TRUE;
}
static Int
p_disable_module_correctness(void)
p_disable_module_correctness( USES_REGS1 )
{
ExpEnv.analysis_struc.pointtoverifymodule = NOPOINT;
return TRUE;
}
static Int
p_analysis_output_file(void)
p_analysis_output_file( USES_REGS1 )
{
Term t = Deref(ARG1);
char *tmp;

View File

@ -15,231 +15,231 @@
* Last rev: 2013-10-18 *
*************************************************************************/
#include "jit_predicates.hh"
#include "jit_predicates.hpp"
/* Predicates for LLVM Target Options configuration */
static Int p_enable_framepointer_elimination(void);
static Int p_more_precise_fp_mad_option(void);
static Int p_excess_fp_precision(void);
static Int p_safe_fp_math(void);
static Int p_rounding_mode_not_changed(void);
static Int p_no_use_soft_float(void);
static Int p_disable_jit_exception_handling(void);
static Int p_disable_jit_emit_debug_info(void);
static Int p_disable_jit_emit_debug_info_to_disk(void);
static Int p_no_guaranteed_tail_call_opt(void);
static Int p_enable_tail_calls(void);
static Int p_disable_fast_isel(void);
static Int p_disable_framepointer_elimination(void);
static Int p_less_precise_fp_mad_option(void);
static Int p_no_excess_fp_precision(void);
static Int p_unsafe_fp_math(void);
static Int p_rounding_mode_dynamically_changed(void);
static Int p_use_soft_float(void);
static Int p_enable_jit_exception_handling(void);
static Int p_enable_jit_emit_debug_info(void);
static Int p_enable_jit_emit_debug_info_to_disk(void);
static Int p_guaranteed_tail_call_opt(void);
static Int p_disable_tail_calls(void);
static Int p_enable_fast_isel(void);
static Int p_fp_abitype(void);
static Int p_default_fp_abitype(void);
static Int p_enable_framepointer_elimination( USES_REGS1 );
static Int p_more_precise_fp_mad_option( USES_REGS1 );
static Int p_excess_fp_precision( USES_REGS1 );
static Int p_safe_fp_math( USES_REGS1 );
static Int p_rounding_mode_not_changed( USES_REGS1 );
static Int p_no_use_soft_float( USES_REGS1 );
static Int p_disable_jit_exception_handling( USES_REGS1 );
static Int p_disable_jit_emit_debug_info( USES_REGS1 );
static Int p_disable_jit_emit_debug_info_to_disk( USES_REGS1 );
static Int p_no_guaranteed_tail_call_opt( USES_REGS1 );
static Int p_enable_tail_calls( USES_REGS1 );
static Int p_disable_fast_isel( USES_REGS1 );
static Int p_disable_framepointer_elimination( USES_REGS1 );
static Int p_less_precise_fp_mad_option( USES_REGS1 );
static Int p_no_excess_fp_precision( USES_REGS1 );
static Int p_unsafe_fp_math( USES_REGS1 );
static Int p_rounding_mode_dynamically_changed( USES_REGS1 );
static Int p_use_soft_float( USES_REGS1 );
static Int p_enable_jit_exception_handling( USES_REGS1 );
static Int p_enable_jit_emit_debug_info( USES_REGS1 );
static Int p_enable_jit_emit_debug_info_to_disk( USES_REGS1 );
static Int p_guaranteed_tail_call_opt( USES_REGS1 );
static Int p_disable_tail_calls( USES_REGS1 );
static Int p_enable_fast_isel( USES_REGS1 );
static Int p_fp_abitype( USES_REGS1 );
static Int p_default_fp_abitype( USES_REGS1 );
// LLVM Execution Engine level
static Int p_engine_opt_level(void);
static Int p_reset_engine_opt_level(void);
static Int p_engine_opt_level( USES_REGS1 );
static Int p_reset_engine_opt_level( USES_REGS1 );
// LLVM Execution Engine reloc model
static Int p_relocmodel(void);
static Int p_reset_relocmodel(void);
static Int p_relocmodel( USES_REGS1 );
static Int p_reset_relocmodel( USES_REGS1 );
// LLVM Execution Engine code model
static Int p_codemodel(void);
static Int p_reset_codemodel(void);
static Int p_codemodel( USES_REGS1 );
static Int p_reset_codemodel( USES_REGS1 );
// Enable MC JIT (experimental)
static Int p_enable_mcjit(void);
static Int p_enable_mcjit( USES_REGS1 );
// Disable MC JIT (experimental)
static Int p_disable_mcjit(void);
static Int p_disable_mcjit( USES_REGS1 );
// LLVM Register Allocator (not implemented -- for some reason, LLVM crashes when I use it on 'JIT_Compiler.cpp')
static Int p_register_allocator(void);
static Int p_reset_register_allocator(void);
static Int p_register_allocator( USES_REGS1 );
static Int p_reset_register_allocator( USES_REGS1 );
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
static Int
p_enable_framepointer_elimination(void)
p_enable_framepointer_elimination( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.noframepointerelim = FALSE;
return TRUE;
}
static Int
p_more_precise_fp_mad_option(void)
p_more_precise_fp_mad_option( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.lessprecisefpmadoption = FALSE;
return TRUE;
}
static Int
p_excess_fp_precision(void)
p_excess_fp_precision( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.noexcessfpprecision = FALSE;
return TRUE;
}
static Int
p_safe_fp_math(void)
p_safe_fp_math( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.unsafefpmath = FALSE;
return TRUE;
}
static Int
p_rounding_mode_not_changed(void)
p_rounding_mode_not_changed( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.honorsigndependentroundingfpmathoption = FALSE;
return TRUE;
}
static Int
p_no_use_soft_float(void)
p_no_use_soft_float( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.usesoftfloat = FALSE;
return TRUE;
}
static Int
p_disable_jit_exception_handling(void)
p_disable_jit_exception_handling( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.jitexceptionhandling = FALSE;
return TRUE;
}
static Int
p_disable_jit_emit_debug_info(void)
p_disable_jit_emit_debug_info( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.jitemitdebuginfo = FALSE;
return TRUE;
}
static Int
p_disable_jit_emit_debug_info_to_disk(void)
p_disable_jit_emit_debug_info_to_disk( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.jitemitdebuginfotodisk = FALSE;
return TRUE;
}
static Int
p_no_guaranteed_tail_call_opt(void)
p_no_guaranteed_tail_call_opt( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.guaranteedtailcallopt = FALSE;
return TRUE;
}
static Int
p_enable_tail_calls(void)
p_enable_tail_calls( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.disabletailcalls = FALSE;
return TRUE;
}
static Int
p_disable_fast_isel(void)
p_disable_fast_isel( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.fastisel = FALSE;
return TRUE;
}
static Int
p_disable_framepointer_elimination(void)
p_disable_framepointer_elimination( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.noframepointerelim = TRUE;
return TRUE;
}
static Int
p_less_precise_fp_mad_option(void)
p_less_precise_fp_mad_option( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.lessprecisefpmadoption = TRUE;
return TRUE;
}
static Int
p_no_excess_fp_precision(void)
p_no_excess_fp_precision( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.noexcessfpprecision = TRUE;
return TRUE;
}
static Int
p_unsafe_fp_math(void)
p_unsafe_fp_math( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.unsafefpmath = TRUE;
return TRUE;
}
static Int
p_rounding_mode_dynamically_changed(void)
p_rounding_mode_dynamically_changed( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.honorsigndependentroundingfpmathoption = TRUE;
return TRUE;
}
static Int
p_use_soft_float(void)
p_use_soft_float( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.usesoftfloat = TRUE;
return TRUE;
}
static Int
p_enable_jit_exception_handling(void)
p_enable_jit_exception_handling( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.jitexceptionhandling = TRUE;
return TRUE;
}
static Int
p_enable_jit_emit_debug_info(void)
p_enable_jit_emit_debug_info( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.jitemitdebuginfo = TRUE;
return TRUE;
}
static Int
p_enable_jit_emit_debug_info_to_disk(void)
p_enable_jit_emit_debug_info_to_disk( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.jitemitdebuginfotodisk = TRUE;
return TRUE;
}
static Int
p_guaranteed_tail_call_opt(void)
p_guaranteed_tail_call_opt( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.guaranteedtailcallopt = TRUE;
return TRUE;
}
static Int
p_disable_tail_calls(void)
p_disable_tail_calls( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.disabletailcalls = TRUE;
return TRUE;
}
static Int
p_enable_fast_isel(void)
p_enable_fast_isel( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.fastisel = TRUE;
return TRUE;
}
static Int
p_fp_abitype(void)
p_fp_abitype( USES_REGS1 )
{
Term t = Deref(ARG1);
Int v;
@ -285,14 +285,14 @@ p_fp_abitype(void)
}
static Int
p_default_fp_abitype(void)
p_default_fp_abitype( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_targetopt.floatabitype = 0;
return TRUE;
}
static Int
p_engine_opt_level(void)
p_engine_opt_level( USES_REGS1 )
{
Term t = Deref(ARG1);
Int v;
@ -339,14 +339,14 @@ p_engine_opt_level(void)
}
static Int
p_reset_engine_opt_level(void)
p_reset_engine_opt_level( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_enginebuilder.engineoptlevel = 3;
return TRUE;
}
static Int
p_relocmodel(void)
p_relocmodel( USES_REGS1 )
{
Term t = Deref(ARG1);
Int v;
@ -393,14 +393,14 @@ p_relocmodel(void)
}
static Int
p_reset_relocmodel(void)
p_reset_relocmodel( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_enginebuilder.relocmodel = 0;
return TRUE;
}
static Int
p_codemodel(void)
p_codemodel( USES_REGS1 )
{
Term t = Deref(ARG1);
Int v;
@ -449,28 +449,28 @@ p_codemodel(void)
}
static Int
p_reset_codemodel(void)
p_reset_codemodel( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_enginebuilder.codemodel = 1;
return TRUE;
}
static Int
p_enable_mcjit(void)
p_enable_mcjit( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_enginebuilder.usemcjit = 1;
return TRUE;
}
static Int
p_disable_mcjit(void)
p_disable_mcjit( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_enginebuilder.usemcjit = 0;
return TRUE;
}
static Int
p_register_allocator(void)
p_register_allocator( USES_REGS1 )
{
Term t = Deref(ARG1);
// valid values for ARG1 are 'integer' and 'atom'
@ -517,7 +517,7 @@ p_register_allocator(void)
}
static Int
p_reset_register_allocator(void)
p_reset_register_allocator( USES_REGS1 )
{
ExpEnv.codegen_struc.struc_enginebuilder.regallocator = REG_ALLOC_GREEDY;
return TRUE;
@ -526,7 +526,7 @@ p_reset_register_allocator(void)
#pragma GCC diagnostic pop
void
Yap_InitJitCodegenPreds(void)
Yap_InitJitCodegenPreds( void )
{
Yap_InitCPred("enable_framepointer_elimination", 0, p_enable_framepointer_elimination, SafePredFlag);
Yap_InitCPred("more_precise_fp_mad_option", 0, p_more_precise_fp_mad_option, SafePredFlag);

View File

@ -15,69 +15,69 @@
* Last rev: 2013-10-18 *
*************************************************************************/
#include "jit_predicates.hh"
#include "jit_predicates.hpp"
#include <math.h>
// Enable any (passed by argument) execution mode
static Int p_execution_mode(void);
static Int p_execution_mode( USES_REGS1 );
// Enable 'just interpreted' mode.
static Int p_interpreted_mode(void);
static Int p_interpreted_mode( USES_REGS1 );
// Enable 'smart jit' mode.
static Int p_smartjit_mode(void);
static Int p_smartjit_mode( USES_REGS1 );
// Enable 'continuous compilation' mode.
static Int p_continuouscompilation_mode(void);
static Int p_continuouscompilation_mode( USES_REGS1 );
// Enable 'just compiled' mode.
static Int p_justcompiled_mode(void);
static Int p_justcompiled_mode( USES_REGS1 );
// Enable one (passed by argument) of all available frequency types: counter or time. Frequency bound is default.
// Just for 'smart jit' or 'continuous compilation' mode
static Int p_frequencyty1(void);
static Int p_frequencyty1( USES_REGS1 );
// Enable one (1st argument) of all available frequency types: counter and time. Frequency bound is 2nd argument
// Just for 'smart jit' or 'continuous compilation' mode
static Int p_frequencyty2(void);
static Int p_frequencyty2( USES_REGS1 );
// Enable frequency bound
// Just for 'smart jit' or 'continuous compilation' mode
static Int p_frequency_bound(void);
static Int p_frequency_bound( USES_REGS1 );
// Enable value for starting profiling
// Just for 'smart jit' or 'continuous compilation' mode
static Int p_profiling_start_point(void);
static Int p_profiling_start_point( USES_REGS1 );
// Choose type of clause that can be main on traces
// Just for 'smart jit' or 'continuous compilation' mode
static Int p_main_clause_ty(void);
static Int p_main_clause_ty( USES_REGS1 );
// Choose amount of compilation threads
// Just for 'smart jit' or 'continuous compilation' mode
static Int p_compilation_threads(void);
static Int p_compilation_threads( USES_REGS1 );
// Enable recompilation
// Just for 'smart jit' or 'continuous compilation' mode
static Int p_enable_recompilation(void);
static Int p_enable_recompilation( USES_REGS1 );
// Disable recompilation
// Just for 'smart jit' or 'continuous compilation' mode
static Int p_disable_recompilation(void);
static Int p_disable_recompilation( USES_REGS1 );
// Just code interpretation. Don't compile
// Just for 'smart jit' or 'continuous compilation' mode
static Int p_only_profiled_interpreter(void);
static Int p_only_profiled_interpreter( USES_REGS1 );
// Disable 'p_only_profiled_interpreter'
// Just for 'smart jit' or 'continuous compilation' mode
static Int p_noonly_profiled_interpreter(void);
static Int p_noonly_profiled_interpreter( USES_REGS1 );
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
static Int
p_execution_mode(void)
p_execution_mode( USES_REGS1 )
{
enumExecModes mode;
// valid values for ARG1 are 'integer' and 'atom'
@ -217,7 +217,7 @@ p_execution_mode(void)
}
static Int
p_interpreted_mode(void)
p_interpreted_mode( USES_REGS1 )
{
// Same as 'execution_mode(0)' or 'execution_mode(interpreted)'
if (Yap_ExecutionMode == INTERPRETED) {
@ -242,7 +242,7 @@ p_interpreted_mode(void)
}
static Int
p_smartjit_mode(void)
p_smartjit_mode( USES_REGS1 )
{
// Same as 'execution_mode(1)' or 'execution_mode(smartjit)'
if (Yap_ExecutionMode == MIXED_MODE) {
@ -273,7 +273,7 @@ p_smartjit_mode(void)
}
static Int
p_continuouscompilation_mode(void)
p_continuouscompilation_mode( USES_REGS1 )
{
// Same as 'execution_mode(2)' or 'execution_mode(continuouscompilation)'
if (Yap_ExecutionMode == MIXED_MODE) {
@ -310,7 +310,7 @@ p_continuouscompilation_mode(void)
}
static Int
p_justcompiled_mode(void)
p_justcompiled_mode( USES_REGS1 )
{
// Same as 'execution_mode(3)' or 'execution_mode(justcompiled)'
if (Yap_ExecutionMode == COMPILED) {
@ -337,7 +337,7 @@ p_justcompiled_mode(void)
}
static Int
p_frequencyty1(void)
p_frequencyty1( USES_REGS1 )
{
// this predicate works only 'SMART_JIT' and 'CONTINUOUS_COMPILATION' modes
if (ExpEnv.config_struc.execution_mode == SMART_JIT || ExpEnv.config_struc.execution_mode == CONTINUOUS_COMPILATION) {
@ -384,7 +384,7 @@ p_frequencyty1(void)
}
static Int
p_frequencyty2(void)
p_frequencyty2( USES_REGS1 )
{
// this predicate works only 'SMART_JIT' and 'CONTINUOUS_COMPILATION' modes
if (ExpEnv.config_struc.execution_mode == SMART_JIT || ExpEnv.config_struc.execution_mode == CONTINUOUS_COMPILATION) {
@ -456,7 +456,7 @@ p_frequencyty2(void)
}
static Int
p_frequency_bound(void)
p_frequency_bound( USES_REGS1 )
{
// this predicate works only 'SMART_JIT' and 'CONTINUOUS_COMPILATION' modes
if (ExpEnv.config_struc.execution_mode == SMART_JIT || ExpEnv.config_struc.execution_mode == CONTINUOUS_COMPILATION) {
@ -502,7 +502,7 @@ p_frequency_bound(void)
}
static Int
p_profiling_start_point(void)
p_profiling_start_point( USES_REGS1 )
{
// this predicate works only 'SMART_JIT' and 'CONTINUOUS_COMPILATION' modes
if (ExpEnv.config_struc.execution_mode == SMART_JIT || ExpEnv.config_struc.execution_mode == CONTINUOUS_COMPILATION) {
@ -533,7 +533,7 @@ p_profiling_start_point(void)
}
static Int
p_main_clause_ty(void)
p_main_clause_ty( USES_REGS1 )
{
// this predicate works only 'SMART_JIT' and 'CONTINUOUS_COMPILATION' modes
if (ExpEnv.config_struc.execution_mode == SMART_JIT || ExpEnv.config_struc.execution_mode == CONTINUOUS_COMPILATION) {
@ -628,7 +628,7 @@ p_main_clause_ty(void)
}
static Int
p_compilation_threads(void)
p_compilation_threads( USES_REGS1 )
{
// this predicate works only 'CONTINUOUS_COMPILATION' mode
if (ExpEnv.config_struc.execution_mode == SMART_JIT || ExpEnv.config_struc.execution_mode == CONTINUOUS_COMPILATION) {
@ -681,28 +681,28 @@ p_compilation_threads(void)
}
static Int
p_enable_recompilation(void)
p_enable_recompilation( USES_REGS1 )
{
ExpEnv.config_struc.torecompile = 1;
return TRUE;
}
static Int
p_disable_recompilation(void)
p_disable_recompilation( USES_REGS1 )
{
ExpEnv.config_struc.torecompile = 0;
return TRUE;
}
static Int
p_only_profiled_interpreter(void)
p_only_profiled_interpreter( USES_REGS1 )
{
ExpEnv.config_struc.useonlypi = 1;
return TRUE;
}
static Int
p_noonly_profiled_interpreter(void)
p_noonly_profiled_interpreter( USES_REGS1 )
{
ExpEnv.config_struc.useonlypi = 0;
return TRUE;
@ -710,7 +710,7 @@ p_noonly_profiled_interpreter(void)
#pragma GCC diagnostic pop
void
Yap_InitJitConfigPreds(void)
Yap_InitJitConfigPreds( void )
{
Yap_InitCPred("execution_mode", 1, p_execution_mode, SafePredFlag);
Yap_InitCPred("interpreted_mode", 0, p_interpreted_mode, SafePredFlag);

View File

@ -17,111 +17,111 @@
#include "jit_predicates.hh"
static Int p_no_print_instruction(void);
static Int p_no_print_basic_instruction(void);
static Int p_no_print_std_instruction(void);
static Int p_no_print_standard_instruction(void);
static Int p_print_instruction(void);
static Int p_print_basic_instruction(void);
static Int p_print_std_instruction(void);
static Int p_print_standard_instruction(void);
static Int p_print_instruction_msg_before(void);
static Int p_print_basic_instruction_msg_before(void);
static Int p_print_std_instruction_msg_before(void);
static Int p_print_standard_instruction_msg_before(void);
static Int p_print_instruction_msg_after(void);
static Int p_print_basic_instruction_msg_after(void);
static Int p_print_std_instruction_msg_after(void);
static Int p_print_standard_instruction_msg_after(void);
static Int p_print_instruction3(void);
static Int p_print_basic_instruction3(void);
static Int p_print_std_instruction3(void);
static Int p_print_standard_instruction3(void);
static Int p_print_profiled_instruction(void);
static Int p_print_traced_instruction(void);
static Int p_print_pfd_instruction(void);
static Int p_print_profiled_instruction_msg_before(void);
static Int p_print_traced_instruction_msg_before(void);
static Int p_print_pfd_instruction_msg_before(void);
static Int p_print_profiled_instruction_msg_after(void);
static Int p_print_traced_instruction_msg_after(void);
static Int p_print_pfd_instruction_msg_after(void);
static Int p_print_profiled_instruction3(void);
static Int p_print_traced_instruction3(void);
static Int p_print_pfd_instruction3(void);
static Int p_print_native_instruction(void);
static Int p_print_ntv_instruction(void);
static Int p_print_native_instruction_msg_before(void);
static Int p_print_ntv_instruction_msg_before(void);
static Int p_print_native_instruction_msg_after(void);
static Int p_print_ntv_instruction_msg_after(void);
static Int p_print_native_instruction3(void);
static Int p_print_ntv_instruction3(void);
static Int p_no_print_basic_block(void);
static Int p_no_print_basicblock(void);
static Int p_no_print_bb(void);
static Int p_print_basic_block(void);
static Int p_print_basicblock(void);
static Int p_print_bb(void);
static Int p_print_basic_block_msg_before(void);
static Int p_print_basicblock_msg_before(void);
static Int p_print_bb_msg_before(void);
static Int p_print_basic_block_msg_after(void);
static Int p_print_basicblock_msg_after(void);
static Int p_print_bb_msg_after(void);
static Int p_print_basic_block3(void);
static Int p_print_basicblock3(void);
static Int p_print_bb3(void);
static Int p_print_native_basic_block(void);
static Int p_print_native_basicblock(void);
static Int p_print_native_bb(void);
static Int p_print_native_basic_block_msg_before(void);
static Int p_print_native_basicblock_msg_before(void);
static Int p_print_native_bb_msg_before(void);
static Int p_print_native_basic_block_msg_after(void);
static Int p_print_native_basicblock_msg_after(void);
static Int p_print_native_bb_msg_after(void);
static Int p_print_native_basic_block3(void);
static Int p_print_native_basicblock3(void);
static Int p_print_native_bb3(void);
static Int p_no_print_clause(void);
static Int p_print_clause(void);
static Int p_no_print_intermediate(void);
static Int p_print_intermediate(void);
static Int p_print_intermediate_to_std(void);
static Int p_print_intermediate_to_std1(void);
static Int p_print_intermediate_to_file(void);
static Int p_print_intermediate_to_file1(void);
static Int p_no_print_llva(void);
static Int p_print_llva_before(void);
static Int p_print_llva_after(void);
static Int p_no_print_me(void);
static Int p_print_me(void);
static Int p_default_debug(void);
static Int p_print_default_predicate_msgs(void);
static Int p_print_all_predicate_msgs(void);
static Int p_print_info_predicate_msgs(void);
static Int p_print_success_predicate_msgs(void);
static Int p_print_warning_predicate_msgs(void);
static Int p_print_error_predicate_msgs(void);
static Int p_no_print_all_predicate_msgs(void);
static Int p_no_print_info_predicate_msgs(void);
static Int p_no_print_success_predicate_msgs(void);
static Int p_no_print_warning_predicate_msgs(void);
static Int p_no_print_error_predicate_msgs(void);
static Int p_print_predicate_msgs(void);
static Int p_exit_on_warning(void);
static Int p_disable_on_warning(void);
static Int p_exit_on_error(void);
static Int p_no_exit_on_warning(void);
static Int p_enable_on_warning(void);
static Int p_no_exit_on_error(void);
static Int p_no_print_instruction( USES_REGS1 );
static Int p_no_print_basic_instruction( USES_REGS1 );
static Int p_no_print_std_instruction( USES_REGS1 );
static Int p_no_print_standard_instruction( USES_REGS1 );
static Int p_print_instruction( USES_REGS1 );
static Int p_print_basic_instruction( USES_REGS1 );
static Int p_print_std_instruction( USES_REGS1 );
static Int p_print_standard_instruction( USES_REGS1 );
static Int p_print_instruction_msg_before( USES_REGS1 );
static Int p_print_basic_instruction_msg_before( USES_REGS1 );
static Int p_print_std_instruction_msg_before( USES_REGS1 );
static Int p_print_standard_instruction_msg_before( USES_REGS1 );
static Int p_print_instruction_msg_after( USES_REGS1 );
static Int p_print_basic_instruction_msg_after( USES_REGS1 );
static Int p_print_std_instruction_msg_after( USES_REGS1 );
static Int p_print_standard_instruction_msg_after( USES_REGS1 );
static Int p_print_instruction3( USES_REGS1 );
static Int p_print_basic_instruction3( USES_REGS1 );
static Int p_print_std_instruction3( USES_REGS1 );
static Int p_print_standard_instruction3( USES_REGS1 );
static Int p_print_profiled_instruction( USES_REGS1 );
static Int p_print_traced_instruction( USES_REGS1 );
static Int p_print_pfd_instruction( USES_REGS1 );
static Int p_print_profiled_instruction_msg_before( USES_REGS1 );
static Int p_print_traced_instruction_msg_before( USES_REGS1 );
static Int p_print_pfd_instruction_msg_before( USES_REGS1 );
static Int p_print_profiled_instruction_msg_after( USES_REGS1 );
static Int p_print_traced_instruction_msg_after( USES_REGS1 );
static Int p_print_pfd_instruction_msg_after( USES_REGS1 );
static Int p_print_profiled_instruction3( USES_REGS1 );
static Int p_print_traced_instruction3( USES_REGS1 );
static Int p_print_pfd_instruction3( USES_REGS1 );
static Int p_print_native_instruction( USES_REGS1 );
static Int p_print_ntv_instruction( USES_REGS1 );
static Int p_print_native_instruction_msg_before( USES_REGS1 );
static Int p_print_ntv_instruction_msg_before( USES_REGS1 );
static Int p_print_native_instruction_msg_after( USES_REGS1 );
static Int p_print_ntv_instruction_msg_after( USES_REGS1 );
static Int p_print_native_instruction3( USES_REGS1 );
static Int p_print_ntv_instruction3( USES_REGS1 );
static Int p_no_print_basic_block( USES_REGS1 );
static Int p_no_print_basicblock( USES_REGS1 );
static Int p_no_print_bb( USES_REGS1 );
static Int p_print_basic_block( USES_REGS1 );
static Int p_print_basicblock( USES_REGS1 );
static Int p_print_bb( USES_REGS1 );
static Int p_print_basic_block_msg_before( USES_REGS1 );
static Int p_print_basicblock_msg_before( USES_REGS1 );
static Int p_print_bb_msg_before( USES_REGS1 );
static Int p_print_basic_block_msg_after( USES_REGS1 );
static Int p_print_basicblock_msg_after( USES_REGS1 );
static Int p_print_bb_msg_after( USES_REGS1 );
static Int p_print_basic_block3( USES_REGS1 );
static Int p_print_basicblock3( USES_REGS1 );
static Int p_print_bb3( USES_REGS1 );
static Int p_print_native_basic_block( USES_REGS1 );
static Int p_print_native_basicblock( USES_REGS1 );
static Int p_print_native_bb( USES_REGS1 );
static Int p_print_native_basic_block_msg_before( USES_REGS1 );
static Int p_print_native_basicblock_msg_before( USES_REGS1 );
static Int p_print_native_bb_msg_before( USES_REGS1 );
static Int p_print_native_basic_block_msg_after( USES_REGS1 );
static Int p_print_native_basicblock_msg_after( USES_REGS1 );
static Int p_print_native_bb_msg_after( USES_REGS1 );
static Int p_print_native_basic_block3( USES_REGS1 );
static Int p_print_native_basicblock3( USES_REGS1 );
static Int p_print_native_bb3( USES_REGS1 );
static Int p_no_print_clause( USES_REGS1 );
static Int p_print_clause( USES_REGS1 );
static Int p_no_print_intermediate( USES_REGS1 );
static Int p_print_intermediate( USES_REGS1 );
static Int p_print_intermediate_to_std( USES_REGS1 );
static Int p_print_intermediate_to_std1( USES_REGS1 );
static Int p_print_intermediate_to_file( USES_REGS1 );
static Int p_print_intermediate_to_file1( USES_REGS1 );
static Int p_no_print_llva( USES_REGS1 );
static Int p_print_llva_before( USES_REGS1 );
static Int p_print_llva_after( USES_REGS1 );
static Int p_no_print_me( USES_REGS1 );
static Int p_print_me( USES_REGS1 );
static Int p_default_debug( USES_REGS1 );
static Int p_print_default_predicate_msgs( USES_REGS1 );
static Int p_print_all_predicate_msgs( USES_REGS1 );
static Int p_print_info_predicate_msgs( USES_REGS1 );
static Int p_print_success_predicate_msgs( USES_REGS1 );
static Int p_print_warning_predicate_msgs( USES_REGS1 );
static Int p_print_error_predicate_msgs( USES_REGS1 );
static Int p_no_print_all_predicate_msgs( USES_REGS1 );
static Int p_no_print_info_predicate_msgs( USES_REGS1 );
static Int p_no_print_success_predicate_msgs( USES_REGS1 );
static Int p_no_print_warning_predicate_msgs( USES_REGS1 );
static Int p_no_print_error_predicate_msgs( USES_REGS1 );
static Int p_print_predicate_msgs( USES_REGS1 );
static Int p_exit_on_warning( USES_REGS1 );
static Int p_disable_on_warning( USES_REGS1 );
static Int p_exit_on_error( USES_REGS1 );
static Int p_no_exit_on_warning( USES_REGS1 );
static Int p_enable_on_warning( USES_REGS1 );
static Int p_no_exit_on_error( USES_REGS1 );
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
static Int
p_no_print_instruction(void)
p_no_print_instruction( USES_REGS1 )
{
Term t = Deref(ARG1);
if (IsPairTerm(t)) {
@ -171,25 +171,25 @@ p_no_print_instruction(void)
}
static Int
p_no_print_basic_instruction(void)
p_no_print_basic_instruction( USES_REGS1 )
{
return p_no_print_instruction();
}
static Int
p_no_print_std_instruction(void)
p_no_print_std_instruction( USES_REGS1 )
{
return p_no_print_instruction();
}
static Int
p_no_print_standard_instruction(void)
p_no_print_standard_instruction( USES_REGS1 )
{
return p_no_print_instruction();
}
static Int
p_print_instruction(void)
p_print_instruction( USES_REGS1 )
{
Term t = Deref(ARG1);
if (IsPairTerm(t)) {
@ -242,25 +242,25 @@ p_print_instruction(void)
}
static Int
p_print_basic_instruction(void)
p_print_basic_instruction( USES_REGS1 )
{
return p_print_instruction();
}
static Int
p_print_std_instruction(void)
p_print_std_instruction( USES_REGS1 )
{
return p_print_instruction();
}
static Int
p_print_standard_instruction(void)
p_print_standard_instruction( USES_REGS1 )
{
return p_print_instruction();
}
static Int
p_print_instruction_msg_before(void)
p_print_instruction_msg_before( USES_REGS1 )
{
Term t = Deref(ARG2);
char *msgb;
@ -324,25 +324,25 @@ p_print_instruction_msg_before(void)
}
static Int
p_print_basic_instruction_msg_before(void)
p_print_basic_instruction_msg_before( USES_REGS1 )
{
return p_print_instruction_msg_before();
}
static Int
p_print_std_instruction_msg_before(void)
p_print_std_instruction_msg_before( USES_REGS1 )
{
return p_print_instruction_msg_before();
}
static Int
p_print_standard_instruction_msg_before(void)
p_print_standard_instruction_msg_before( USES_REGS1 )
{
return p_print_instruction_msg_before();
}
static Int
p_print_instruction_msg_after(void)
p_print_instruction_msg_after( USES_REGS1 )
{
Term t = Deref(ARG2);
char *msga;
@ -407,25 +407,25 @@ p_print_instruction_msg_after(void)
}
static Int
p_print_basic_instruction_msg_after(void)
p_print_basic_instruction_msg_after( USES_REGS1 )
{
return p_print_instruction_msg_after();
}
static Int
p_print_std_instruction_msg_after(void)
p_print_std_instruction_msg_after( USES_REGS1 )
{
return p_print_instruction_msg_after();
}
static Int
p_print_standard_instruction_msg_after(void)
p_print_standard_instruction_msg_after( USES_REGS1 )
{
return p_print_instruction_msg_after();
}
static Int
p_print_instruction3(void)
p_print_instruction3( USES_REGS1 )
{
Term t = Deref(ARG3);
char *msga;
@ -501,25 +501,25 @@ p_print_instruction3(void)
}
static Int
p_print_basic_instruction3(void)
p_print_basic_instruction3( USES_REGS1 )
{
return p_print_instruction3();
}
static Int
p_print_std_instruction3(void)
p_print_std_instruction3( USES_REGS1 )
{
return p_print_instruction3();
}
static Int
p_print_standard_instruction3(void)
p_print_standard_instruction3( USES_REGS1 )
{
return p_print_instruction3();
}
static Int
p_print_profiled_instruction(void)
p_print_profiled_instruction( USES_REGS1 )
{
Term t = Deref(ARG1);
if (IsPairTerm(t)) {
@ -572,19 +572,19 @@ p_print_profiled_instruction(void)
}
static Int
p_print_traced_instruction(void)
p_print_traced_instruction( USES_REGS1 )
{
return p_print_profiled_instruction();
}
static Int
p_print_pfd_instruction(void)
p_print_pfd_instruction( USES_REGS1 )
{
return p_print_profiled_instruction();
}
static Int
p_print_profiled_instruction_msg_before(void)
p_print_profiled_instruction_msg_before( USES_REGS1 )
{
Term t = Deref(ARG2);
char *msgb;
@ -648,19 +648,19 @@ p_print_profiled_instruction_msg_before(void)
}
static Int
p_print_traced_instruction_msg_before(void)
p_print_traced_instruction_msg_before( USES_REGS1 )
{
return p_print_profiled_instruction_msg_before();
}
static Int
p_print_pfd_instruction_msg_before(void)
p_print_pfd_instruction_msg_before( USES_REGS1 )
{
return p_print_profiled_instruction_msg_before();
}
static Int
p_print_profiled_instruction_msg_after(void)
p_print_profiled_instruction_msg_after( USES_REGS1 )
{
Term t = Deref(ARG2);
char *msga;
@ -725,19 +725,19 @@ p_print_profiled_instruction_msg_after(void)
}
static Int
p_print_traced_instruction_msg_after(void)
p_print_traced_instruction_msg_after( USES_REGS1 )
{
return p_print_profiled_instruction_msg_after();
}
static Int
p_print_pfd_instruction_msg_after(void)
p_print_pfd_instruction_msg_after( USES_REGS1 )
{
return p_print_profiled_instruction_msg_after();
}
static Int
p_print_profiled_instruction3(void)
p_print_profiled_instruction3( USES_REGS1 )
{
Term t = Deref(ARG3);
char *msga;
@ -813,19 +813,19 @@ p_print_profiled_instruction3(void)
}
static Int
p_print_traced_instruction3(void)
p_print_traced_instruction3( USES_REGS1 )
{
return p_print_profiled_instruction3();
}
static Int
p_print_pfd_instruction3(void)
p_print_pfd_instruction3( USES_REGS1 )
{
return p_print_profiled_instruction3();
}
static Int
p_print_native_instruction(void)
p_print_native_instruction( USES_REGS1 )
{
Term t = Deref(ARG1);
if (IsPairTerm(t)) {
@ -878,13 +878,13 @@ p_print_native_instruction(void)
}
static Int
p_print_ntv_instruction(void)
p_print_ntv_instruction( USES_REGS1 )
{
return p_print_native_instruction();
}
static Int
p_print_native_instruction_msg_before(void)
p_print_native_instruction_msg_before( USES_REGS1 )
{
Term t = Deref(ARG2);
char *msgb;
@ -948,13 +948,13 @@ p_print_native_instruction_msg_before(void)
}
static Int
p_print_ntv_instruction_msg_before(void)
p_print_ntv_instruction_msg_before( USES_REGS1 )
{
return p_print_native_instruction_msg_before();
}
static Int
p_print_native_instruction_msg_after(void)
p_print_native_instruction_msg_after( USES_REGS1 )
{
Term t = Deref(ARG2);
char *msga;
@ -1019,13 +1019,13 @@ p_print_native_instruction_msg_after(void)
}
static Int
p_print_ntv_instruction_msg_after(void)
p_print_ntv_instruction_msg_after( USES_REGS1 )
{
return p_print_native_instruction_msg_after();
}
static Int
p_print_native_instruction3(void)
p_print_native_instruction3( USES_REGS1 )
{
Term t = Deref(ARG3);
char *msga;
@ -1101,13 +1101,13 @@ p_print_native_instruction3(void)
}
static Int
p_print_ntv_instruction3(void)
p_print_ntv_instruction3( USES_REGS1 )
{
return p_print_native_instruction3();
}
static Int
p_no_print_basic_block(void)
p_no_print_basic_block( USES_REGS1 )
{
Term t = Deref(ARG1);
if (IsPairTerm(t)) {
@ -1157,19 +1157,19 @@ p_no_print_basic_block(void)
}
static Int
p_no_print_basicblock(void)
p_no_print_basicblock( USES_REGS1 )
{
return p_no_print_basic_block();
}
static Int
p_no_print_bb(void)
p_no_print_bb( USES_REGS1 )
{
return p_no_print_basic_block();
}
static Int
p_print_basic_block(void)
p_print_basic_block( USES_REGS1 )
{
Term t = Deref(ARG1);
if (IsPairTerm(t)) {
@ -1222,19 +1222,19 @@ p_print_basic_block(void)
}
static Int
p_print_basicblock(void)
p_print_basicblock( USES_REGS1 )
{
return p_print_basic_block();
}
static Int
p_print_bb(void)
p_print_bb( USES_REGS1 )
{
return p_print_basic_block();
}
static Int
p_print_basic_block_msg_before(void)
p_print_basic_block_msg_before( USES_REGS1 )
{
Term t = Deref(ARG2);
char *msgb;
@ -1298,19 +1298,19 @@ p_print_basic_block_msg_before(void)
}
static Int
p_print_basicblock_msg_before(void)
p_print_basicblock_msg_before( USES_REGS1 )
{
return p_print_basic_block_msg_before();
}
static Int
p_print_bb_msg_before(void)
p_print_bb_msg_before( USES_REGS1 )
{
return p_print_basic_block_msg_before();
}
static Int
p_print_basic_block_msg_after(void)
p_print_basic_block_msg_after( USES_REGS1 )
{
Term t = Deref(ARG2);
char *msga;
@ -1374,19 +1374,19 @@ p_print_basic_block_msg_after(void)
}
static Int
p_print_basicblock_msg_after(void)
p_print_basicblock_msg_after( USES_REGS1 )
{
return p_print_basic_block_msg_after();
}
static Int
p_print_bb_msg_after(void)
p_print_bb_msg_after( USES_REGS1 )
{
return p_print_basic_block_msg_after();
}
static Int
p_print_basic_block3(void)
p_print_basic_block3( USES_REGS1 )
{
Term t = Deref(ARG3);
char *msga;
@ -1461,19 +1461,19 @@ p_print_basic_block3(void)
}
static Int
p_print_basicblock3(void)
p_print_basicblock3( USES_REGS1 )
{
return p_print_basic_block3();
}
static Int
p_print_bb3(void)
p_print_bb3( USES_REGS1 )
{
return p_print_basic_block3();
}
static Int
p_print_native_basic_block(void)
p_print_native_basic_block( USES_REGS1 )
{
Term t = Deref(ARG1);
if (IsAtomTerm(t)) {
@ -1549,19 +1549,19 @@ p_print_native_basic_block(void)
}
static Int
p_print_native_basicblock(void)
p_print_native_basicblock( USES_REGS1 )
{
return p_print_native_basic_block();
}
static Int
p_print_native_bb(void)
p_print_native_bb( USES_REGS1 )
{
return p_print_native_basic_block();
}
static Int
p_print_native_basic_block_msg_before(void)
p_print_native_basic_block_msg_before( USES_REGS1 )
{
Term t = Deref(ARG2);
char *msgb;
@ -1625,19 +1625,19 @@ p_print_native_basic_block_msg_before(void)
}
static Int
p_print_native_basicblock_msg_before(void)
p_print_native_basicblock_msg_before( USES_REGS1 )
{
return p_print_native_basic_block_msg_before();
}
static Int
p_print_native_bb_msg_before(void)
p_print_native_bb_msg_before( USES_REGS1 )
{
return p_print_native_basic_block_msg_before();
}
static Int
p_print_native_basic_block_msg_after(void)
p_print_native_basic_block_msg_after( USES_REGS1 )
{
Term t = Deref(ARG2);
char *msga;
@ -1701,19 +1701,19 @@ p_print_native_basic_block_msg_after(void)
}
static Int
p_print_native_basicblock_msg_after(void)
p_print_native_basicblock_msg_after( USES_REGS1 )
{
return p_print_native_basic_block_msg_after();
}
static Int
p_print_native_bb_msg_after(void)
p_print_native_bb_msg_after( USES_REGS1 )
{
return p_print_native_basic_block_msg_after();
}
static Int
p_print_native_basic_block3(void)
p_print_native_basic_block3( USES_REGS1 )
{
Term t = Deref(ARG3);
char *msga;
@ -1788,19 +1788,19 @@ p_print_native_basic_block3(void)
}
static Int
p_print_native_basicblock3(void)
p_print_native_basicblock3( USES_REGS1 )
{
return p_print_native_basic_block3();
}
static Int
p_print_native_bb3(void)
p_print_native_bb3( USES_REGS1 )
{
return p_print_native_basic_block3();
}
static Int
p_no_print_clause(void)
p_no_print_clause( USES_REGS1 )
{
if (ExpEnv.debug_struc.pmainclause_on_head.msg_before) free((char*)ExpEnv.debug_struc.pmainclause_on_head.msg_before);
if (ExpEnv.debug_struc.pmainclause_on_head.msg_after) free((char*)ExpEnv.debug_struc.pmainclause_on_head.msg_after);
@ -1811,7 +1811,7 @@ p_no_print_clause(void)
}
static Int
p_print_clause(void)
p_print_clause( USES_REGS1 )
{
Term t = Deref(ARG1);
if (IsPairTerm(t)) {
@ -1878,7 +1878,7 @@ p_print_clause(void)
}
static Int
p_no_print_intermediate(void)
p_no_print_intermediate( USES_REGS1 )
{
if (ExpEnv.debug_struc.pprint_intermediate.std_name) free((char*)ExpEnv.debug_struc.pprint_intermediate.std_name);
if (ExpEnv.debug_struc.pprint_intermediate.file_name) free((char*)ExpEnv.debug_struc.pprint_intermediate.file_name);
@ -1890,7 +1890,7 @@ p_no_print_intermediate(void)
}
static Int
p_print_intermediate(void)
p_print_intermediate( USES_REGS1 )
{
ExpEnv.debug_struc.pprint_intermediate.print_to_std = 1;
ExpEnv.debug_struc.pprint_intermediate.std_name = (CELL)malloc(7*sizeof(char));
@ -1899,7 +1899,7 @@ p_print_intermediate(void)
}
static Int
p_print_intermediate_to_std(void)
p_print_intermediate_to_std( USES_REGS1 )
{
ExpEnv.debug_struc.pprint_intermediate.print_to_std = 1;
ExpEnv.debug_struc.pprint_intermediate.std_name = (CELL)malloc(7*sizeof(char));
@ -1908,7 +1908,7 @@ p_print_intermediate_to_std(void)
}
static Int
p_print_intermediate_to_std1(void)
p_print_intermediate_to_std1( USES_REGS1 )
{
Term t = Deref(ARG1);
if (IsAtomTerm(t)) {
@ -1933,7 +1933,7 @@ p_print_intermediate_to_std1(void)
}
static Int
p_print_intermediate_to_file(void)
p_print_intermediate_to_file( USES_REGS1 )
{
ExpEnv.debug_struc.pprint_intermediate.print_to_file = 1;
ExpEnv.debug_struc.pprint_intermediate.file_name = (CELL)malloc(7*sizeof(char));
@ -1945,7 +1945,7 @@ p_print_intermediate_to_file(void)
}
static Int
p_print_intermediate_to_file1(void)
p_print_intermediate_to_file1( USES_REGS1 )
{
Term t = Deref(ARG1);
if (IsAtomTerm(t)) {
@ -1963,7 +1963,7 @@ p_print_intermediate_to_file1(void)
}
static Int
p_no_print_llva(void)
p_no_print_llva( USES_REGS1 )
{
ExpEnv.debug_struc.pprint_llva.print_llva_before = 0;
ExpEnv.debug_struc.pprint_llva.print_llva_after = 0;
@ -1971,21 +1971,21 @@ p_no_print_llva(void)
}
static Int
p_print_llva_before(void)
p_print_llva_before( USES_REGS1 )
{
ExpEnv.debug_struc.pprint_llva.print_llva_before = 1;
return TRUE;
}
static Int
p_print_llva_after(void)
p_print_llva_after( USES_REGS1 )
{
ExpEnv.debug_struc.pprint_llva.print_llva_after = 1;
return TRUE;
}
static Int
p_no_print_me(void)
p_no_print_me( USES_REGS1 )
{
Term t = Deref(ARG1);
if (IsAtomTerm(t)) {
@ -2037,7 +2037,7 @@ p_no_print_me(void)
}
static Int
p_print_me(void)
p_print_me( USES_REGS1 )
{
Term t = Deref(ARG2);
char *msg;
@ -2127,7 +2127,7 @@ p_print_me(void)
}
static Int
p_default_debug(void)
p_default_debug( USES_REGS1 )
{
#define OPCODE(OP,TYPE) \
ExpEnv.debug_struc.pyaam_##OP.print = (Int)NO_PLACE; \
@ -2182,7 +2182,7 @@ p_default_debug(void)
}
static Int
p_print_default_predicate_msgs(void)
p_print_default_predicate_msgs( USES_REGS1 )
{
ExpEnv.debug_struc.act_predicate_msgs.info_msgs = 0;
ExpEnv.debug_struc.act_predicate_msgs.success_msgs = 0;
@ -2192,7 +2192,7 @@ p_print_default_predicate_msgs(void)
}
static Int
p_print_all_predicate_msgs(void)
p_print_all_predicate_msgs( USES_REGS1 )
{
ExpEnv.debug_struc.act_predicate_msgs.info_msgs = 1;
ExpEnv.debug_struc.act_predicate_msgs.success_msgs = 1;
@ -2202,35 +2202,35 @@ p_print_all_predicate_msgs(void)
}
static Int
p_print_info_predicate_msgs(void)
p_print_info_predicate_msgs( USES_REGS1 )
{
ExpEnv.debug_struc.act_predicate_msgs.info_msgs = 1;
return TRUE;
}
static Int
p_print_success_predicate_msgs(void)
p_print_success_predicate_msgs( USES_REGS1 )
{
ExpEnv.debug_struc.act_predicate_msgs.success_msgs = 1;
return TRUE;
}
static Int
p_print_warning_predicate_msgs(void)
p_print_warning_predicate_msgs( USES_REGS1 )
{
ExpEnv.debug_struc.act_predicate_msgs.warning_msgs = 1;
return TRUE;
}
static Int
p_print_error_predicate_msgs(void)
p_print_error_predicate_msgs( USES_REGS1 )
{
ExpEnv.debug_struc.act_predicate_msgs.error_msgs = 1;
return TRUE;
}
static Int
p_no_print_all_predicate_msgs(void)
p_no_print_all_predicate_msgs( USES_REGS1 )
{
ExpEnv.debug_struc.act_predicate_msgs.info_msgs = 0;
ExpEnv.debug_struc.act_predicate_msgs.success_msgs = 0;
@ -2240,35 +2240,35 @@ p_no_print_all_predicate_msgs(void)
}
static Int
p_no_print_info_predicate_msgs(void)
p_no_print_info_predicate_msgs( USES_REGS1 )
{
ExpEnv.debug_struc.act_predicate_msgs.info_msgs = 0;
return TRUE;
}
static Int
p_no_print_success_predicate_msgs(void)
p_no_print_success_predicate_msgs( USES_REGS1 )
{
ExpEnv.debug_struc.act_predicate_msgs.success_msgs = 0;
return TRUE;
}
static Int
p_no_print_warning_predicate_msgs(void)
p_no_print_warning_predicate_msgs( USES_REGS1 )
{
ExpEnv.debug_struc.act_predicate_msgs.warning_msgs = 0;
return TRUE;
}
static Int
p_no_print_error_predicate_msgs(void)
p_no_print_error_predicate_msgs( USES_REGS1 )
{
ExpEnv.debug_struc.act_predicate_msgs.error_msgs = 0;
return TRUE;
}
static Int
p_print_predicate_msgs(void)
p_print_predicate_msgs( USES_REGS1 )
{
int i = 0, j = 0;
char *tmp;
@ -2328,42 +2328,42 @@ p_print_predicate_msgs(void)
}
static Int
p_exit_on_warning(void)
p_exit_on_warning( USES_REGS1 )
{
ExpEnv.debug_struc.act_predicate_actions.exit_on_warning = 1;
return TRUE;
}
static Int
p_disable_on_warning(void)
p_disable_on_warning( USES_REGS1 )
{
ExpEnv.debug_struc.act_predicate_actions.disable_on_warning = 1;
return TRUE;
}
static Int
p_exit_on_error(void)
p_exit_on_error( USES_REGS1 )
{
ExpEnv.debug_struc.act_predicate_actions.exit_on_error = 1;
return TRUE;
}
static Int
p_no_exit_on_warning(void)
p_no_exit_on_warning( USES_REGS1 )
{
ExpEnv.debug_struc.act_predicate_actions.exit_on_warning = 0;
return TRUE;
}
static Int
p_enable_on_warning(void)
p_enable_on_warning( USES_REGS1 )
{
ExpEnv.debug_struc.act_predicate_actions.disable_on_warning = 0;
return TRUE;
}
static Int
p_no_exit_on_error(void)
p_no_exit_on_error( USES_REGS1 )
{
ExpEnv.debug_struc.act_predicate_actions.exit_on_error = 0;
return TRUE;

View File

@ -18,14 +18,14 @@
#include "jit_predicates.hh"
#include <papi.h>
static Int p_init_low_level_stats(void);
static Int p_statistics_jit(void);
static Int p_init_low_level_stats( USES_REGS1 );
static Int p_statistics_jit( USES_REGS1 );
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
static Int
p_init_low_level_stats(void)
p_init_low_level_stats( USES_REGS1 )
{
int i = 0, j = 0;
char *tmp;
@ -514,7 +514,7 @@ p_init_low_level_stats(void)
}
static Int
p_statistics_jit(void)
p_statistics_jit( USES_REGS1 )
{
if (NativeArea && NativeArea->n) { // This exp will be true only if JIT Compiler was used
// printing...

View File

@ -15,51 +15,51 @@
* Last rev: 2013-10-18 *
*************************************************************************/
#include "jit_predicates.hh"
#include "jit_predicates.hpp"
#define N_TRANSFORM_PASSES 69
// Disable one (passed by argument) LLVM transform pass
static Int p_disable_transform_pass(void);
static Int p_disable_transform_pass( USES_REGS1 );
// Enable one (passed by argument) LLVM transform pass
static Int p_transform_pass(void);
static Int p_transform_pass( USES_REGS1 );
// Enable one (passed by argument) LLVM transform pass
static Int p_enable_transform_pass(void);
static Int p_enable_transform_pass( USES_REGS1 );
// Enable a list (passed by argument) of LLVM transform passes
static Int p_transform_passes(void);
static Int p_transform_passes( USES_REGS1 );
// Enable all available LLVM transform passes
static Int p_enable_all_transform_passes(void);
static Int p_enable_all_transform_passes( USES_REGS1 );
// Disable all available LLVM transform passes
static Int p_disable_all_transform_passes(void);
static Int p_disable_all_transform_passes( USES_REGS1 );
// Enable n LLVM transform passes (randomly)
static Int p_n_transform_passes(void);
static Int p_n_transform_passes( USES_REGS1 );
// Enable a transform level
static Int p_transform_level(void);
static Int p_transform_level( USES_REGS1 );
// Max element of Argument Promotion Pass
static Int p_argument_promotion_max_elements(void);
static Int p_argument_promotion_max_elements( USES_REGS1 );
// Threshold of Scalar Repl Aggregates Pass
static Int p_scalar_replace_aggregates_threshold(void);
static Int p_scalar_replace_aggregates_threshold( USES_REGS1 );
// Threshold of Loop Unroll Pass
static Int p_loop_unroll_threshold(void);
static Int p_loop_unroll_threshold( USES_REGS1 );
// Threshold of Function Inlining Pass
static Int p_inline_threshold(void);
static Int p_inline_threshold( USES_REGS1 );
// Eliminates (or not) only debugging information on Strip Symbols Pass
static Int p_strip_symbols_pass_type(void);
static Int p_strip_symbols_pass_type( USES_REGS1 );
// Optimizes (or not) for size on Loop Unswitch Pass
static Int p_loop_unswitch_optimize_for_size(void);
static Int p_loop_unswitch_optimize_for_size( USES_REGS1 );
/*
* Default value of 'max elements on Argument Promotion Pass *
@ -69,25 +69,25 @@ static Int p_loop_unswitch_optimize_for_size(void);
* 'Strip Symbols Pass *
* 'Loop Unswitch Pass *
*/
static Int p_default_optimization_args(void);
static Int p_default_optimization_args( USES_REGS1 );
// Same as 'p_default_optimization_args'
static Int p_reset_optimization_args(void);
static Int p_reset_optimization_args( USES_REGS1 );
// Enable IPO by LLVM
static Int p_enable_unit_at_time(void);
static Int p_enable_unit_at_time( USES_REGS1 );
// Enable libcalls simplification by LLVM
static Int p_enable_simplify_libcalls(void);
static Int p_enable_simplify_libcalls( USES_REGS1 );
// Disable IPO by LLVM
static Int p_disable_unit_at_time(void);
static Int p_disable_unit_at_time( USES_REGS1 );
// Disable libcalls simplification by LLVM
static Int p_disable_simplify_libcalls(void);
static Int p_disable_simplify_libcalls( USES_REGS1 );
// Enable (or not) link-time optimization
static Int p_link_time_opt1(void);
static Int p_link_time_opt1( USES_REGS1 );
/*
* Same as 'p_link_time_opt1', but accepts 3 arguments: *
@ -95,26 +95,26 @@ static Int p_link_time_opt1(void);
* 2 -- Should I run internalize? *
* 3 -- Should I run inliner? *
*/
static Int p_link_time_opt3(void);
static Int p_link_time_opt3( USES_REGS1 );
// Enable link-time optimization. Same as 'link_time_opt(true)'
static Int p_enable_link_time_opt(void);
static Int p_enable_link_time_opt( USES_REGS1 );
/*
* Same as 'p_enable_link_time_opt', but accepts 2 arguments: *
* 1 -- Should I run internalize? *
* 2 -- Should I run inliner? *
*/
static Int p_enable_link_time_opt2(void);
static Int p_enable_link_time_opt2( USES_REGS1 );
// Disable link-time optimization.
static Int p_disable_link_time_opt(void);
static Int p_disable_link_time_opt( USES_REGS1 );
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
static Int
p_disable_transform_pass(void)
p_disable_transform_pass( USES_REGS1 )
{
// First: stores what transform pass should be disabled
@ -250,10 +250,10 @@ p_disable_transform_pass(void)
}
static Int
p_transform_pass(void)
p_transform_pass( USES_REGS1 )
{
// First: disables analysis pass (if be active)
p_disable_transform_pass();
p_disable_transform_pass( PASS_REGS1 );
// Second: valids argument and inserts new transform pass
// valid values for ARG1 are 'integer' and 'atom'
@ -375,13 +375,13 @@ p_transform_pass(void)
}
static Int
p_enable_transform_pass(void)
p_enable_transform_pass( USES_REGS1 )
{
return p_transform_pass();
return p_transform_pass( PASS_REGS1 );
}
static Int
p_transform_passes(void)
p_transform_passes( USES_REGS1 )
{
int i = 0, j = 0;
char *tmp;
@ -557,7 +557,7 @@ p_transform_passes(void)
}
static Int
p_enable_all_transform_passes(void)
p_enable_all_transform_passes( USES_REGS1 )
{
// Same as 'transform_passes(all)'
// First, disable all analysis passes
@ -577,7 +577,7 @@ p_enable_all_transform_passes(void)
}
static Int
p_disable_all_transform_passes(void)
p_disable_all_transform_passes( USES_REGS1 )
{
// Just empty 'ExpEnv.analysis_struc.act_tr'
if (ExpEnv.transform_struc.act_tr) free(ExpEnv.transform_struc.act_tr);
@ -587,7 +587,7 @@ p_disable_all_transform_passes(void)
}
static Int
p_n_transform_passes(void)
p_n_transform_passes( USES_REGS1 )
{
// valid value for ARG1 is just 'integer' (number of transform passes added randomly)
Term t = Deref(ARG1);
@ -651,7 +651,7 @@ p_n_transform_passes(void)
}
static Int
p_transform_level(void)
p_transform_level( USES_REGS1 )
{
Term t = Deref(ARG1);
// valid value for ARG1 is just 'integer'
@ -682,7 +682,7 @@ p_transform_level(void)
}
static Int
p_argument_promotion_max_elements(void)
p_argument_promotion_max_elements( USES_REGS1 )
{
Term t = Deref(ARG1);
// valid value for ARG1 is just 'integer'
@ -710,7 +710,7 @@ p_argument_promotion_max_elements(void)
}
static Int
p_scalar_replace_aggregates_threshold(void)
p_scalar_replace_aggregates_threshold( USES_REGS1 )
{
Term t = Deref(ARG1);
// valid value for ARG1 is just 'integer'
@ -734,7 +734,7 @@ p_scalar_replace_aggregates_threshold(void)
}
static Int
p_loop_unroll_threshold(void)
p_loop_unroll_threshold( USES_REGS1 )
{
Term t = Deref(ARG1);
// valid value for ARG1 is just 'integer'
@ -758,7 +758,7 @@ p_loop_unroll_threshold(void)
}
static Int
p_inline_threshold(void)
p_inline_threshold( USES_REGS1 )
{
Term t = Deref(ARG1);
// valid value for ARG1 is just 'integer'
@ -782,7 +782,7 @@ p_inline_threshold(void)
}
static Int
p_strip_symbols_pass_type(void)
p_strip_symbols_pass_type( USES_REGS1 )
{
Term t = Deref(ARG1);
// valid values for ARG1 are 'integer' and 'atom'
@ -820,7 +820,7 @@ p_strip_symbols_pass_type(void)
}
static Int
p_loop_unswitch_optimize_for_size(void)
p_loop_unswitch_optimize_for_size( USES_REGS1 )
{
Term t = Deref(ARG1);
// valid values for ARG1 are 'integer' and 'atom'
@ -858,7 +858,7 @@ p_loop_unswitch_optimize_for_size(void)
}
static Int
p_default_optimization_args(void)
p_default_optimization_args( USES_REGS1 )
{
/* resetting arguments used in some passes */
ExpEnv.transform_struc.opt_args.arg_promotion_max_elements = 3; // Argument Promotion Pass
@ -886,15 +886,15 @@ p_default_optimization_args(void)
}
static Int
p_reset_optimization_args(void)
p_reset_optimization_args( USES_REGS1 )
{
// Same as 'p_default_optimization_args'
p_default_optimization_args();
p_default_optimization_args( PASS_REGS1 );
return TRUE;
}
static Int
p_enable_unit_at_time(void)
p_enable_unit_at_time( USES_REGS1 )
{
// Enable IPO
ExpEnv.transform_struc.unit_at_time_enabled = 1;
@ -902,7 +902,7 @@ p_enable_unit_at_time(void)
}
static Int
p_enable_simplify_libcalls(void)
p_enable_simplify_libcalls( USES_REGS1 )
{
// Enable libcalls simplification
ExpEnv.transform_struc.simplify_libcalls_enabled = 1;
@ -910,7 +910,7 @@ p_enable_simplify_libcalls(void)
}
static Int
p_disable_unit_at_time(void)
p_disable_unit_at_time( USES_REGS1 )
{
// Disable IPO
ExpEnv.transform_struc.unit_at_time_enabled = 0;
@ -918,7 +918,7 @@ p_disable_unit_at_time(void)
}
static Int
p_disable_simplify_libcalls(void)
p_disable_simplify_libcalls( USES_REGS1 )
{
// Disable libcalls simplification
ExpEnv.transform_struc.simplify_libcalls_enabled = 0;
@ -926,7 +926,7 @@ p_disable_simplify_libcalls(void)
}
static Int
p_link_time_opt1(void)
p_link_time_opt1( USES_REGS1 )
{
Term t = Deref(ARG1);
// valid value for ARG1 are 'integer' and 'atom'
@ -976,7 +976,7 @@ p_link_time_opt1(void)
}
static Int
p_link_time_opt3(void)
p_link_time_opt3( USES_REGS1 )
{
Term t = Deref(ARG1);
// valid value for ARG1 are 'integer' and 'atom'
@ -1085,7 +1085,7 @@ p_link_time_opt3(void)
}
static Int
p_enable_link_time_opt(void)
p_enable_link_time_opt( USES_REGS1 )
{
// Same as 'link_time_opt(true)'
ExpEnv.transform_struc.link_time_opt.enabled = 1;
@ -1095,7 +1095,7 @@ p_enable_link_time_opt(void)
}
static Int
p_enable_link_time_opt2(void)
p_enable_link_time_opt2( USES_REGS1 )
{
Term t = Deref(ARG1);
// valid value for ARG1 are 'integer' and 'atom'
@ -1172,7 +1172,7 @@ p_enable_link_time_opt2(void)
}
static Int
p_disable_link_time_opt(void)
p_disable_link_time_opt( USES_REGS1 )
{
ExpEnv.transform_struc.link_time_opt.enabled = 0;
ExpEnv.transform_struc.link_time_opt.internalize = 0;
@ -1183,7 +1183,7 @@ p_disable_link_time_opt(void)
#pragma GCC diagnostic pop
void
Yap_InitJitTransformPreds(void)
Yap_InitJitTransformPreds( void )
{
Yap_InitCPred("disable_transform_pass", 1, p_disable_transform_pass, SafePredFlag);
Yap_InitCPred("transform_pass", 1, p_transform_pass, SafePredFlag);

243
configure vendored
View File

@ -711,7 +711,6 @@ RFC2045_CFLAGS
RFC2045CHARSET
rfc822includedir
CLANG
LLVM
PAPILIB
JITCODEGENPREDS
JITTRANSFORMPREDS
@ -723,6 +722,7 @@ JITDEBUGPREDS
JITLIBS
JITLD
JITFLAGS
LLVM_CONFIG
MYDDAS_LIBS
PKG_MYDDAS
EXTRA_LIBS_FOR_SWIDLLS
@ -940,7 +940,8 @@ CPPFLAGS
CPP
CXX
CXXFLAGS
CCC'
CCC
LLVM_CONFIG'
# Initialize some variables set by options.
@ -1629,6 +1630,7 @@ Some influential environment variables:
CPP C preprocessor
CXX C++ compiler command
CXXFLAGS C++ compiler flags
LLVM_CONFIG full path to llvm-config program
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@ -10699,6 +10701,9 @@ fi
@ -10728,16 +10733,18 @@ fi
if test "$yap_jit" = "yes"
then
# Extract the first word of "llvm-config", so it can be a program name with args.
set dummy llvm-config; ac_word=$2
#assumes we have r on path
for ac_prog in llvm-config
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_LLVM+:} false; then :
if ${ac_cv_prog_LLVM_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$LLVM"; then
ac_cv_prog_LLVM="$LLVM" # Let the user override the test.
if test -n "$LLVM_CONFIG"; then
ac_cv_prog_LLVM_CONFIG="$LLVM_CONFIG" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
@ -10746,7 +10753,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_LLVM="yes"
ac_cv_prog_LLVM_CONFIG="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@ -10754,33 +10761,26 @@ done
done
IFS=$as_save_IFS
test -z "$ac_cv_prog_LLVM" && ac_cv_prog_LLVM="no"
fi
fi
LLVM=$ac_cv_prog_LLVM
if test -n "$LLVM"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLVM" >&5
$as_echo "$LLVM" >&6; }
LLVM_CONFIG=$ac_cv_prog_LLVM_CONFIG
if test -n "$LLVM_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLVM_CONFIG" >&5
$as_echo "$LLVM_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$LLVM_CONFIG" && break
done
test -n "$LLVM_CONFIG" || LLVM_CONFIG=""no" "
if test "$LLVM" = "no" ;then
as_fn_error $? "--enable-jit was given, but test for LLVM 3.5 failed" "$LINENO" 5
else
LLVM_VERSION="`llvm-config --version`"
if test "$LLVM_VERSION" != "3.5.0";then
as_fn_error $? "Test for LLVM 3.5 failed" "$LINENO" 5
fi
fi
# Extract the first word of "clang", so it can be a program name with args.
set dummy clang; ac_word=$2
for ac_prog in clang
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CLANG+:} false; then :
@ -10796,7 +10796,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CLANG="yes"
ac_cv_prog_CLANG="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@ -10804,7 +10804,6 @@ done
done
IFS=$as_save_IFS
test -z "$ac_cv_prog_CLANG" && ac_cv_prog_CLANG="no"
fi
fi
CLANG=$ac_cv_prog_CLANG
@ -10817,60 +10816,163 @@ $as_echo "no" >&6; }
fi
test -n "$CLANG" && break
done
test -n "$CLANG" || CLANG="no "
if test "$CLANG" = "no" ;then
as_fn_error $? "--enable-jit was given, but test for clang faild" "$LINENO" 5
elif test "$yap_jit" = "no"
then
LLVM_CONFIG=
CLANG=no
else
# Extract the first word of "llvm-config ", so it can be a program name with args.
set dummy llvm-config ; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_LLVM_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $LLVM_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_LLVM_CONFIG="$LLVM_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in "$yap_jit"/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_LLVM_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_LLVM_CONFIG" && ac_cv_path_LLVM_CONFIG=""no""
;;
esac
fi
LLVM_CONFIG=$ac_cv_path_LLVM_CONFIG
if test -n "$LLVM_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLVM_CONFIG" >&5
$as_echo "$LLVM_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
# Extract the first word of "clang", so it can be a program name with args.
set dummy clang; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_CLANG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CLANG in
[\\/]* | ?:[\\/]*)
ac_cv_path_CLANG="$CLANG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in "$yap_jit"/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_CLANG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_CLANG" && ac_cv_path_CLANG=""no""
;;
esac
fi
CLANG=$ac_cv_path_CLANG
if test -n "$CLANG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CLANG" >&5
$as_echo "$CLANG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
YAP_EXTRAS="$YAP_EXTRAS -DYAP_JIT=1"
JITCOMPILER="JIT_Compiler.o"
JITCONFIGPREDS="jit_configpreds.o"
JITANALYSISPREDS="jit_analysispreds.o"
JITTRANSFORMPREDS="jit_transformpreds.o"
JITCODEGENPREDS="jit_codegenpreds.o"
JITFLAGS="`llvm-config --cxxflags`"
JITLD="`llvm-config --ldflags`"
JITLIBS="`llvm-config --libs all` -pthread -lffi -lz"
fi
if test "$dbg_preds" = "yes"
then
if test x"$LLVM_CONFIG" != x ;then
#nothing
if test x"$LLVM_CONFIG" = x"no" ;then
as_fn_error $? "--enable-jit was given, but test for LLVM 3.5 failed" "$LINENO" 5
else
LLVM_VERSION="`$LLVM_CONFIG --version`"
if test "$LLVM_VERSION" != "3.5.0";then
as_fn_error $? "Test for LLVM 3.5 failed" "$LINENO" 5
fi
if test "$yap_jit" = "no"
then
if test "$CLANG" = "no" ;then
as_fn_error $? "--enable-jit was given, but test for clang faild" "$LINENO" 5
fi
as_fn_error $? "--enable-debug-predicates was given, but --enable-jit was not given" "$LINENO" 5
YAP_EXTRAS="$YAP_EXTRAS -DYAP_JIT=1"
JITCOMPILER="JIT_Compiler.o"
JITCONFIGPREDS="jit_configpreds.o"
JITANALYSISPREDS="jit_analysispreds.o"
JITTRANSFORMPREDS="jit_transformpreds.o"
JITCODEGENPREDS="jit_codegenpreds.o"
JITFLAGS="`$LLVM_CONFIG --cxxflags`"
JITLD="`$LLVM_CONFIG --ldflags`"
JITLIBS="`$LLVM_CONFIG --libs all` -pthread -lffi -lz"
fi
YAP_EXTRAS="$YAP_EXTRAS -DYAP_DBG_PREDS=1"
JITDEBUGPREDS="jit_debugpreds.o"
fi
fi
if test "$stat_preds" = "yes"
then
if test x"$dbg_preds" = x"yes"
then
if test "$yap_jit" = "no"
then
if test "$yap_jit" = "no"
then
as_fn_error $? "--enable-statistic-predicates was given, but --enable-jit was not given" "$LINENO" 5
as_fn_error $? "--enable-debug-predicates was given, but --enable-jit was not given" "$LINENO" 5
fi
fi
ac_fn_c_check_header_mongrel "$LINENO" "papi.h" "ac_cv_header_papi_h" "$ac_includes_default"
YAP_EXTRAS="$YAP_EXTRAS -DYAP_DBG_PREDS=1"
JITDEBUGPREDS="jit_debugpreds.o"
fi
if test x"$stat_preds" = x"yes"
then
if test "$yap_jit" = "no"
then
as_fn_error $? "--enable-statistic-predicates was given, but --enable-jit was not given" "$LINENO" 5
fi
ac_fn_c_check_header_mongrel "$LINENO" "papi.h" "ac_cv_header_papi_h" "$ac_includes_default"
if test "x$ac_cv_header_papi_h" = xyes; then :
else
if test "$stat_preds" != "no"; then
as_fn_error $? "--enable-statistic-predicates was given, but papi.h not found" "$LINENO" 5
fi
as_fn_error $? "--enable-statistic-predicates was given, but papi.h not found" "$LINENO" 5
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PAPI_start in -lpapi" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PAPI_start in -lpapi" >&5
$as_echo_n "checking for PAPI_start in -lpapi... " >&6; }
if ${ac_cv_lib_papi_PAPI_start+:} false; then :
$as_echo_n "(cached) " >&6
@ -10908,25 +11010,24 @@ fi
$as_echo "$ac_cv_lib_papi_PAPI_start" >&6; }
if test "x$ac_cv_lib_papi_PAPI_start" = xyes; then :
if test "$stat_preds" != "no"; then
PAPILIB="-lpapi"
fi
PAPILIB="-lpapi"
fi
else
if test "$stat_preds" != "no"; then
as_fn_error $? "--enable-statistic-predicates was given, but test for papi failed" "$LINENO" 5
fi
as_fn_error $? "--enable-statistic-predicates was given, but test for papi failed" "$LINENO" 5
fi
fi
YAP_EXTRAS="$YAP_EXTRAS -DYAP_STAT_PREDS=1"
JITSTATISTICPREDS="jit_statisticpreds.o"
PAPILIB="-lpapi"
YAP_EXTRAS="$YAP_EXTRAS -DYAP_STAT_PREDS=1"
JITSTATISTICPREDS="jit_statisticpreds.o"
PAPILIB="-lpapi"
fi
if test "$PKG_CLIB" != ""
then
@ -14089,7 +14190,7 @@ else
JAVA_TEST=Test.java
CLASS_TEST=Test.class
cat << \EOF > $JAVA_TEST
/* #line 14092 "configure" */
/* #line 14193 "configure" */
public class Test {
}
EOF
@ -14265,7 +14366,7 @@ EOF
if uudecode$EXEEXT Test.uue; then
ac_cv_prog_uudecode_base64=yes
else
echo "configure: 14268: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
echo "configure: 14369: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
echo "configure: failed file was:" >&5
cat Test.uue >&5
ac_cv_prog_uudecode_base64=no
@ -14396,7 +14497,7 @@ else
JAVA_TEST=Test.java
CLASS_TEST=Test.class
cat << \EOF > $JAVA_TEST
/* #line 14399 "configure" */
/* #line 14500 "configure" */
public class Test {
}
EOF
@ -14431,7 +14532,7 @@ JAVA_TEST=Test.java
CLASS_TEST=Test.class
TEST=Test
cat << \EOF > $JAVA_TEST
/* [#]line 14434 "configure" */
/* [#]line 14535 "configure" */
public class Test {
public static void main (String args[]) {
System.exit (0);