at.dms.kjc.sir.lowering
Class SimplifyArguments
java.lang.Object
at.dms.kjc.sir.lowering.SimplifyArguments
public class SimplifyArguments
- extends Object
Re-write code so function arguments are either literal, local, field,
or array access.
This should allow us to replace min, max, abs with macros at the right type
rather than old practice of casting to float, using the float version
and casting back.
Do not extend this to arguments to print / println until there is a way
of dealing with the concatenation of implicit toString()s that occur only
in the argument to these.
- Author:
- Allyn Dimock
Method Summary |
static void |
simplify(SIRStream str)
Walk over stream simplifying arguments to function calls. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimplifyArguments
public SimplifyArguments()
simplify
public static void simplify(SIRStream str)
- Walk over stream simplifying arguments to function calls.
Rules: (1) If an expression is a complicated argument to a function
then it must be three-address coverted at the top level (so that an
expression with side effects only executes the side-effect once).
(2) If an expression contains a function call, then it needs to be
three-address converted (so that the arguments can be converted at
the correct time relative to its calling context).
- Parameters:
str
- : stream to process, munged in place.