P4C
The P4 Compiler
Loading...
Searching...
No Matches
ir/annotations.h
1/*
2Licensed under the Apache License, Version 2.0 (the "License");
3you may not use this file except in compliance with the License.
4You may obtain a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8Unless required by applicable law or agreed to in writing, software
9distributed under the License is distributed on an "AS IS" BASIS,
10WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11See the License for the specific language governing permissions and
12limitations under the License.
13*/
14
15#ifndef IR_ANNOTATIONS_H_
16#define IR_ANNOTATIONS_H_
17
18#include "ir/vector.h"
19#include "lib/cstring.h"
20
21namespace P4::IR {
22class Expression;
23
24namespace Annotations {
26[[nodiscard]] Vector<Annotation> maybeAddNameAnnotation(const Vector<Annotation> &annos,
27 cstring name);
29[[nodiscard]] Vector<Annotation> setNameAnnotation(const Vector<Annotation> &annos, cstring name);
30[[nodiscard]] Vector<Annotation> withoutNameAnnotation(const Vector<Annotation> &annos);
31
32void addIfNew(Vector<Annotation> &annotations, cstring name, const Expression *expr,
33 bool structured = false);
34void addIfNew(Vector<Annotation> &annotations, const IR::Annotation *ann);
35void addOrReplace(Vector<Annotation> &annotations, cstring name, const Expression *expr,
36 bool structured = false);
37void addOrReplace(Vector<Annotation> &annotations, const IR::Annotation *ann);
38} // namespace Annotations
39
40} // namespace P4::IR
41
42#endif // IR_ANNOTATIONS_H_