SFE.Compiler
Class Optimizer

java.lang.Object
  extended by SFE.Compiler.Optimizer

public class Optimizer
extends java.lang.Object

Optimizer holds all the data structures needed for the optimization process.


Constructor Summary
Optimizer()
           
 
Method Summary
static void addGate(OperationExpression gate, LvalExpression holdingExpression)
          Associates the specified gate with it's circuit representation (String) in this map.
static boolean containsGateNegGate(OperationExpression gate)
          Returns true if optimizer contains a mapping for the specified gate.
static UnaryOpExpression getReference(OperationExpression gate)
          Returns an UnaryOpExpression containing the ID_OP or NOT_OP to the specified gate.
static boolean isUsed(Statement s)
          returns true is s is needed to calculate the output pins of the circuit.
static void putUsedStatement(Statement s)
          Adds an AssignmentStatement to the usage data structure.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Optimizer

public Optimizer()
Method Detail

addGate

public static void addGate(OperationExpression gate,
                           LvalExpression holdingExpression)
Associates the specified gate with it's circuit representation (String) in this map. NOTE: this method shold be called only if containsGate() and containsNegGate are false.

Parameters:
gate - the gate (OperationExpression) to be added.
holdingExpression - the lValexpression that hold the result of the gate.

containsGateNegGate

public static boolean containsGateNegGate(OperationExpression gate)
Returns true if optimizer contains a mapping for the specified gate.

Parameters:
gate - the gate (OperationExpression) whose presence in the optimizer is to be tested.
Returns:
true if optimizer contains a mapping for the specified gate.

getReference

public static UnaryOpExpression getReference(OperationExpression gate)
Returns an UnaryOpExpression containing the ID_OP or NOT_OP to the specified gate. NOTE: this method should be call only if containsGateNegGate() if true.

Parameters:
gate - The circuit representation (String) of the gate (OperatorExpression) whose reference it to be returned.
Returns:
an UnaryOpExpression containing the ID_OP or NOT_OP to the specified gate.

putUsedStatement

public static void putUsedStatement(Statement s)
Adds an AssignmentStatement to the usage data structure.

Parameters:
s - the AssignmentStatement to be added.

isUsed

public static boolean isUsed(Statement s)
returns true is s is needed to calculate the output pins of the circuit.

Parameters:
s - the tested statement
Returns:
true is s is needed to calculate the output pins of the circuit.