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

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Mar 12 10:06:45 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) +
----------------
MaskRay wrote:

We seem to use errors for parsing errors. This is probably a warning.

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


More information about the llvm-branch-commits mailing list