[llvm] r288524 - [SystemZ] Refactor hasSideEffects setting

Ulrich Weigand via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 2 10:19:23 PST 2016


Author: uweigand
Date: Fri Dec  2 12:19:22 2016
New Revision: 288524

URL: http://llvm.org/viewvc/llvm-project?rev=288524&view=rev
Log:
[SystemZ] Refactor hasSideEffects setting

Move setting of hasSideEffects out of SystemZInstrFormats.td,
to allow use of the format classes for instructions where this
flag shouldn't be set.  NFC.


Modified:
    llvm/trunk/lib/Target/SystemZ/SystemZInstrFormats.td
    llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.td

Modified: llvm/trunk/lib/Target/SystemZ/SystemZInstrFormats.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZInstrFormats.td?rev=288524&r1=288523&r2=288524&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZInstrFormats.td (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZInstrFormats.td Fri Dec  2 12:19:22 2016
@@ -1684,14 +1684,11 @@ class StoreInherentS<string mnemonic, bi
 }
 
 class SideEffectInherentE<string mnemonic, bits<16>opcode>
-  : InstE<opcode, (outs), (ins), mnemonic, []> {
-  let hasSideEffects = 1;
-}
+  : InstE<opcode, (outs), (ins), mnemonic, []>;
 
 class SideEffectInherentS<string mnemonic, bits<16> opcode,
                           SDPatternOperator operator>
   : InstS<opcode, (outs), (ins), mnemonic, [(operator)]> {
-  let hasSideEffects = 1;
   let BD2 = 0;
 }
 
@@ -2260,23 +2257,18 @@ multiclass CondStoreRSYPair<string mnemo
 
 class SideEffectUnaryI<string mnemonic, bits<8> opcode, Immediate imm>
   : InstI<opcode, (outs), (ins imm:$I1),
-          mnemonic#"\t$I1", []> {
-  let hasSideEffects = 1;
-}
+          mnemonic#"\t$I1", []>;
 
 class SideEffectUnaryRR<string mnemonic, bits<8>opcode, RegisterOperand cls>
   : InstRR<opcode, (outs), (ins cls:$R1),
            mnemonic#"\t$R1", []> {
-  let hasSideEffects = 1;
   let R2 = 0;
 }
 
 class SideEffectUnaryS<string mnemonic, bits<16> opcode,
                        SDPatternOperator operator>
   : InstS<opcode, (outs), (ins bdaddr12only:$BD2),
-          mnemonic#"\t$BD2", [(operator bdaddr12only:$BD2)]> {
-  let hasSideEffects = 1;
-}
+          mnemonic#"\t$BD2", [(operator bdaddr12only:$BD2)]>;
 
 class LoadAddressRX<string mnemonic, bits<8> opcode,
                     SDPatternOperator operator, AddressingMode mode>
@@ -2537,15 +2529,12 @@ class UnaryVRXGeneric<string mnemonic, b
 class SideEffectBinaryRX<string mnemonic, bits<8> opcode,
                          RegisterOperand cls>
   : InstRXa<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2),
-            mnemonic##"\t$R1, $XBD2", []> {
-  let hasSideEffects = 1;
-}
+            mnemonic##"\t$R1, $XBD2", []>;
 
 class SideEffectBinaryRILPC<string mnemonic, bits<12> opcode,
                             RegisterOperand cls>
   : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2),
              mnemonic##"\t$R1, $RI2", []> {
-  let hasSideEffects = 1;
   // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
   // However, BDXs have two extra operands and are therefore 6 units more
   // complex.
@@ -2555,16 +2544,12 @@ class SideEffectBinaryRILPC<string mnemo
 class SideEffectBinaryIE<string mnemonic, bits<16> opcode,
                          Immediate imm1, Immediate imm2>
   : InstIE<opcode, (outs), (ins imm1:$I1, imm2:$I2),
-           mnemonic#"\t$I1, $I2", []> {
-  let hasSideEffects = 1;
-}
+           mnemonic#"\t$I1, $I2", []>;
 
 class SideEffectBinarySIL<string mnemonic, bits<16> opcode,
                           SDPatternOperator operator, Immediate imm>
   : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2),
-            mnemonic#"\t$BD1, $I2", [(operator bdaddr12only:$BD1, imm:$I2)]> {
-  let hasSideEffects = 1;
-}
+            mnemonic#"\t$BD1, $I2", [(operator bdaddr12only:$BD1, imm:$I2)]>;
 
 class BinaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
                RegisterOperand cls1, RegisterOperand cls2>
@@ -3287,17 +3272,13 @@ class SideEffectTernaryRRFc<string mnemo
                             RegisterOperand cls1, RegisterOperand cls2,
                             Immediate imm>
   : InstRRFc<opcode, (outs), (ins cls1:$R1, cls2:$R2, imm:$M3),
-             mnemonic#"\t$R1, $R2, $M3", []> {
-  let hasSideEffects = 1;
-}
+             mnemonic#"\t$R1, $R2, $M3", []>;
 
 class SideEffectTernarySSF<string mnemonic, bits<12> opcode,
                            RegisterOperand cls>
   : InstSSF<opcode, (outs),
             (ins bdaddr12only:$BD1, bdaddr12only:$BD2, cls:$R3),
-            mnemonic#"\t$BD1, $BD2, $R3", []> {
-  let hasSideEffects = 1;
-}
+            mnemonic#"\t$BD1, $BD2, $R3", []>;
 
 class TernaryRRFe<string mnemonic, bits<16> opcode, RegisterOperand cls1,
                   RegisterOperand cls2>
