at.dms.kjc.sir
Class SIRDynamicRateManager

java.lang.Object
  extended by at.dms.kjc.sir.SIRDynamicRateManager

public class SIRDynamicRateManager
extends Object

This class governs how dynamic rates are interpreted at a given point in the compiler. The idea is that compiler passes sometimes want to view dynamic rates in different ways -- for example, treating a dynamic rate as a fixed constant, as an upper bound, or as an exceptional case. This class basically encapsulates a dynamic variable, which indicates the current policy for interpreting dynamic rates everywhere in the compiler. The methods should be called (for example) from the main backend passes to specify how all dynamic rates should be interpreted for a given portion of the compiler. To make the calling convention more natural, the class exposes a stack paradigm where a stack of policies is maintained. The top-most element of the stack is always used for interpreting rates. One can change the policy by pushing on a new policy, or by popping off the old policy.


Constructor Summary
SIRDynamicRateManager()
           
 
Method Summary
static JExpression interpretRate(JExpression rate)
          For use by the rate-determining functions of the compiler.
static void popPolicy()
          Pops a policy off the stack.
static void pushConstantPolicy(int constant)
          Sets the current policy to a constant policy (returns a given for all dynamic rates).
static void pushIdentityPolicy()
          Sets the current policy to an identity policy (which returns all rates unaltered).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SIRDynamicRateManager

public SIRDynamicRateManager()
Method Detail

interpretRate

public static JExpression interpretRate(JExpression rate)
For use by the rate-determining functions of the compiler. Given an expression denoting an I/O rate, this function uses the current policy to interpret that rate.


pushIdentityPolicy

public static void pushIdentityPolicy()
Sets the current policy to an identity policy (which returns all rates unaltered). Pushes this policy onto the stack.


pushConstantPolicy

public static void pushConstantPolicy(int constant)
Sets the current policy to a constant policy (returns a given for all dynamic rates). Pushes this policy onto the stack.


popPolicy

public static void popPolicy()
Pops a policy off the stack.