If |node| is an SEConstantNode then returns |node| or if |node| is an SEAddNode returns a vector of SEConstantNode that are its children.
| 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. |
| 106 | std::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 | |
| 122 | bool AreOffsetsAndCoefficientsConstant( |
| 123 | const std::vector<SERecurrentNode*>& nodes) { |
no test coverage detected