This a proof of concept for a suggestion I proposed in D108694.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
| llvm/lib/Support/RISCVISAInfo.cpp | ||
|---|---|---|
| 698 | Will the variables with underscore violate the naming conventions in LLVM? | |
| llvm/lib/Support/RISCVISAInfo.cpp | ||
|---|---|---|
| 698 | Yeah. Maybe I should use ImpliedExtsV and ImpliedExtsZfh so that a capital letter is against the ImpliedExts part for readability? | |
Sorry I accepted this without giving a closer look.
Some comments added :-)
| llvm/lib/Support/RISCVISAInfo.cpp | ||
|---|---|---|
| 728–736 | I think this won't cover recursive dependencies? | |
| 731 | Does this mean the ImpliedExts have to have extensions sorted in lexicological order? If so adding the zvl extension would look like: (I think it looks strange in my opinion, but no big problem though static constexpr ImpliedExtsEntry ImpliedExts[] = {
{"v", ImpliedExtsV},
{"zfh", ImpliedExtsZfh},
{"zvl64b", ImpliedExtsZvl64b},
{"zvl1024b", ImpliedExtsZvl1024b},
{"zvl128b", ImpliedExtsZvl128b},
{"zvl16384b", ImpliedExtsZvl16384b},
{"zvl2048b", ImpliedExtsZvl2048b},
{"zvl256b", ImpliedExtsZvl256b},
{"zvl32768b", ImpliedExtsZvl32768b},
{"zvl4096b", ImpliedExtsZvl4096b},
{"zvl512b", ImpliedExtsZvl512b},
{"zvl65536b", ImpliedExtsZvl65536b},
{"zvl8192b", ImpliedExtsZvl8192b},
}; | |
| llvm/lib/Support/RISCVISAInfo.cpp | ||
|---|---|---|
| 731 | Yes. It is unfortunate that they have to be ordered like that. I should also add a check to verify the table is sorted to prevent mistakes. | |
Add is_sorted check. Add operator< to the ImpliedFeatures struct
Remove underscore from array names.
This does not build with gcc5 apparently: https://lab.llvm.org/staging/#/builders/190/builds/2632
llvm/lib/Support/RISCVISAInfo.cpp:715:1: error: could not convert '(const char*)"v"' from 'const char*' to 'llvm::StringLiteral' llvm/lib/Support/RISCVISAInfo.cpp:715:1: error: could not convert '(const char**)(& ImpliedExtsV)' from 'const char**' to 'llvm::ArrayRef<const char*>' llvm/lib/Support/RISCVISAInfo.cpp:715:1: error: could not convert '(const char*)"zfh"' from 'const char*' to 'llvm::StringLiteral' llvm/lib/Support/RISCVISAInfo.cpp:715:1: error: could not convert '(const char**)(& ImpliedExtsZfh)' from 'const char**' to 'llvm::ArrayRef<const char*>'
Thanks. I seem to remember something about gcc 5.x and constexprs before. I’ll take a look
Will the variables with underscore violate the naming conventions in LLVM?