java.lang.Object
pascal.taie.analysis.dataflow.fact.MapFact<Var,Value>
pascal.taie.analysis.dataflow.analysis.constprop.CPFact
All Implemented Interfaces:
Copyable<MapFact<Var,Value>>

public class CPFact extends MapFact<Var,Value>
Represents data facts of constant propagation, which maps variables to their lattice values.

For better performance, this implementation treats temporary constant variables specially. These variables have two features:

  • its value is associated with itself
  • its value never change
So this map does not need to actually store the values of these variables: the values must be constants and can be obtained from the variables themselves.

Note that in this implementation, we use absence to represent UNDEF, i.e., if a CPFact does not contain variable-value mapping of a variable, it represents that the lattice value of the variable is UNDEF; moreover, if we set the lattice value of a variable to UNDEF, it effectively removes the variable from the CPFact.

  • Constructor Details

    • CPFact

      public CPFact()
  • Method Details

    • get

      public Value get(Var var)
      Overrides:
      get in class MapFact<Var,Value>
      Returns:
      the value of given variable in this fact, or UNDEF the variable is absent in this fact.
    • update

      public boolean update(Var var, Value value)
      Description copied from class: MapFact
      Updates the key-value mapping in this fact.
      Overrides:
      update in class MapFact<Var,Value>
      Returns:
      if the update changes this fact.
    • copy

      public CPFact copy()
      Description copied from class: MapFact
      Creates and returns a copy of this fact.
      Specified by:
      copy in interface Copyable<MapFact<Var,Value>>
      Overrides:
      copy in class MapFact<Var,Value>
      Returns:
      a copy of this object.