53 static constexpr size_t MAX_DEPTH = 3;
55 static const IR::Type_Boolean *genBoolType();
57 static const IR::Type_InfInt *genIntType();
60 [[nodiscard]]
const IR::Type_Bits *genBitType(
bool isSigned)
const;
61 [[nodiscard]]
const IR::Type *pickRndBaseType(
const std::vector<int64_t> &type_probs)
const;
63 [[nodiscard]]
virtual const IR::Type *pickRndType(TyperefProbs type_probs);
65 static IR::BoolLiteral *genBoolLiteral();
67 static IR::Constant *genIntLiteral(
size_t bit_width = INTEGER_WIDTH);
69 static IR::Constant *genBitLiteral(
const IR::Type *tb);
71 [[nodiscard]]
virtual std::vector<int> availableBitWidths()
const {
72 return {4, 8, 16, 32, 64, 128};
76 IR::Expression *constructUnaryExpr(
const IR::Type_Bits *tb);
78 IR::Expression *createSaturationOperand(
const IR::Type_Bits *tb);
80 IR::Expression *constructBinaryBitExpr(
const IR::Type_Bits *tb);
82 IR::Expression *constructTernaryBitExpr(
const IR::Type_Bits *tb);
85 virtual IR::Expression *pickBitVar(
const IR::Type_Bits *tb);
87 virtual IR::Expression *constructBitExpr(
const IR::Type_Bits *tb);
90 IR::Expression *constructCmpExpr();
93 virtual IR::Expression *constructBooleanExpr();
96 IR::Expression *constructUnaryIntExpr();
98 IR::Expression *constructBinaryIntExpr();
100 static IR::Expression *pickIntVar();
103 IR::Expression *constructIntExpr();
106 IR::ListExpression *genStructListExpr(
const IR::Type_Name *tn);
108 IR::Expression *editHdrStack(
cstring lval);
111 virtual IR::Expression *constructStructExpr(
const IR::Type_Name *tn);
113 virtual IR::MethodCallExpression *genFunctionCall(
cstring method_name,
114 IR::ParameterList params);
116 virtual IR::MethodCallExpression *pickFunction(
119 virtual IR::Expression *genExpression(
const IR::Type *tp);
123 virtual IR::Expression *genInputArg(
const IR::Parameter *param);
125 virtual IR::Expression *pickLvalOrSlice(
const IR::Type *tp);
127 virtual bool checkInputArg(
const IR::Parameter *param);