[llvm] [RISCV] Add groupid/bitmask for RISC-V extension (PR #94440)

Piyou Chen via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 26 04:20:06 PDT 2024


================
@@ -210,10 +211,69 @@ 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() <= 64 && "BitInits' too long!");
+
+  uint64_t Value = 0;
+  for (unsigned i = 0, e = B->getNumBits(); i != e; ++i) {
+    const auto *Bit = cast<BitInit>(B->getBit(i));
+    Value |= uint64_t(Bit->getValue()) << i;
+  }
+  return Value;
+}
+
+static unsigned getBitPosFromValue(uint64_t Val) {
----------------
BeMg wrote:

Use bitPos as int now.

https://github.com/llvm/llvm-project/pull/94440


More information about the llvm-commits mailing list