Jlm
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
jlm::llvm::DeadNodeElimination::Context Class Referencefinal

Dead Node Elimination context class. More...

Collaboration diagram for jlm::llvm::DeadNodeElimination::Context:
Collaboration graph
[legend]

Public Member Functions

void MarkAlive (const jlm::rvsdg::Output &output)
 
bool IsAlive (const jlm::rvsdg::Output &output) const noexcept
 
bool IsAlive (const rvsdg::Node &node) const noexcept
 

Static Public Member Functions

static std::unique_ptr< ContextCreate ()
 

Private Attributes

util::HashSet< const jlm::rvsdg::SimpleNode * > SimpleNodes_
 
util::HashSet< const jlm::rvsdg::Output * > Outputs_
 

Detailed Description

Dead Node Elimination context class.

This class keeps track of all the nodes and outputs that are alive. In contrast to all other nodes, a simple node is considered alive if already a single of its outputs is alive. For this reason, this class keeps separately track of simple nodes and therefore avoids to store all its outputs (and instead stores the node itself). By marking the entire node as alive, we also avoid that we reiterate through all inputs of this node again in the future. The following example illustrates the issue:

o1 ... oN = Node2 i1 ... iN p1 ... pN = Node1 o1 ... oN

When we mark o1 as alive, we actually mark the entire Node2 as alive. This means that when we try to mark o2 alive in the future, we can immediately stop marking instead of reiterating through i1 ... iN again. Thus, by marking the entire simple node instead of just its outputs, we reduce the runtime for marking Node2 from O(oN x iN) to O(oN + iN).

Definition at line 36 of file DeadNodeElimination.cpp.

Member Function Documentation

◆ Create()

static std::unique_ptr<Context> jlm::llvm::DeadNodeElimination::Context::Create ( )
inlinestatic

Definition at line 82 of file DeadNodeElimination.cpp.

◆ IsAlive() [1/2]

bool jlm::llvm::DeadNodeElimination::Context::IsAlive ( const jlm::rvsdg::Output output) const
inlinenoexcept

Definition at line 52 of file DeadNodeElimination.cpp.

◆ IsAlive() [2/2]

bool jlm::llvm::DeadNodeElimination::Context::IsAlive ( const rvsdg::Node node) const
inlinenoexcept

Definition at line 63 of file DeadNodeElimination.cpp.

◆ MarkAlive()

void jlm::llvm::DeadNodeElimination::Context::MarkAlive ( const jlm::rvsdg::Output output)
inline

Definition at line 40 of file DeadNodeElimination.cpp.

Member Data Documentation

◆ Outputs_

util::HashSet<const jlm::rvsdg::Output *> jlm::llvm::DeadNodeElimination::Context::Outputs_
private

Definition at line 89 of file DeadNodeElimination.cpp.

◆ SimpleNodes_

util::HashSet<const jlm::rvsdg::SimpleNode *> jlm::llvm::DeadNodeElimination::Context::SimpleNodes_
private

Definition at line 88 of file DeadNodeElimination.cpp.


The documentation for this class was generated from the following file: