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

Paul Kirth via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Mar 15 10:59:49 PDT 2024


================
@@ -1135,11 +1135,34 @@ static void mergeAtomic(DenseMap<unsigned, unsigned>::iterator it,
   };
 }
 
+static void mergeX3RegUse(DenseMap<unsigned, unsigned>::iterator it,
+                          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;
+  if (newTag == X3RegUsage::UNKNOWN)
+    return;
+  if (oldTag == X3RegUsage::UNKNOWN) {
+    it->getSecond() = newTag;
+    return;
+  }
+  if (oldTag != newTag) {
+    errorOrWarn(toString(oldSection) + " has x3_reg_usage=" + Twine(oldTag) +
----------------
ilovepi wrote:

Thanks. I've changed it to an error, but it's now inconsistent w/ STACK_ALIGN a few lines up. Should we change that too?

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


More information about the llvm-branch-commits mailing list