Skip to content

[RISCV] Reorder include of RISCVInstrInfoZi* before C and Zc*. NFC #131274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 14, 2025

Conversation

topperc
Copy link
Collaborator

@topperc topperc commented Mar 14, 2025

Zclsd needs to reference Zilsd in CompressPats so put Zi before Zc.

The one issue I encountered is that RISCVInstrFormatsC.td needs to be included before RISCVInstrInfoZicfiss. To fix this I moved the include of RISCVInstrFormatsC.td from RISCVInstrInfoC.td to RISCVInstrInfo.td where we include RISCVInstrFormats.td. I moved RISCVInstrFormatsV.td for consistency.

CC: @dong-miao

Zclsd needs to reference Zilsd in CompressPats so put Zi before Zc.

The one issue I encountered is that RISCVInstrFormatsC.td needs to
be included before RISCVInstrInfoZicfiss. To fix this I moved the
include of RISCVInstrFormatsC.td from RISCVInstrInfoC.td to
RISCVInstrInfo.td where we include RISCVInstrFormats.td. I moved
RISCVInstrFormatsV.td for consistency.
@llvmbot
Copy link
Member

llvmbot commented Mar 14, 2025

@llvm/pr-subscribers-backend-risc-v

Author: Craig Topper (topperc)

Changes

Zclsd needs to reference Zilsd in CompressPats so put Zi before Zc.

The one issue I encountered is that RISCVInstrFormatsC.td needs to be included before RISCVInstrInfoZicfiss. To fix this I moved the include of RISCVInstrFormatsC.td from RISCVInstrInfoC.td to RISCVInstrInfo.td where we include RISCVInstrFormats.td. I moved RISCVInstrFormatsV.td for consistency.

CC: @dong-miao


Full diff: https://github.com/llvm/llvm-project/pull/131274.diff

3 Files Affected:

  • (modified) llvm/lib/Target/RISCV/RISCVInstrInfo.td (+7-5)
  • (modified) llvm/lib/Target/RISCV/RISCVInstrInfoC.td (-2)
  • (modified) llvm/lib/Target/RISCV/RISCVInstrInfoV.td (-2)
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.td b/llvm/lib/Target/RISCV/RISCVInstrInfo.td
index aab368680e814..11d93892ee7a5 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.td
@@ -518,6 +518,8 @@ def LeadingOnesWMask : ImmLeaf<XLenVT, [{
 //===----------------------------------------------------------------------===//
 
 include "RISCVInstrFormats.td"
+include "RISCVInstrFormatsC.td"
+include "RISCVInstrFormatsV.td"
 
 //===----------------------------------------------------------------------===//
 // Instruction Class Templates
@@ -2135,17 +2137,17 @@ include "RISCVInstrInfoZk.td"
 include "RISCVInstrInfoV.td"
 include "RISCVInstrInfoZvk.td"
 
-// Compressed
-include "RISCVInstrInfoC.td"
-include "RISCVInstrInfoZc.td"
-include "RISCVInstrInfoZcmop.td"
-
 // Integer
 include "RISCVInstrInfoZimop.td"
 include "RISCVInstrInfoZicbo.td"
 include "RISCVInstrInfoZicond.td"
 include "RISCVInstrInfoZicfiss.td"
 
+// Compressed
+include "RISCVInstrInfoC.td"
+include "RISCVInstrInfoZc.td"
+include "RISCVInstrInfoZcmop.td"
+
 //===----------------------------------------------------------------------===//
 // Vendor extensions
 //===----------------------------------------------------------------------===//
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoC.td b/llvm/lib/Target/RISCV/RISCVInstrInfoC.td
index 0f320d2375ec2..41ed253f2f36d 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoC.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoC.td
@@ -6,8 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-include "RISCVInstrFormatsC.td"
-
 //===----------------------------------------------------------------------===//
 // Operand definitions.
 //===----------------------------------------------------------------------===//
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoV.td b/llvm/lib/Target/RISCV/RISCVInstrInfoV.td
index 73345c92b0694..8e18736dc8ecb 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoV.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoV.td
@@ -11,8 +11,6 @@
 ///
 //===----------------------------------------------------------------------===//
 
-include "RISCVInstrFormatsV.td"
-
 //===----------------------------------------------------------------------===//
 // Operand and SDNode transformation definitions.
 //===----------------------------------------------------------------------===//

Copy link
Contributor

@wangpc-pp wangpc-pp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Contributor

@asb asb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I think moving the *Formats.td includes is better structuring anyway.

@topperc topperc merged commit b936ef1 into llvm:main Mar 14, 2025
11 of 13 checks passed
@topperc topperc deleted the pr/include-reorder branch March 14, 2025 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants