P4C
The P4 Compiler
Loading...
Searching...
No Matches
compileTimeOps.h
1/*
2 * Copyright 2016 VMware, Inc.
3 * SPDX-FileCopyrightText: 2016 VMware, Inc.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef MIDEND_COMPILETIMEOPS_H_
9#define MIDEND_COMPILETIMEOPS_H_
10
11#include "frontends/p4/typeChecking/typeChecker.h"
12#include "ir/ir.h"
13
14namespace P4 {
15
23class CompileTimeOperations : public Inspector {
24 public:
25 CompileTimeOperations() { setName("CompileTimeOperations"); }
26 void err(const IR::Node *expression) {
27 ::P4::error(ErrorType::ERR_INVALID,
28 "%1%: could not evaluate expression at compilation time", expression);
29 }
30 void postorder(const IR::Mod *expression) override { err(expression); }
31 void postorder(const IR::Div *expression) override { err(expression); }
32};
33
34} // namespace P4
35
36#endif /* MIDEND_COMPILETIMEOPS_H_ */
Definition node.h:53
Definition visitor.h:418
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:13
void error(const char *format, Args &&...args)
Report an error with the given message.
Definition lib/error.h:58