MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / GetAllTopLevelConstants

Function GetAllTopLevelConstants

source/opt/loop_dependence.cpp:106–120  ·  view source on GitHub ↗

If |node| is an SEConstantNode then returns |node| or if |node| is an SEAddNode returns a vector of SEConstantNode that are its children.

Source from the content-addressed store, hash-verified

104// If |node| is an SEConstantNode then returns |node| or if |node| is an
105// SEAddNode returns a vector of SEConstantNode that are its children.
106std::vector<SEConstantNode*> GetAllTopLevelConstants(SENode* node) {
107 auto nodes = std::vector<SEConstantNode*>{};
108 if (auto recurrent_node = node->AsSEConstantNode()) {
109 nodes.push_back(recurrent_node);
110 }
111
112 if (auto add_node = node->AsSEAddNode()) {
113 for (auto child : add_node->GetChildren()) {
114 auto child_nodes = GetAllTopLevelConstants(child);
115 nodes.insert(nodes.end(), child_nodes.begin(), child_nodes.end());
116 }
117 }
118
119 return nodes;
120}
121
122bool AreOffsetsAndCoefficientsConstant(
123 const std::vector<SERecurrentNode*>& nodes) {

Callers 1

GCDMIVTestMethod · 0.85

Calls 6

AsSEConstantNodeMethod · 0.80
AsSEAddNodeMethod · 0.80
push_backMethod · 0.45
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected