P4C
The P4 Compiler
Loading...
Searching...
No Matches
splitter.h
1/*
2 * SPDX-FileCopyrightText: 2025 Altera Corporation
3 * Copyright 2025-present Altera Corporation.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef IR_SPLITTER_H_
9#define IR_SPLITTER_H_
10
11#include "ir/ir.h"
12#include "ir/visitor.h"
13
14namespace P4 {
15
16class NameGenerator;
17class TypeMap;
18
19template <typename Node>
21 const Node *before = nullptr;
22 const Node *after = nullptr;
23 std::vector<const IR::Declaration *> hoistedDeclarations;
24
26 explicit operator bool() const { return after; }
27 void clear() {
28 before = after = nullptr;
29 hoistedDeclarations.clear();
30 }
31};
32
112 const IR::Statement *stat,
113 std::function<bool(const IR::Statement *, const P4::Visitor_Context *)> predicate,
114 P4::NameGenerator &nameGen, P4::TypeMap *typeMap = nullptr);
115
116} // namespace P4
117
118#endif // IR_SPLITTER_H_
Definition referenceMap.h:29
Definition typeMap.h:32
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:13
SplitResult< IR::Statement > splitStatementBefore(const IR::Statement *stat, std::function< bool(const IR::Statement *, const P4::Visitor_Context *)> predicate, P4::NameGenerator &nameGen, P4::TypeMap *typeMap)
Split stat so that on every control-flow path all the statements up to the first one matching predica...
Definition splitter.cpp:258
Definition splitter.h:20