-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[RISCV] Re-format RISCVFeatures.td so it doesn't look like AssemblerPredicate is an operand to Predicate. #79076
Conversation
…redicate is an operand to Predicate. AssemblerPredicate was almost always intented to the same column as the first operand to Predicate. But AssemblerPredicate is a separate base class so should have the same indentation as Predicate. For the string passed to AssemblePredicate, I aligned it to the other arguments on the previous if it fit in 80 columns. Otherwise I indented 4 spaces past the start of AssemblerPredicate. For some vendor extensions I put the 2 classes on new lines instead of the same line as the def. This gave more room for the strings and was more consistent with other formatting in that portion of the file.
@llvm/pr-subscribers-backend-risc-v Author: Craig Topper (topperc) ChangesAssemblerPredicate was almost always indented to the same column as the first operand to Predicate. But AssemblerPredicate is a separate base class so should have the same indentation as Predicate. For the string passed to AssemblePredicate, I aligned it to the other arguments on the previous if it fit in 80 columns. Otherwise I indented 4 spaces past the start of AssemblerPredicate. For some vendor extensions I put the 2 classes on new lines instead of the same line as the def. This gave more room for the strings and was more consistent with other formatting in that portion of the file. Patch is 54.45 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/79076.diff 1 Files Affected:
diff --git a/llvm/lib/Target/RISCV/RISCVFeatures.td b/llvm/lib/Target/RISCV/RISCVFeatures.td
index c84436ca5d1094..5b3aab43266c32 100644
--- a/llvm/lib/Target/RISCV/RISCVFeatures.td
+++ b/llvm/lib/Target/RISCV/RISCVFeatures.td
@@ -16,8 +16,8 @@ def FeatureStdExtI
: SubtargetFeature<"i", "HasStdExtI", "true",
"'I' (Base Integer Instruction Set)">;
def HasStdExtI : Predicate<"Subtarget->hasStdExtI()">,
- AssemblerPredicate<(all_of FeatureStdExtI),
- "'I' (Base Integer Instruction Set)">;
+ AssemblerPredicate<(all_of FeatureStdExtI),
+ "'I' (Base Integer Instruction Set)">;
def FeatureStdExtZic64b
: SubtargetFeature<"zic64b", "HasStdExtZic64b", "true",
"'Zic64b' (Cache Block Size Is 64 Bytes)">;
@@ -26,22 +26,22 @@ def FeatureStdExtZicbom
: SubtargetFeature<"zicbom", "HasStdExtZicbom", "true",
"'Zicbom' (Cache-Block Management Instructions)">;
def HasStdExtZicbom : Predicate<"Subtarget->hasStdExtZicbom()">,
- AssemblerPredicate<(all_of FeatureStdExtZicbom),
- "'Zicbom' (Cache-Block Management Instructions)">;
+ AssemblerPredicate<(all_of FeatureStdExtZicbom),
+ "'Zicbom' (Cache-Block Management Instructions)">;
def FeatureStdExtZicbop
: SubtargetFeature<"zicbop", "HasStdExtZicbop", "true",
"'Zicbop' (Cache-Block Prefetch Instructions)">;
def HasStdExtZicbop : Predicate<"Subtarget->hasStdExtZicbop()">,
- AssemblerPredicate<(all_of FeatureStdExtZicbop),
- "'Zicbop' (Cache-Block Prefetch Instructions)">;
+ AssemblerPredicate<(all_of FeatureStdExtZicbop),
+ "'Zicbop' (Cache-Block Prefetch Instructions)">;
def FeatureStdExtZicboz
: SubtargetFeature<"zicboz", "HasStdExtZicboz", "true",
"'Zicboz' (Cache-Block Zero Instructions)">;
def HasStdExtZicboz : Predicate<"Subtarget->hasStdExtZicboz()">,
- AssemblerPredicate<(all_of FeatureStdExtZicboz),
- "'Zicboz' (Cache-Block Zero Instructions)">;
+ AssemblerPredicate<(all_of FeatureStdExtZicboz),
+ "'Zicboz' (Cache-Block Zero Instructions)">;
def FeatureStdExtZiccamoa
: SubtargetFeature<"ziccamoa", "HasStdExtZiccamoa", "true",
@@ -63,8 +63,8 @@ def FeatureStdExtZicsr
: SubtargetFeature<"zicsr", "HasStdExtZicsr", "true",
"'zicsr' (CSRs)">;
def HasStdExtZicsr : Predicate<"Subtarget->hasStdExtZicsr()">,
- AssemblerPredicate<(all_of FeatureStdExtZicsr),
- "'Zicsr' (CSRs)">;
+ AssemblerPredicate<(all_of FeatureStdExtZicsr),
+ "'Zicsr' (CSRs)">;
def FeatureStdExtZicntr
: SubtargetFeature<"zicntr", "HasStdExtZicntr", "true",
@@ -75,29 +75,29 @@ def FeatureStdExtZicond
: SubtargetFeature<"experimental-zicond", "HasStdExtZicond", "true",
"'Zicond' (Integer Conditional Operations)">;
def HasStdExtZicond : Predicate<"Subtarget->hasStdExtZicond()">,
- AssemblerPredicate<(all_of FeatureStdExtZicond),
- "'Zicond' (Integer Conditional Operations)">;
+ AssemblerPredicate<(all_of FeatureStdExtZicond),
+ "'Zicond' (Integer Conditional Operations)">;
def FeatureStdExtZifencei
: SubtargetFeature<"zifencei", "HasStdExtZifencei", "true",
"'Zifencei' (fence.i)">;
def HasStdExtZifencei : Predicate<"Subtarget->hasStdExtZifencei()">,
- AssemblerPredicate<(all_of FeatureStdExtZifencei),
- "'Zifencei' (fence.i)">;
+ AssemblerPredicate<(all_of FeatureStdExtZifencei),
+ "'Zifencei' (fence.i)">;
def FeatureStdExtZihintpause
: SubtargetFeature<"zihintpause", "HasStdExtZihintpause", "true",
"'Zihintpause' (Pause Hint)">;
def HasStdExtZihintpause : Predicate<"Subtarget->hasStdExtZihintpause()">,
- AssemblerPredicate<(all_of FeatureStdExtZihintpause),
- "'Zihintpause' (Pause Hint)">;
+ AssemblerPredicate<(all_of FeatureStdExtZihintpause),
+ "'Zihintpause' (Pause Hint)">;
def FeatureStdExtZihintntl
: SubtargetFeature<"zihintntl", "HasStdExtZihintntl", "true",
"'Zihintntl' (Non-Temporal Locality Hints)">;
def HasStdExtZihintntl : Predicate<"Subtarget->hasStdExtZihintntl()">,
- AssemblerPredicate<(all_of FeatureStdExtZihintntl),
- "'Zihintntl' (Non-Temporal Locality Hints)">;
+ AssemblerPredicate<(all_of FeatureStdExtZihintntl),
+ "'Zihintntl' (Non-Temporal Locality Hints)">;
def FeatureStdExtZihpm
: SubtargetFeature<"zihpm", "HasStdExtZihpm", "true",
@@ -107,23 +107,23 @@ def FeatureStdExtZihpm
def FeatureStdExtZimop : SubtargetFeature<"experimental-zimop", "HasStdExtZimop", "true",
"'Zimop' (May-Be-Operations)">;
def HasStdExtZimop : Predicate<"Subtarget->hasStdExtZimop()">,
- AssemblerPredicate<(all_of FeatureStdExtZimop),
- "'Zimop' (May-Be-Operations)">;
+ AssemblerPredicate<(all_of FeatureStdExtZimop),
+ "'Zimop' (May-Be-Operations)">;
def FeatureStdExtZicfilp
: SubtargetFeature<"experimental-zicfilp", "HasStdExtZicfilp", "true",
"'Zicfilp' (Landing pad)">;
def HasStdExtZicfilp : Predicate<"Subtarget->hasStdExtZicfilp()">,
- AssemblerPredicate<(all_of FeatureStdExtZicfilp),
- "'Zicfilp' (Landing pad)">;
+ AssemblerPredicate<(all_of FeatureStdExtZicfilp),
+ "'Zicfilp' (Landing pad)">;
def FeatureStdExtZicfiss
: SubtargetFeature<"experimental-zicfiss", "HasStdExtZicfiss", "true",
"'Zicfiss' (Shadow stack)",
[FeatureStdExtZicsr, FeatureStdExtZimop]>;
def HasStdExtZicfiss : Predicate<"Subtarget->hasStdExtZicfiss()">,
- AssemblerPredicate<(all_of FeatureStdExtZicfiss),
- "'Zicfiss' (Shadow stack)">;
+ AssemblerPredicate<(all_of FeatureStdExtZicfiss),
+ "'Zicfiss' (Shadow stack)">;
def NoHasStdExtZicfiss : Predicate<"!Subtarget->hasStdExtZicfiss()">;
// Multiply Extensions
@@ -132,8 +132,8 @@ def FeatureStdExtM
: SubtargetFeature<"m", "HasStdExtM", "true",
"'M' (Integer Multiplication and Division)">;
def HasStdExtM : Predicate<"Subtarget->hasStdExtM()">,
- AssemblerPredicate<(all_of FeatureStdExtM),
- "'M' (Integer Multiplication and Division)">;
+ AssemblerPredicate<(all_of FeatureStdExtM),
+ "'M' (Integer Multiplication and Division)">;
def FeatureStdExtZmmul
: SubtargetFeature<"zmmul", "HasStdExtZmmul", "true",
@@ -141,9 +141,9 @@ def FeatureStdExtZmmul
def HasStdExtMOrZmmul
: Predicate<"Subtarget->hasStdExtM() || Subtarget->hasStdExtZmmul()">,
- AssemblerPredicate<(any_of FeatureStdExtM, FeatureStdExtZmmul),
- "'M' (Integer Multiplication and Division) or "
- "'Zmmul' (Integer Multiplication)">;
+ AssemblerPredicate<(any_of FeatureStdExtM, FeatureStdExtZmmul),
+ "'M' (Integer Multiplication and Division) or "
+ "'Zmmul' (Integer Multiplication)">;
// Atomic Extensions
@@ -151,15 +151,15 @@ def FeatureStdExtA
: SubtargetFeature<"a", "HasStdExtA", "true",
"'A' (Atomic Instructions)">;
def HasStdExtA : Predicate<"Subtarget->hasStdExtA()">,
- AssemblerPredicate<(all_of FeatureStdExtA),
- "'A' (Atomic Instructions)">;
+ AssemblerPredicate<(all_of FeatureStdExtA),
+ "'A' (Atomic Instructions)">;
def FeatureStdExtZtso
: SubtargetFeature<"experimental-ztso", "HasStdExtZtso", "true",
"'Ztso' (Memory Model - Total Store Order)">;
def HasStdExtZtso : Predicate<"Subtarget->hasStdExtZtso()">,
- AssemblerPredicate<(all_of FeatureStdExtZtso),
- "'Ztso' (Memory Model - Total Store Order)">;
+ AssemblerPredicate<(all_of FeatureStdExtZtso),
+ "'Ztso' (Memory Model - Total Store Order)">;
def NotHasStdExtZtso : Predicate<"!Subtarget->hasStdExtZtso()">;
def FeatureStdExtZa64rs : SubtargetFeature<"za64rs", "HasStdExtZa64rs", "true",
@@ -172,15 +172,15 @@ def FeatureStdExtZacas
: SubtargetFeature<"experimental-zacas", "HasStdExtZacas", "true",
"'Zacas' (Atomic Compare-And-Swap Instructions)">;
def HasStdExtZacas : Predicate<"Subtarget->hasStdExtZacas()">,
- AssemblerPredicate<(all_of FeatureStdExtZacas),
- "'Zacas' (Atomic Compare-And-Swap Instructions)">;
+ AssemblerPredicate<(all_of FeatureStdExtZacas),
+ "'Zacas' (Atomic Compare-And-Swap Instructions)">;
def NoStdExtZacas : Predicate<"!Subtarget->hasStdExtZacas()">;
def FeatureStdExtZawrs : SubtargetFeature<"zawrs", "HasStdExtZawrs", "true",
"'Zawrs' (Wait on Reservation Set)">;
def HasStdExtZawrs : Predicate<"Subtarget->hasStdExtZawrs()">,
- AssemblerPredicate<(all_of FeatureStdExtZawrs),
- "'Zawrs' (Wait on Reservation Set)">;
+ AssemblerPredicate<(all_of FeatureStdExtZawrs),
+ "'Zawrs' (Wait on Reservation Set)">;
// Floating Point Extensions
@@ -189,41 +189,41 @@ def FeatureStdExtF
"'F' (Single-Precision Floating-Point)",
[FeatureStdExtZicsr]>;
def HasStdExtF : Predicate<"Subtarget->hasStdExtF()">,
- AssemblerPredicate<(all_of FeatureStdExtF),
- "'F' (Single-Precision Floating-Point)">;
+ AssemblerPredicate<(all_of FeatureStdExtF),
+ "'F' (Single-Precision Floating-Point)">;
def FeatureStdExtD
: SubtargetFeature<"d", "HasStdExtD", "true",
"'D' (Double-Precision Floating-Point)",
[FeatureStdExtF]>;
def HasStdExtD : Predicate<"Subtarget->hasStdExtD()">,
- AssemblerPredicate<(all_of FeatureStdExtD),
- "'D' (Double-Precision Floating-Point)">;
+ AssemblerPredicate<(all_of FeatureStdExtD),
+ "'D' (Double-Precision Floating-Point)">;
def FeatureStdExtH
: SubtargetFeature<"h", "HasStdExtH", "true",
"'H' (Hypervisor)">;
def HasStdExtH : Predicate<"Subtarget->hasStdExtH()">,
- AssemblerPredicate<(all_of FeatureStdExtH),
- "'H' (Hypervisor)">;
+ AssemblerPredicate<(all_of FeatureStdExtH),
+ "'H' (Hypervisor)">;
def FeatureStdExtZfhmin
: SubtargetFeature<"zfhmin", "HasStdExtZfhmin", "true",
"'Zfhmin' (Half-Precision Floating-Point Minimal)",
[FeatureStdExtF]>;
def HasStdExtZfhmin : Predicate<"Subtarget->hasStdExtZfhmin()">,
- AssemblerPredicate<(all_of FeatureStdExtZfhmin),
- "'Zfh' (Half-Precision Floating-Point) or "
- "'Zfhmin' (Half-Precision Floating-Point Minimal)">;
+ AssemblerPredicate<(all_of FeatureStdExtZfhmin),
+ "'Zfh' (Half-Precision Floating-Point) or "
+ "'Zfhmin' (Half-Precision Floating-Point Minimal)">;
def FeatureStdExtZfh
: SubtargetFeature<"zfh", "HasStdExtZfh", "true",
"'Zfh' (Half-Precision Floating-Point)",
[FeatureStdExtZfhmin]>;
def HasStdExtZfh : Predicate<"Subtarget->hasStdExtZfh()">,
- AssemblerPredicate<(all_of FeatureStdExtZfh),
- "'Zfh' (Half-Precision Floating-Point)">;
+ AssemblerPredicate<(all_of FeatureStdExtZfh),
+ "'Zfh' (Half-Precision Floating-Point)">;
def NoStdExtZfh : Predicate<"!Subtarget->hasStdExtZfh()">;
def FeatureStdExtZfbfmin
@@ -231,14 +231,14 @@ def FeatureStdExtZfbfmin
"'Zfbfmin' (Scalar BF16 Converts)",
[FeatureStdExtF]>;
def HasStdExtZfbfmin : Predicate<"Subtarget->hasStdExtZfbfmin()">,
- AssemblerPredicate<(all_of FeatureStdExtZfbfmin),
- "'Zfbfmin' (Scalar BF16 Converts)">;
+ AssemblerPredicate<(all_of FeatureStdExtZfbfmin),
+ "'Zfbfmin' (Scalar BF16 Converts)">;
def HasHalfFPLoadStoreMove
: Predicate<"Subtarget->hasHalfFPLoadStoreMove()">,
- AssemblerPredicate<(any_of FeatureStdExtZfh, FeatureStdExtZfhmin,
- FeatureStdExtZfbfmin),
- "'Zfh' (Half-Precision Floating-Point) or "
+ AssemblerPredicate<(any_of FeatureStdExtZfh, FeatureStdExtZfhmin,
+ FeatureStdExtZfbfmin),
+ "'Zfh' (Half-Precision Floating-Point) or "
"'Zfhmin' (Half-Precision Floating-Point Minimal) or "
"'Zfbfmin' (Scalar BF16 Converts)">;
@@ -247,41 +247,41 @@ def FeatureStdExtZfa
"'Zfa' (Additional Floating-Point)",
[FeatureStdExtF]>;
def HasStdExtZfa : Predicate<"Subtarget->hasStdExtZfa()">,
- AssemblerPredicate<(all_of FeatureStdExtZfa),
- "'Zfa' (Additional Floating-Point)">;
+ AssemblerPredicate<(all_of FeatureStdExtZfa),
+ "'Zfa' (Additional Floating-Point)">;
def FeatureStdExtZfinx
: SubtargetFeature<"zfinx", "HasStdExtZfinx", "true",
"'Zfinx' (Float in Integer)",
[FeatureStdExtZicsr]>;
def HasStdExtZfinx : Predicate<"Subtarget->hasStdExtZfinx()">,
- AssemblerPredicate<(all_of FeatureStdExtZfinx),
- "'Zfinx' (Float in Integer)">;
+ AssemblerPredicate<(all_of FeatureStdExtZfinx),
+ "'Zfinx' (Float in Integer)">;
def FeatureStdExtZdinx
: SubtargetFeature<"zdinx", "HasStdExtZdinx", "true",
"'Zdinx' (Double in Integer)",
[FeatureStdExtZfinx]>;
def HasStdExtZdinx : Predicate<"Subtarget->hasStdExtZdinx()">,
- AssemblerPredicate<(all_of FeatureStdExtZdinx),
- "'Zdinx' (Double in Integer)">;
+ AssemblerPredicate<(all_of FeatureStdExtZdinx),
+ "'Zdinx' (Double in Integer)">;
def FeatureStdExtZhinxmin
: SubtargetFeature<"zhinxmin", "HasStdExtZhinxmin", "true",
"'Zhinxmin' (Half Float in Integer Minimal)",
[FeatureStdExtZfinx]>;
def HasStdExtZhinxmin : Predicate<"Subtarget->hasStdExtZhinxmin()">,
- AssemblerPredicate<(all_of FeatureStdExtZhinxmin),
- "'Zhinx' (Half Float in Integer) or "
- "'Zhinxmin' (Half Float in Integer Minimal)">;
+ AssemblerPredicate<(all_of FeatureStdExtZhinxmin),
+ "'Zhinx' (Half Float in Integer) or "
+ "'Zhinxmin' (Half Float in Integer Minimal)">;
def FeatureStdExtZhinx
: SubtargetFeature<"zhinx", "HasStdExtZhinx", "true",
"'Zhinx' (Half Float in Integer)",
[FeatureStdExtZhinxmin]>;
def HasStdExtZhinx : Predicate<"Subtarget->hasStdExtZhinx()">,
- AssemblerPredicate<(all_of FeatureStdExtZhinx),
- "'Zhinx' (Half Float in Integer)">;
+ AssemblerPredicate<(all_of FeatureStdExtZhinx),
+ "'Zhinx' (Half Float in Integer)">;
def NoStdExtZhinx : Predicate<"!Subtarget->hasStdExtZhinx()">;
// Compressed Extensions
@@ -290,15 +290,15 @@ def FeatureStdExtC
: SubtargetFeature<"c", "HasStdExtC", "true",
"'C' (Compressed Instructions)">;
def HasStdExtC : Predicate<"Subtarget->hasStdExtC()">,
- AssemblerPredicate<(all_of FeatureStdExtC),
- "'C' (Compressed Instructions)">;
+ AssemblerPredicate<(all_of FeatureStdExtC),
+ "'C' (Compressed Instructions)">;
def FeatureNoRVCHints
: SubtargetFeature<"no-rvc-hints", "EnableRVCHintInstrs", "false",
"Disable RVC Hint Instructions.">;
def HasRVCHints : Predicate<"Subtarget->enableRVCHintInstrs()">,
AssemblerPredicate<(all_of(not FeatureNoRVCHints)),
- "RVC Hint Instructions">;
+ "RVC Hint Instructions">;
def FeatureStdExtZca
: SubtargetFeature<"zca", "HasStdExtZca", "true",
@@ -307,18 +307,18 @@ def FeatureStdExtZca
def HasStdExtCOrZca
: Predicate<"Subtarget->hasStdExtCOrZca()">,
- AssemblerPredicate<(any_of FeatureStdExtC, FeatureStdExtZca),
- "'C' (Compressed Instructions) or "
- "'Zca' (part of the C extension, excluding "
- "compressed floating point loads/stores)">;
+ AssemblerPredicate<(any_of FeatureStdExtC, FeatureStdExtZca),
+ "'C' (Compressed Instructions) or "
+ "'Zca' (part of the C extension, excluding "
+ "compressed floating point loads/stores)">;
def FeatureStdExtZcb
: SubtargetFeature<"zcb", "HasStdExtZcb", "true",
"'Zcb' (Compressed basic bit manipulation instructions)",
[FeatureStdExtZca]>;
def HasStdExtZcb : Predicate<"Subtarget->hasStdExtZcb()">,
- AssemblerPredicate<(all_of FeatureStdExtZcb),
- "'Zcb' (Compressed basic bit manipulation instructions)">;
+ AssemblerPredicate<(all_of FeatureStdExtZcb),
+ "'Zcb' (Compressed basic bit manipulation instructions)">;
def FeatureStdExtZcd
: SubtargetFeature<"zcd", "HasStdExtZcd", "true",
@@ -327,9 +327,9 @@ def FeatureStdExtZcd
def HasStdExtCOrZcd
: Predicate<"Subtarget->hasStdExtC() || Subtarget->hasStdExtZcd()">,
- AssemblerPredicate<(any_of FeatureStdExtC, FeatureStdExtZcd),
- "'C' (Compressed Instructions) or "
- "'Zcd' (Compressed Double-Precision Floating-Point Instructions)">;
+ AssemblerPredicate<(any_of FeatureStdExtC, FeatureStdExtZcd),
+ "'C' (Compressed Instructions) or ...
[truncated]
|
AssemblerPredicate<(all_of Feature64Bit), | ||
"RV64I Base Instruction Set">; | ||
AssemblerPredicate<(all_of Feature64Bit), | ||
"RV64I Base Instruction Set">; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this line supposed to have two more spaces to be aligned with the start of all_of
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edit: i mean the (
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nits.
AssemblerPredicate<(all_of FeatureStdExtZicfilp), | ||
"'Zicfilp' (Landing pad)">; | ||
AssemblerPredicate<(all_of FeatureStdExtZicfilp), | ||
"'Zicfilp' (Landing pad)">; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a space here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better, thank you!
AssemblerPredicate was almost always indented to the same column as the first operand to Predicate. But AssemblerPredicate is a separate base class so should have the same indentation as Predicate.
For the string passed to AssemblePredicate, I aligned it to the other arguments on the previous if it fit in 80 columns. Otherwise I indented 4 spaces past the start of AssemblerPredicate.
For some vendor extensions I put the 2 classes on new lines instead of the same line as the def. This gave more room for the strings and was more consistent with other formatting in that portion of the file.