@@ -3716,9 +3697,7 @@ class Pseudo<dag outs, dag ins, list<dag
 // Like SideEffectBinarySIL, but expanded later.
 class SideEffectBinarySILPseudo<SDPatternOperator operator, Immediate imm>
   : Pseudo<(outs), (ins bdaddr12only:$BD1, imm:$I2),
-           [(operator bdaddr12only:$BD1, imm:$I2)]> {
-  let hasSideEffects = 1;
-}
+           [(operator bdaddr12only:$BD1, imm:$I2)]>;
 
 // Like UnaryRI, but expanded after RA depending on the choice of register.
 class UnaryRIPseudo<SDPatternOperator operator, RegisterOperand cls,

Modified: llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.td?rev=288524&r1=288523&r2=288524&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.td (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.td Fri Dec  2 12:19:22 2016
@@ -1584,7 +1584,7 @@ let Uses = [CC] in
   def IPM : InherentRRE<"ipm", 0xB222, GR32, z_ipm>;
 
 // Set CC and program mask from a register.
-let Defs = [CC] in
+let hasSideEffects = 1, Defs = [CC] in
   def SPM : SideEffectUnaryRR<"spm", 0x04, GR32>;
 
 // Branch and link - like BAS, but also extracts CC and program mask.
@@ -1598,9 +1598,11 @@ let Defs = [CC] in
   def TAM : SideEffectInherentE<"tam", 0x010B>;
 
 // Set addressing mode.
-def SAM24 : SideEffectInherentE<"sam24", 0x010C>;
-def SAM31 : SideEffectInherentE<"sam31", 0x010D>;
-def SAM64 : SideEffectInherentE<"sam64", 0x010E>;
+let hasSideEffects = 1 in {
+  def SAM24 : SideEffectInherentE<"sam24", 0x010C>;
+  def SAM31 : SideEffectInherentE<"sam31", 0x010D>;
+  def SAM64 : SideEffectInherentE<"sam64", 0x010E>;
+}
 
 // Branch and set mode.  Not really a call, but also sets an output register.
 let isBranch = 1, isTerminator = 1, isBarrier = 1 in
@@ -1614,7 +1616,7 @@ let isCall = 1, Defs = [CC] in
 // Transactional execution
 //===----------------------------------------------------------------------===//
 
-let Predicates = [FeatureTransactionalExecution] in {
+let hasSideEffects = 1, Predicates = [FeatureTransactionalExecution] in {
   // Transaction Begin
   let mayStore = 1, usesCustomInserter = 1, Defs = [CC] in {
     def TBEGIN : SideEffectBinarySIL<"tbegin", 0xE560, z_tbegin, imm32zx16>;
@@ -1633,12 +1635,10 @@ let Predicates = [FeatureTransactionalEx
     def TABORT : SideEffectUnaryS<"tabort", 0xB2FC, int_s390_tabort>;
 
   // Nontransactional Store
-  let hasSideEffects = 1 in
-    def NTSTG : StoreRXY<"ntstg", 0xE325, int_s390_ntstg, GR64, 8>;
+  def NTSTG : StoreRXY<"ntstg", 0xE325, int_s390_ntstg, GR64, 8>;
 
   // Extract Transaction Nesting Depth
-  let hasSideEffects = 1 in
-    def ETND : InherentRRE<"etnd", 0xB2EC, GR32, int_s390_etnd>;
+  def ETND : InherentRRE<"etnd", 0xB2EC, GR32, int_s390_etnd>;
 }
 
 //===----------------------------------------------------------------------===//
@@ -1646,7 +1646,8 @@ let Predicates = [FeatureTransactionalEx
 //===----------------------------------------------------------------------===//
 
 let Predicates = [FeatureProcessorAssist] in {
-  def PPA : SideEffectTernaryRRFc<"ppa", 0xB2E8, GR64, GR64, imm32zx4>;
+  let hasSideEffects = 1 in
+    def PPA : SideEffectTernaryRRFc<"ppa", 0xB2E8, GR64, GR64, imm32zx4>;
   def : Pat<(int_s390_ppa_txassist GR32:$src),
             (PPA (INSERT_SUBREG (i64 (IMPLICIT_DEF)), GR32:$src, subreg_l32),
                  0, 1)>;
@@ -1685,7 +1686,7 @@ let mayLoad = 1, Defs = [CC] in
   defm SRST : StringRRE<"srst", 0xb25e, z_search_string>;
 
 // Supervisor call.
-let isCall = 1, Defs = [CC] in
+let hasSideEffects = 1, isCall = 1, Defs = [CC] in
   def SVC : SideEffectUnaryI<"svc", 0x0A, imm32zx8>;
 
 // Store clock.
@@ -1700,15 +1701,17 @@ let hasSideEffects = 1, Defs = [CC] in
   def STFLE : StoreInherentS<"stfle", 0xB2B0>;
 
 // Extract CPU time.
-let Defs = [R0D, R1D], mayLoad = 1 in
+let Defs = [R0D, R1D], hasSideEffects = 1, mayLoad = 1 in
   def ECTG : SideEffectTernarySSF<"ectg", 0xC81, GR64>;
 
 // Execute.
-def EX   : SideEffectBinaryRX<"ex", 0x44, GR64>;
-def EXRL : SideEffectBinaryRILPC<"exrl", 0xC60, GR64>;
+let hasSideEffects = 1 in {
+  def EX   : SideEffectBinaryRX<"ex", 0x44, GR64>;
+  def EXRL : SideEffectBinaryRILPC<"exrl", 0xC60, GR64>;
+}
 
 // Program return.
-let Defs = [CC] in
+let hasSideEffects = 1, Defs = [CC] in
   def PR : SideEffectInherentE<"pr", 0x0101>;
 
 // Move with key.




More information about the llvm-commits mailing list