[llvm-branch-commits] [llvm][lld][RISCV] Support x3_reg_usage (PR #84598)

Craig Topper via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Mar 10 11:47:47 PDT 2024


================
@@ -1136,11 +1136,35 @@ static void mergeAtomic(DenseMap<unsigned, unsigned> &intAttr,
   };
 }
 
+static void mergeX3RegUse(DenseMap<unsigned, unsigned> &intAttr,
+                          const InputSectionBase *oldSection,
+                          const InputSectionBase *newSection,
+                          unsigned int oldTag, unsigned int newTag) {
+  // X3/GP register usage ar incompatible and cannot be merged, with the
+  // exception of the UNKNOWN or 0 value
+  using RISCVAttrs::RISCVX3RegUse::X3RegUsage;
+  auto attr = RISCVAttrs::X3_REG_USAGE;
+  if (newTag == X3RegUsage::UNKNOWN)
+    return;
+  if (oldTag == X3RegUsage::UNKNOWN) {
+    intAttr[attr] = newTag;
----------------
topperc wrote:

Can we use the iterator from try_emplace instead of a second map lookup?

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


More information about the llvm-branch-commits mailing list