From cbfbbf6996cbe3b9fe57ac2014aa7262bb6890d6 Mon Sep 17 00:00:00 2001 From: fche Date: Tue, 24 Jan 2006 17:58:02 +0000 Subject: 2006-01-24 Frank Ch. Eigler PR 2060 etc. * tapsets.cxx (visit_target_symbol): Tolerate failed resolution by letting target_symbol instance pass through to optimizer and type checker. * elaborate.cxx (semantic_pass_optimize): New family of functions and associated visitor classes. (visit_for_loop): Tolerate absent init/incr clauses. (semantic_pass): Invoke unless unoptimized (-u) option given. * main.cxx, session.h: Add support for flag. * staptree.cxx (visit_for_loop): Tolerate absent init/incr clauses. (traversing_visitor::visit_arrayindex): Visit the index expressions. (functioncall_traversing_visitor): New class. (varuse_tracking_visitor): New class. * staptree.h: Corresponding changes. * parse.cxx (parse_for_loop): Represent absent init/incr expressions with null statement pointer instead of optimized-out dummy numbers. * stap.1.in: Document optimization. * testsuite/{semko,transko}/*.stp: Added "-u" or other code to many tests to check bad code without optimizer elision. * testsuite/semok/optimize.stp: New test. * elaborate.cxx (unresolved, invalid, mismatch): Standardize error message wording. * stapfuncs.5.in: Tweak print/printf docs. * tapset/logging.stp: Remove redundant "print" auxiliary function, since it's a translator built-in. * testsuite/transok/five.stp: Extend test. * translate.cxx (emit_symbol_data): Put symbol table into a separate temporary header file, to make "-p3" output easier on the eyes. * buildrun.cxx (compile_pass): Eliminate test-mode support throughout. * main.cxx, session.h, translate.cxx: Ditto. * main.cxx (main): For last-pass=2 runs, print post-optimization ASTs. --- stap.1.in | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'stap.1.in') diff --git a/stap.1.in b/stap.1.in index d37060eb..3bc9368e 100644 --- a/stap.1.in +++ b/stap.1.in @@ -72,7 +72,7 @@ prints a list of supported options. .\" -t test mode .TP .B \-v -Verbose mode. Produces more informative output. +Verbose mode. Produce more informative output. .TP .B \-h Show help message. @@ -86,9 +86,12 @@ in order to examine the generated C code, or to reuse the compiled kernel object. .TP .B \-g -Guru mode. Enables parsing of unsafe expert-level constructs like +Guru mode. Enable parsing of unsafe expert-level constructs like embedded C. .TP +.B \-u +Unoptimized mode. Disable unused code elision during elaboration. +.TP .BI \-b Use relayfs-based bulk mode for kernel-to-user data transfer. .TP @@ -583,11 +586,11 @@ and all scripts (files named .IR *.stp ) found in a tapset directory. The directories listed with -.BR -I +.BR \-I are processed in sequence, each processed in "guru mode". For each directory, a number of subdirectories are also searched. These subdirectories are derived from the selected kernel version (the -.BR -R +.BR \-R option), in order to allow more kernel-version-specific scripts to override less specific ones. For example, for a kernel version @@ -617,6 +620,15 @@ appropriate kernel debugging information to be installed. In the associated probe handlers, target-side variables (whose names begin with "$") are found and have their run-time locations decoded. .PP +Next, all probes and functions are analyzed for optimization +opportunities, in order to remove variables, expressions, and +functions that have no useful value and no side-effect. Since this +process can hide latent code errors such as type mismatches or invalid +$target variables, it sometimes may be useful to disable the +optimizations with the +.BR \-u +option. +.PP Finally, all variable, function, parameter, array, and index types are inferred from context (literals and operators). Stopping the translator after pass 2 causes it to list all the probes, functions, -- cgit