[llvm] [RISCV] Add groupid/bitmask for RISC-V extension (PR #94440)
Kito Cheng via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 5 01:44:27 PDT 2024
================
@@ -210,10 +210,51 @@ static void emitRISCVProcs(RecordKeeper &RK, raw_ostream &OS) {
OS << "\n#undef TUNE_PROC\n";
}
+static inline uint64_t getValueFromBitsInit(const BitsInit *B,
+ const Record &R) {
+ assert(B->getNumBits() <= sizeof(uint64_t) * 8 && "BitInits' too long!");
+
+ uint64_t Value = 0;
+ for (unsigned i = 0, e = B->getNumBits(); i != e; ++i) {
+ const auto *Bit = dyn_cast<BitInit>(B->getBit(i));
+ if (Bit)
+ Value |= uint64_t(Bit->getValue()) << i;
+ }
+ return Value;
+}
+
+static void emitRISCVExtensionBitmask(RecordKeeper &RK, raw_ostream &OS) {
----------------
kito-cheng wrote:
Could we do some sanity test here to make sure no extension assigned to the same group id/bitmask?
https://github.com/llvm/llvm-project/pull/94440
More information about the llvm-commits
mailing list