Commit dd537609 authored by Stephan Herhut's avatar Stephan Herhut
Browse files

the dawn of user tracing

parent 5c77a7d5
......@@ -65,7 +65,7 @@ GLOBAL (int, start_token, 0)
* Version control
*/
GLOBAL (const char *, version_id, "v1.00-beta (Codename Wooden Shoes)")
GLOBAL (const char *, version_id, "v1.00-beta (Live CD Edition)")
/*
* version string
*/
......@@ -418,6 +418,7 @@ GLOBAL (const arg_encoding_t *, prf_arg_encoding, prf_arg_encoding_init)
GLOBAL (bool, print_after_break, TRUE)
GLOBAL (bool, dotrace, FALSE)
GLOBAL (bool, dousertrace, FALSE)
/*
* whether to enable the stuff tog does (-:
......
......@@ -602,6 +602,12 @@ AnalyseCommandlineSac2c (int argc, char *argv[])
}
ARGS_OPTION_END ("trace");
/*
* Options starting with uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
*/
ARGS_FLAG ("utrace", global.dousertrace = TRUE);
/*
* Options starting with vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
*/
......
......@@ -20,6 +20,9 @@ ENDPHASE (scp)
PHASE (pre, "Preprocessing SAC program", ALWAYS)
SUBPHASE (iotc, "Introducing user-tracing calls", IUTCdoIntroduceUserTraceCalls,
global.dousertrace, pre)
SUBPHASE (zgwl, "Handling zero-generator with-loops", HZGWLdoHandleZeroGeneratorWithLoops,
ALWAYS, pre)
......
......@@ -615,7 +615,10 @@ PrintRuntimeTraceOptions (void)
" s: Trace array accesses.\n"
" t: Trace multi-threading specific operations.\n"
" c: Trace runtime enviroment init/exit when\n"
" using SAC libraries in C programs.\n");
" using SAC libraries in C programs.\n"
"\n"
" -utrace\n"
" Introduce user tracing calls.");
DBUG_VOID_RETURN;
}
......
/*
* $Id$
*/
/** <!--********************************************************************-->
*
* @defgroup iutc Introduce User Trace Calls Traversal
*
* Module description goes here.
*
* @ingroup iutc
*
* @{
*
*****************************************************************************/
/** <!--********************************************************************-->
*
* @file introduce_user_tracing_calls.c
*
* Prefix: IUTC
*
*****************************************************************************/
#include "introduce_user_tracing_calls.h"
/*
* Other includes go here
*/
#include "dbug.h"
#include "traverse.h"
#include "tree_basic.h"
#include "memory.h"
/** <!--********************************************************************-->
*
* @name INFO structure
* @{
*
*****************************************************************************/
struct INFO {
node *postassign;
node *preassign;
};
/**
* A template entry in the template info structure
*/
#define INFO_POSTASSIGN(n) (n->postassign)
#define INFO_PREASSIGN(n) (n->preassign)
static info *
MakeInfo ()
{
info *result;
DBUG_ENTER ("MakeInfo");
result = MEMmalloc (sizeof (info));
INFO_POSTASSIGN (result) = NULL;
INFO_PREASSIGN (result) = NULL;
DBUG_RETURN (result);
}
static info *
FreeInfo (info *info)
{
DBUG_ENTER ("FreeInfo");
info = MEMfree (info);
DBUG_RETURN (info);
}
/** <!--********************************************************************-->
* @} <!-- INFO structure -->
*****************************************************************************/
/** <!--********************************************************************-->
*
* @name Entry functions
* @{
*
*****************************************************************************/
/** <!--********************************************************************-->
*
* @fn node *IUTCdoIntroduceUserTraceCalls( node *syntax_tree)
*
*****************************************************************************/
node *
IUTCdoIntroduceUserTraceCalls (node *syntax_tree)
{
info *info;
DBUG_ENTER ("IUTCdoIntroduceUserTraceCalls");
info = MakeInfo ();
TRAVpush (TR_iutc);
syntax_tree = TRAVdo (syntax_tree, info);
TRAVpop ();
info = FreeInfo (info);
DBUG_RETURN (syntax_tree);
}
/** <!--********************************************************************-->
* @} <!-- Entry functions -->
*****************************************************************************/
/** <!--********************************************************************-->
*
* @name Static helper funcions
* @{
*
*****************************************************************************/
/** <!--********************************************************************-->
* @} <!-- Static helper functions -->
*****************************************************************************/
/** <!--********************************************************************-->
*
* @name Traversal functions
* @{
*
*****************************************************************************/
/** <!--********************************************************************-->
*
* @fn node *IUTCfundef(node *arg_node, info *arg_info)
*
* @brief Performs a traversal of the fundef chain.
*
*****************************************************************************/
node *
IUTCfundef (node *arg_node, info *arg_info)
{
DBUG_ENTER ("IUTCfundef");
if (FUNDEF_NEXT (arg_node) != NULL) {
FUNDEF_NEXT (arg_node) = TRAVdo (FUNDEF_NEXT (arg_node), arg_info);
}
DBUG_RETURN (arg_node);
}
/** <!--********************************************************************-->
*
* @fn node *IUTClet(node *arg_node, info *arg_info)
*
* @brief Performs a traversal of the let chain.
*
*****************************************************************************/
node *
IUTClet (node *arg_node, info *arg_info)
{
DBUG_ENTER ("IUTClet");
DBUG_RETURN (arg_node);
}
/** <!--********************************************************************-->
*
* @fn node *IUTCreturn(node *arg_node, info *arg_info)
*
* @brief Performs a traversal of the return chain.
*
*****************************************************************************/
node *
IUTCreturn (node *arg_node, info *arg_info)
{
DBUG_ENTER ("IUTCreturn");
DBUG_RETURN (arg_node);
}
/** <!--********************************************************************-->
*
* @fn node *IUTCassign(node *arg_node, info *arg_info)
*
* @brief Performs a traversal of the assign chain.
*
*****************************************************************************/
node *
IUTCassign (node *arg_node, info *arg_info)
{
DBUG_ENTER ("IUTCassign");
if (ASSIGN_NEXT (arg_node) != NULL) {
ASSIGN_NEXT (arg_node) = TRAVdo (ASSIGN_NEXT (arg_node), arg_info);
}
DBUG_RETURN (arg_node);
}
/** <!--********************************************************************-->
* @} <!-- Traversal functions -->
*****************************************************************************/
/** <!--********************************************************************-->
* @} <!-- Introduce User Trace Calls -->
*****************************************************************************/
/*
* $Id$
*/
#ifndef _SAC_INTRODUCE_USER_TRACE_CALLS_H_
#define _SAC_INTRODUCE_USER_TRACE_CALLS_H_
#include "types.h"
/** <!--********************************************************************-->
*
* Introduce User Tracing Calls Traversal ( iutc_tab)
*
* Prefix: IUTC
*
*****************************************************************************/
extern node *IUTdoIntroduceUserTracingCalls (node *syntax_tree);
extern node *IUTCfundef (node *arg_node, info *arg_info);
extern node *IUTCreturn (node *arg_node, info *arg_info);
extern node *IUTClet (node *arg_node, info *arg_info);
extern node *IUTCassign (node *arg_node, info *arg_info);
#endif /* _SAC_INTRODUCE_USER_TRACE_CALLS_H_ */
......@@ -67,7 +67,7 @@ OPTIMIZE ("wlpg", wlpg, TRUE, TRUE, "with-loop partition generation")
OPTIMIZE ("cvp", cvp, TRUE, TRUE, "constant and variable propagation")
OPTIMIZE ("srf", srf, TRUE, TRUE, "static reuse / static free")
#ifndef DISABLE_PHM
OPTIMIZE ("phm", phm, TRUE, TRUE, "private heap management")
OPTIMIZE ("phm", phm, FALSE, FALSE, "private heap management")
OPTIMIZE ("aps", aps, TRUE, TRUE, "arena preselection (for PHM)")
OPTIMIZE ("dao", dao, TRUE, TRUE, "descriptor allocation opt. (for PHM)")
OPTIMIZE ("msca", msca, TRUE, TRUE, "memory size cache adjustment (for PHM)")
......
......@@ -339,6 +339,14 @@
<node name="Return" />
</travuser>
</traversal>
<traversal id="IUTC" name="Introduce User Trace Calls" default="sons" include="introduce_user_tracing_calls.h">
<travuser>
<node name="Fundef" />
<node name="Let" />
<node name="Assign" />
<node name="Return" />
</travuser>
</traversal>
<traversal id="HD" name="Handle Dots" default="sons" include="handle_dots.h">
<travuser>
<node name="SPId" />
......
......@@ -93,7 +93,8 @@ libsac2c_serialize := serialize_node serialize_attribs deserialize \
libsac2c_scanparse := sac.tab sac.lex scnprs handle_dots resolvepragma \
handle_with_loop_generators handle_with_loop_operators \
handle_zero_generator_with_loops
handle_zero_generator_with_loops \
introduce_user_tracing_calls
libsac2c_flatten := flatten lac2fun fun2lac insert_vardec \
handle_mops UndoSSATransform ToNewTypes SSATransform \
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment