P4C
The P4 Compiler
Loading...
Searching...
No Matches
bytestrings.h
1/*
2 * Copyright 2019 VMware, Inc.
3 * SPDX-FileCopyrightText: 2019 VMware, Inc.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef CONTROL_PLANE_BYTESTRINGS_H_
9#define CONTROL_PLANE_BYTESTRINGS_H_
10
11#include <optional>
12#include <string>
13
14#include "lib/big_int.h"
15
16namespace P4::IR {
17
18class Type;
19class Constant;
20class BoolLiteral;
21class Expression;
22
23} // namespace P4::IR
24
25namespace P4 {
26
27class TypeMap;
28
29namespace ControlPlaneAPI {
30
35int getTypeWidth(const IR::Type &type, const TypeMap &typeMap);
36
39std::optional<std::string> stringRepr(const IR::Constant *constant, int width);
40
43std::optional<std::string> stringRepr(const IR::BoolLiteral *constant, int width);
44
47std::optional<std::string> stringRepr(const TypeMap &typeMap, const IR::Expression *expression);
48
52std::optional<std::string> stringReprConstant(big_int value, int width);
53
54} // namespace ControlPlaneAPI
55
56} // namespace P4
57
58#endif // CONTROL_PLANE_BYTESTRINGS_H_
Definition typeMap.h:32
TODO(antonin): High level goals of the generator go here!!
Definition dpdk/control-plane/bfruntime_arch_handler.h:44
std::optional< std::string > stringRepr(const IR::Constant *constant, int width)
Definition bytestrings.cpp:56
int getTypeWidth(const IR::Type &type, const TypeMap &typeMap)
Definition bytestrings.cpp:15
std::optional< std::string > stringReprConstant(big_int value, int width)
Definition bytestrings.cpp:29
Definition constantParsing.h:22
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:13