P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::P4Tools::Taint Class Reference

Static Public Member Functions

static const IR::Literal * buildTaintMask (const Model *evaluatedModel, const IR::Expression *programPacket)
 
static bool hasTaint (const IR::Expression *expr)
 
static const IR::Expression * propagateTaint (const IR::Expression *expr)
 

Static Public Attributes

static const IR::StringLiteral TAINTED_STRING_LITERAL = IR::StringLiteral("Taint"_cs)
 

Member Function Documentation

◆ buildTaintMask()

const IR::Literal * P4::P4Tools::Taint::buildTaintMask ( const Model * evaluatedModel,
const IR::Expression * programPacket )
static
Returns
the mask for the corresponding program packet, indicating bits of the expression which are not tainted.

◆ hasTaint()

bool P4::P4Tools::Taint::hasTaint ( const IR::Expression * expr)
static
Returns
whether the given expression is tainted. An expression is tainted if one or more bits of the expression are expected to evaluate to (possibly part of) IR::TaintExpression.

◆ propagateTaint()

const IR::Expression * P4::P4Tools::Taint::propagateTaint ( const IR::Expression * expr)
static
Returns
a expression in which taint has been propagated upwards. At the end, this will either return a literal, a Member/PathExpression, or a concatenation. Any non-tainted variable is replaced with a zero constant. This function is used for the generation of taint masks.