32 bool containsName(
cstring name)
const {
33 return parameterValues.find(name) != parameterValues.end();
40 void add(
const IR::Parameter *parameter,
const IR::Argument *value);
41 const IR::Argument *lookupByName(
cstring name)
const {
return get(parameterValues, name); }
43 const IR::Argument *lookup(
const IR::Parameter *param)
const {
44 return lookupByName(param->name.name);
47 bool contains(
const IR::Parameter *param)
const {
48 if (!containsName(param->name.name))
return false;
52 const IR::Parameter *findParameter(
const IR::Argument *argument)
const {
54 if (lookup(p) == argument)
return p;
58 bool empty()
const {
return parameterValues.empty(); }
67 return Util::enumerate(parameters);
74 return paramList->getEnumerator();
77 void dbprint(std::ostream &out)
const {
78 bool brief = (DBPrint::dbgetflags(out) & DBPrint::Brief);
79 if (paramList !=
nullptr) {
80 if (!brief) out <<
"paramList:" << Log::endl;
81 for (
auto s : *paramList->getEnumerator()) {
82 out << dbp(s) <<
"=>" << dbp(lookup(s));
83 if (!brief) out <<
" " << lookup(s);
87 if (!brief) out <<
"parametersByName:" << Log::endl;
88 for (
auto s : parametersByName) {
89 out << dbp(s.second) <<
"=>" << dbp(lookupByName(s.first));
90 if (!brief) out <<
" " << lookupByName(s.first);
99 absl::flat_hash_map<cstring, const IR::Argument *> parameterValues;
101 absl::flat_hash_map<cstring, const IR::Parameter *> parametersByName;
103 std::vector<const IR::Parameter *> parameters;
105 const IR::ParameterList *paramList =
nullptr;
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24