llir-opt
0.0.1
Low-Level Post-Link Optimiser for OCaml and C
|
9 #include <unordered_set>
10 #include <unordered_map>
12 #include <llvm/Support/raw_ostream.h>
27 using OffsetSet = std::set<std::pair<int64_t, int64_t>>;
65 void dump(llvm::raw_ostream &os)
const;
76 virtual bool Skip(
Func &func) {
return false; }
80 void ExtractReferences(
Func &func,
Node &node);
92 std::unordered_map<Func *, Node *> funcToNode_;
94 std::vector<std::unique_ptr<Node>> nodes_;
102 inline llvm::raw_ostream &operator<<(
103 llvm::raw_ostream &os,
Definition: reference_graph.h:32
std::unordered_set< Object * > WrittenRanges
Set of written symbols.
Definition: reference_graph.h:47
Information about this node.
Definition: reference_graph.h:35
void AddRead(Object *object)
Add an inaccurate read.
Definition: reference_graph.cpp:76
virtual bool Skip(Func &func)
Callback which decides whether to follow or skip a function.
Definition: reference_graph.h:76
Definition: call_graph.h:20
std::unordered_map< Object *, OffsetSet > WrittenOffsets
Set of written offsets in symbols.
Definition: reference_graph.h:49
bool HasRaise
Flag to indicate whether any reachable node raises.
Definition: reference_graph.h:39
std::unordered_set< Object * > ReadRanges
Set of referenced symbols.
Definition: reference_graph.h:43
bool HasIndirectCalls
Flag to indicate whether any reachable node has indirect calls.
Definition: reference_graph.h:37
void AddWrite(Object *object)
Add an inaccurate write.
Definition: reference_graph.cpp:89
ReferenceGraph(Prog &prog, CallGraph &graph)
Build reference information.
Definition: reference_graph.cpp:166
std::unordered_set< Block * > Blocks
Set of addressed blocks.
Definition: reference_graph.h:55
bool HasBarrier
Check whether there are barriers.
Definition: reference_graph.h:41
void Merge(const Node &that)
Merge another node into this one.
Definition: reference_graph.cpp:18
std::unordered_set< Global * > Escapes
Set of symbols which escape.
Definition: reference_graph.h:51
std::unordered_set< Func * > Called
Set of called functions.
Definition: reference_graph.h:53
std::unordered_map< Object *, OffsetSet > ReadOffsets
Set of referenced offsets in objects.
Definition: reference_graph.h:45
const Node & operator[](Func &func)
Return the set of globals referenced by a function.
Definition: reference_graph.cpp:214
void dump(llvm::raw_ostream &os) const
Dump a representation of the node.
Definition: reference_graph.cpp:102