P4C
The P4 Compiler
|
#include <target.h>
Classes | |
struct | Spec |
Specifies a target device and architecture by their names in lower case. More... | |
Public Member Functions | |
virtual const IR::Expression * | createTargetUninitialized (const IR::Type *type, bool forceTaint) const |
Static Public Member Functions | |
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) |
Public Attributes | |
Spec | spec |
The device and architecture supported by this instance. | |
std::string | toolName |
The name of the tool supported by this instance. | |
Protected Member Functions | |
Target (std::string_view toolName, const std::string &deviceName, const std::string &archName) | |
virtual ICompileContext * | makeContext () const =0 |
Static Protected Member Functions | |
template<class TargetImpl > | |
static const TargetImpl & | get (std::string_view toolName) |
Encapsulates the details of a target device and architecture for a single tool. Implementations are singletons and must provide a default constructor. Instances are automatically registered into a central registry. The active target is set by calling @init. The suite of instances for all supported tools for the active target can be obtained by calling @get.
|
protected |
Creates and registers a new Target instance for the given @toolName, @deviceName, and @archName.
|
virtual |
forceTaint | is active, this function always returns a taint variable. Can be overridden by sub-targets. |
|
inlinestaticprotected |
|
static |
Initializes the global target device and architecture to @deviceName and @archName.
|
static |
Initializes the global target device and architecture to @deviceName and @archName. Returns 0 on success. If initialization fails, returns -1.
|
nodiscardprotectedpure virtual |
Implemented in P4::P4Tools::P4Smith::SmithTarget, and P4::P4Tools::P4Testgen::TestgenTarget.
|
static |
Initializes the global target architecture to @archName without changing the device. If no device was previously selected, then the first device registered for the architecture is chosen.
|
static |
Initializes the global target device to @deviceName without changing the architecture. If no architecture was previously selected, then the first architecture registered for the device is chosen.