P4C
The P4 Compiler
|
Encapsulates the details of invoking the P4 compiler for a target device and architecture. More...
#include <compiler_target.h>
Static Public Member Functions | |
static CompilerResultOrError | runCompiler (const CompilerOptions &options, std::string_view toolName) |
static CompilerResultOrError | runCompiler (const CompilerOptions &options, std::string_view toolName, const std::string &source) |
Static Public Member Functions inherited from P4::P4Tools::Target | |
static bool | init (std::string_view deviceName, std::string_view archName) |
static std::optional< ICompileContext * > | initializeTarget (std::string_view toolName, const std::vector< const char * > &args) |
static std::optional< ICompileContext * > | initializeTarget (std::string_view toolName, std::string_view target, std::string_view arch) |
static bool | setArch (std::string_view archName) |
static bool | setDevice (std::string_view deviceName) |
Protected Member Functions | |
CompilerTarget (std::string_view toolName, const std::string &deviceName, const std::string &archName) | |
virtual P4::FrontEnd | mkFrontEnd () const |
A factory method for providing a target-specific front end implementation. | |
virtual MidEnd | mkMidEnd (const CompilerOptions &options) const |
A factory method for providing a target-specific mid end implementation. | |
virtual CompilerResultOrError | runCompilerImpl (const CompilerOptions &options, const IR::P4Program *) const |
const IR::P4Program * | runFrontend (const CompilerOptions &options, const IR::P4Program *program) const |
const IR::P4Program * | runMidEnd (const CompilerOptions &options, const IR::P4Program *program) const |
Protected Member Functions inherited from P4::P4Tools::Target | |
Target (std::string_view toolName, const std::string &deviceName, const std::string &archName) | |
virtual ICompileContext * | makeContext () const =0 |
Static Protected Member Functions | |
static const IR::P4Program * | runParser (const ParserOptions &options) |
Static Protected Member Functions inherited from P4::P4Tools::Target | |
template<class TargetImpl > | |
static const TargetImpl & | get (std::string_view toolName) |
Additional Inherited Members | |
Public Member Functions inherited from P4::P4Tools::Target | |
virtual const IR::Expression * | createTargetUninitialized (const IR::Type *type, bool forceTaint) const |
Public Attributes inherited from P4::P4Tools::Target | |
Spec | spec |
The device and architecture supported by this instance. | |
std::string | toolName |
The name of the tool supported by this instance. | |
Encapsulates the details of invoking the P4 compiler for a target device and architecture.
|
static |
Runs the P4 compiler to produce an IR and various other kinds of information on the input program.
|
static |
Runs the P4 compiler to produce an IR and other information for the given source code.
|
protectedvirtual |
Reimplemented in P4::P4Tools::P4Testgen::TestgenTarget.
|
protected |
Runs the front end of the P4 compiler on the given program.
|
protected |
Runs the mid end provided by @mkMidEnd on the given program.
|
staticprotected |
Parses the P4 program specified on the command line.