llir-opt
0.0.1
Low-Level Post-Link Optimiser for OCaml and C
|
9 #include <unordered_set>
13 #include <llvm/ADT/ilist.h>
14 #include <llvm/ADT/ilist_node.h>
15 #include <llvm/ADT/iterator.h>
16 #include <llvm/ADT/iterator_range.h>
18 #include "core/adt/bitset.h"
145 llvm::iterator_range<BitSet<SetNode *>::iterator>
sets()
147 return llvm::make_range(sets_.
begin(), sets_.
end());
151 llvm::iterator_range<BitSet<DerefNode *>::iterator>
derefs()
153 return llvm::make_range(derefOuts_.
begin(), derefOuts_.
end());
159 return llvm::make_range(funcs_.
begin(), funcs_.
end());
165 return llvm::make_range(exts_.
begin(), exts_.
end());
171 return llvm::make_range(nodes_.
begin(), nodes_.
end());
222 llvm::iterator_range<BitSet<SetNode *>::iterator>
set_ins()
224 return llvm::make_range(setIns_.
begin(), setIns_.
end());
228 llvm::iterator_range<BitSet<SetNode *>::iterator>
set_outs()
230 return llvm::make_range(setOuts_.
begin(), setOuts_.
end());
272 mutable uint32_t
id_;
SetNode * Node() const
Returns the dereferenced node.
Definition: node.h:214
bool Equals(SetNode *that)
Checks if two nodes are equal.
Definition: node.cpp:113
uint64_t id_
ID of the node.
Definition: node.h:98
SetNode * Contents()
Returns the set node with the contents.
Definition: node.cpp:169
void AddNode(ID< SetNode * > node)
Adds a node to the set.
Definition: node.h:132
iterator begin() const
Start iterator.
Definition: bitset.h:356
~DerefNode()
Deletes the deref node.
Definition: node.cpp:164
llvm::iterator_range< BitSet< SetNode * >::iterator > set_ins()
Iterator over the incoming edges.
Definition: node.h:222
RootNode(Graph *graph, SetNode *actual)
Creates a new root node.
Definition: node.cpp:222
Kind kind_
Node kind.
Definition: node.h:67
iterator end() const
End iterator.
Definition: bitset.h:362
bool AddDeref(DerefNode *node)
Adds an edge from this node to another set node.
Definition: node.cpp:102
llvm::iterator_range< BitSet< DerefNode * >::iterator > derefs()
Iterator over the outgoing edges.
Definition: node.h:151
DerefNode * AsDeref()
Returns the node as a deref, if it is one.
Definition: node.cpp:62
virtual ~GraphNode()
Deletes the node.
Definition: node.cpp:51
llvm::iterator_range< BitSet< SetNode * >::iterator > points_to_node()
Nodes pointed to.
Definition: node.h:169
bool IsDeref() const
Checks if the node is a load.
Definition: node.h:85
SetNode * Set() const
Returns the set node.
Definition: node.cpp:230
GraphNode * ToGraph()
Converts the node to a graph node.
Definition: node.cpp:23
llvm::iterator_range< BitSet< Func * >::iterator > points_to_func()
Functions pointed to.
Definition: node.h:157
bool Insert(const ID< T > &item)
Inserts an item into the bitset.
Definition: bitset.h:391
void AddExtern(ID< Extern * > ext)
Adds an extern to the set.
Definition: node.h:130
~SetNode()
Deletes a set node.
Definition: node.cpp:75
Kind
Enumeration of enum kinds.
Definition: node.h:46
llvm::iterator_range< BitSet< Extern * >::iterator > points_to_ext()
Externs pointed to.
Definition: node.h:163
DerefNode * Deref()
Returns a node dereferencing this one.
Definition: node.cpp:80
llvm::iterator_range< BitSet< SetNode * >::iterator > set_outs()
Iterator over the outgoing edges.
Definition: node.h:228
bool AddSet(SetNode *node)
Adds an edge from this node to another set node.
Definition: node.cpp:96
SetNode * AsSet()
Returns the node as a set, if it is one.
Definition: node.cpp:56
bool Propagate(SetNode *that)
Propagates values to another set.
Definition: node.cpp:86
RootNode * AsRoot()
Converts the node to a root node (if it is one).
Definition: node.cpp:34
Node(Kind kind)
Creates a new node.
Definition: node.cpp:12
uint64_t GetID() const
Returns the ID of the node.
Definition: node.h:82
GraphNode(Kind kind, uint64_t id)
Constructs a graph node.
Definition: node.cpp:40
llvm::iterator_range< BitSet< SetNode * >::iterator > sets()
Iterator over the outgoing edges.
Definition: node.h:145
void AddFunc(ID< Func * > func)
Adds a function to the set.
Definition: node.h:128
virtual ~Node()
Virtual destructor.
Definition: node.cpp:18
bool IsSet() const
Checks if the ndoe is a set.
Definition: node.h:87
bool AddSet(SetNode *node)
Adds an edge from this node to another node.
Definition: node.cpp:175