You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[RISCV]Add support for resolving encoding conflicts among vendor specific CSRs
This patch adds the framework for resolving encoding conflicts among CSRs.
Specifically, this patch adds a support for emitting a new lookup function for
the primary key which return a pair of iterators pointing to first and last
value hence giving a range of values which satisfies the query.
While printing the CSR name during objdump, iterate over the range and print the
name of only that CSR which satisifes the feature requirement of subtarget.
Below is the signature of the new function that will be emitted for primary key:
```
llvm::iterator_range<const SysReg *> lookupSysRegByEncoding(uint16_t Encoding) {
struct KeyType {
uint16_t Encoding;
};
KeyType Key = {Encoding};
struct Comp {
bool operator()(const SysReg &LHS, const KeyType &RHS) const {
if (LHS.Encoding < RHS.Encoding)
return true;
if (LHS.Encoding > RHS.Encoding)
return false;
return false;
}
bool operator()(const KeyType &LHS, const SysReg &RHS) const {
if (LHS.Encoding < RHS.Encoding)
return true;
if (LHS.Encoding > RHS.Encoding)
return false;
return false;
}
};
auto Table = ArrayRef(SysRegsList);
auto It = std::equal_range(Table.begin(), Table.end(), Key, Comp());
return llvm::make_range(It.first, It.second);
}
```
NOTE: Emitting a different signature for returning a range of results is only
supported by primary key.
0 commit comments