aboutsummaryrefslogtreecommitdiff
path: root/source/opt/ir_context.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/opt/ir_context.h')
-rw-r--r--source/opt/ir_context.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/opt/ir_context.h b/source/opt/ir_context.h
index 274dd14e..2f27942b 100644
--- a/source/opt/ir_context.h
+++ b/source/opt/ir_context.h
@@ -411,6 +411,10 @@ class IRContext {
void CollectNonSemanticTree(Instruction* inst,
std::unordered_set<Instruction*>* to_kill);
+ // Collect function reachable from |entryId|, returns |funcs|
+ void CollectCallTreeFromRoots(unsigned entryId,
+ std::unordered_set<uint32_t>* funcs);
+
// Returns true if all of the given analyses are valid.
bool AreAnalysesValid(Analysis set) { return (set & valid_analyses_) == set; }
@@ -867,8 +871,7 @@ inline IRContext::Analysis operator|(IRContext::Analysis lhs,
inline IRContext::Analysis& operator|=(IRContext::Analysis& lhs,
IRContext::Analysis rhs) {
- lhs = static_cast<IRContext::Analysis>(static_cast<int>(lhs) |
- static_cast<int>(rhs));
+ lhs = lhs | rhs;
return lhs;
}
@@ -1091,6 +1094,9 @@ void IRContext::AddDebug2Inst(std::unique_ptr<Instruction>&& d) {
id_to_name_->insert({d->GetSingleWordInOperand(0), d.get()});
}
}
+ if (AreAnalysesValid(kAnalysisDefUse)) {
+ get_def_use_mgr()->AnalyzeInstDefUse(d.get());
+ }
module()->AddDebug2Inst(std::move(d));
}