MIRParser/MIRPrinter: Compute HasInlineAsm instead of printing/parsing it
authorMatthias Braun <matze@braunis.de>
Wed, 24 Aug 2016 22:34:06 +0000 (22:34 +0000)
committerMatthias Braun <matze@braunis.de>
Wed, 24 Aug 2016 22:34:06 +0000 (22:34 +0000)
llvm-svn: 279680

22 files changed:
llvm/lib/CodeGen/MIRParser/MIRParser.cpp
llvm/lib/CodeGen/MIRPrinter.cpp
llvm/test/CodeGen/AArch64/ldst-opt-dbg-limit.mir
llvm/test/CodeGen/AArch64/movimm-wzr.mir
llvm/test/CodeGen/ARM/ARMLoadStoreDBG.mir
llvm/test/CodeGen/MIR/AArch64/inst-size-tlsdesc-callseq.mir
llvm/test/CodeGen/MIR/ARM/sched-it-debug-nodes.mir
llvm/test/CodeGen/MIR/Generic/machine-function.mir
llvm/test/CodeGen/MIR/Lanai/peephole-compare.mir
llvm/test/CodeGen/MIR/X86/def-register-already-tied-error.mir
llvm/test/CodeGen/MIR/X86/early-clobber-register-flag.mir
llvm/test/CodeGen/MIR/X86/expected-integer-after-tied-def.mir
llvm/test/CodeGen/MIR/X86/expected-tied-def-after-lparen.mir
llvm/test/CodeGen/MIR/X86/inline-asm-registers.mir
llvm/test/CodeGen/MIR/X86/invalid-tied-def-index-error.mir
llvm/test/CodeGen/MIR/X86/tied-def-operand-invalid.mir
llvm/test/CodeGen/PowerPC/aantidep-def-ec.mir
llvm/test/CodeGen/PowerPC/addisdtprelha-nonr3.mir
llvm/test/CodeGen/PowerPC/no-rlwimi-trivial-commute.mir
llvm/test/CodeGen/PowerPC/opt-sub-inst-cr0-live.mir
llvm/test/DebugInfo/MIR/X86/live-debug-values-3preds.mir
llvm/test/DebugInfo/MIR/X86/live-debug-values.mir

index f61b3c9..31bb1dc 100644 (file)
@@ -281,14 +281,6 @@ void MIRParserImpl::createDummyFunction(StringRef Name, Module &M) {
   new UnreachableInst(Context, BB);
 }
 
-static bool hasPHI(const MachineFunction &MF) {
-  for (const MachineBasicBlock &MBB : MF)
-    for (const MachineInstr &MI : MBB)
-      if (MI.isPHI())
-        return true;
-  return false;
-}
-
 static bool isSSA(const MachineFunction &MF) {
   const MachineRegisterInfo &MRI = MF.getRegInfo();
   for (unsigned I = 0, E = MRI.getNumVirtRegs(); I != E; ++I) {
@@ -301,8 +293,20 @@ static bool isSSA(const MachineFunction &MF) {
 
 void MIRParserImpl::computeFunctionProperties(MachineFunction &MF) {
   MachineFunctionProperties &Properties = MF.getProperties();
-  if (!hasPHI(MF))
+
+  bool HasPHI = false;
+  bool HasInlineAsm = false;
+  for (const MachineBasicBlock &MBB : MF) {
+    for (const MachineInstr &MI : MBB) {
+      if (MI.isPHI())
+        HasPHI = true;
+      if (MI.isInlineAsm())
+        HasInlineAsm = true;
+    }
+  }
+  if (!HasPHI)
     Properties.set(MachineFunctionProperties::Property::NoPHIs);
+  MF.setHasInlineAsm(HasInlineAsm);
 
   if (isSSA(MF))
     Properties.set(MachineFunctionProperties::Property::IsSSA);
@@ -320,7 +324,6 @@ bool MIRParserImpl::initializeMachineFunction(MachineFunction &MF) {
   if (YamlMF.Alignment)
     MF.setAlignment(YamlMF.Alignment);
   MF.setExposesReturnsTwice(YamlMF.ExposesReturnsTwice);
-  MF.setHasInlineAsm(YamlMF.HasInlineAsm);
   if (YamlMF.AllVRegsAllocated)
     MF.getProperties().set(MachineFunctionProperties::Property::AllVRegsAllocated);
 
index 795f1ca..1cd4eb9 100644 (file)
@@ -174,7 +174,6 @@ void MIRPrinter::print(const MachineFunction &MF) {
   YamlMF.Name = MF.getName();
   YamlMF.Alignment = MF.getAlignment();
   YamlMF.ExposesReturnsTwice = MF.exposesReturnsTwice();
-  YamlMF.HasInlineAsm = MF.hasInlineAsm();
   YamlMF.AllVRegsAllocated = MF.getProperties().hasProperty(
       MachineFunctionProperties::Property::AllVRegsAllocated);
 
index bb9bdb0..65d8acb 100644 (file)
@@ -28,7 +28,6 @@
 name:            promote-load-from-store
 alignment:       2
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: true
 tracksRegLiveness: false
 liveins:         
@@ -84,7 +83,6 @@ body:             |
 name:            store-pair
 alignment:       2
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: true
 tracksRegLiveness: false
 liveins:         
index 1264f26..c26643e 100644 (file)
@@ -15,7 +15,6 @@
 name:            test_mov_0
 alignment:       2
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: true
 tracksRegLiveness: false
 frameInfo:
index 2682daa..144961b 100644 (file)
@@ -79,7 +79,6 @@
 name:            f
 alignment:       1
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: true
 tracksRegLiveness: true
 liveins:
index 588ec5d..0ad0e9d 100644 (file)
@@ -33,7 +33,6 @@
 name:            test_tlsdesc_callseq_length
 alignment:       2
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: true
 tracksRegLiveness: false
 liveins:
index ca330cb..7a0d298 100644 (file)
@@ -90,7 +90,6 @@
 name:            f
 alignment:       1
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: true
 tracksRegLiveness: true
 liveins:
index 64802a1..f9001cc 100644 (file)
@@ -24,7 +24,6 @@
 # CHECK: name: foo
 # CHECK-NEXT: alignment:
 # CHECK-NEXT: exposesReturnsTwice: false
-# CHECK-NEXT: hasInlineAsm: false
 # CHECK: ...
 name:            foo
 body: |
@@ -34,7 +33,6 @@ body: |
 # CHECK: name: bar
 # CHECK-NEXT: alignment:
 # CHECK-NEXT: exposesReturnsTwice: false
-# CHECK-NEXT: hasInlineAsm: false
 # CHECK: ...
 name:            bar
 body: |
@@ -44,7 +42,6 @@ body: |
 # CHECK: name: func
 # CHECK-NEXT: alignment: 8
 # CHECK-NEXT: exposesReturnsTwice: false
-# CHECK-NEXT: hasInlineAsm: false
 # CHECK: ...
 name:            func
 alignment:       8
@@ -55,12 +52,10 @@ body: |
 # CHECK: name: func2
 # CHECK-NEXT: alignment: 16
 # CHECK-NEXT: exposesReturnsTwice: true
-# CHECK-NEXT: hasInlineAsm: true
 # CHECK: ...
 name:            func2
 alignment:       16
 exposesReturnsTwice: true
-hasInlineAsm:    true
 body: |
   bb.0:
 ...
index ddf4212..e9f2966 100644 (file)
 name:            test0a
 alignment:       2
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: false
 tracksRegLiveness: true
 registers:       
@@ -221,7 +220,6 @@ body:             |
 name:            test0b
 alignment:       2
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: false
 tracksRegLiveness: true
 registers:       
@@ -265,7 +263,6 @@ body:             |
 name:            test1a
 alignment:       2
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: false
 tracksRegLiveness: true
 registers:       
@@ -313,7 +310,6 @@ body:             |
 name:            test1b
 alignment:       2
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: false
 tracksRegLiveness: true
 registers:       
@@ -361,7 +357,6 @@ body:             |
 name:            test2a
 alignment:       2
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: false
 tracksRegLiveness: true
 registers:       
@@ -409,7 +404,6 @@ body:             |
 name:            test2b
 alignment:       2
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: false
 tracksRegLiveness: true
 registers:       
@@ -457,7 +451,6 @@ body:             |
 name:            test3
 alignment:       2
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: false
 tracksRegLiveness: true
 registers:       
@@ -505,7 +498,6 @@ body:             |
 name:            test4
 alignment:       2
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: false
 tracksRegLiveness: true
 registers:       
@@ -617,7 +609,6 @@ body:             |
 name:            testBB
 alignment:       2
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: false
 tracksRegLiveness: true
 registers:       
index bd9365b..fe0740e 100644 (file)
@@ -10,7 +10,6 @@
 ...
 ---
 name:            test
-hasInlineAsm:    true
 tracksRegLiveness: true
 liveins:
   - { reg: '%rdi' }
index 95b1057..2bc8250 100644 (file)
@@ -19,7 +19,6 @@
 ...
 ---
 name:            test
-hasInlineAsm:    true
 tracksRegLiveness: true
 liveins:
   - { reg: '%edi' }
index c3f4fca..a5c7b48 100644 (file)
@@ -10,7 +10,6 @@
 ...
 ---
 name:            test
-hasInlineAsm:    true
 tracksRegLiveness: true
 liveins:
   - { reg: '%rdi' }
index 9e307f8..fce8c1a 100644 (file)
@@ -10,7 +10,6 @@
 ...
 ---
 name:            test
-hasInlineAsm:    true
 tracksRegLiveness: true
 liveins:
   - { reg: '%rdi' }
index f0e8d1f..d84cebf 100644 (file)
@@ -19,7 +19,6 @@
 ...
 ---
 name:            test
-hasInlineAsm:    true
 tracksRegLiveness: true
 liveins:
   - { reg: '%rdi' }
@@ -36,7 +35,6 @@ body: |
 ...
 ---
 name:            test2
-hasInlineAsm:    true
 tracksRegLiveness: true
 liveins:
   - { reg: '%rdi' }
index 2ba3288..7a0994d 100644 (file)
@@ -10,7 +10,6 @@
 ...
 ---
 name:            test
-hasInlineAsm:    true
 tracksRegLiveness: true
 liveins:
   - { reg: '%rdi' }
index 05502ff..84a38bf 100644 (file)
@@ -10,7 +10,6 @@
 ...
 ---
 name:            test
-hasInlineAsm:    true
 tracksRegLiveness: true
 liveins:
   - { reg: '%rdi' }
index 9e750eb..a49251b 100644 (file)
@@ -44,7 +44,6 @@
 name:            mm_update_next_owner
 alignment:       4
 exposesReturnsTwice: false
-hasInlineAsm:    true
 allVRegsAllocated: true
 tracksRegLiveness: true
 liveins:         
index 0bf7b95..45ff51d 100644 (file)
@@ -26,7 +26,6 @@
 name:            test1
 alignment:       4
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: true
 tracksRegLiveness: true
 frameInfo:       
index dce1e04..bab2ff2 100644 (file)
@@ -39,7 +39,6 @@
 name:            main
 alignment:       2
 exposesReturnsTwice: false
-hasInlineAsm:    false
 tracksRegLiveness: true
 registers:       
   - { id: 0, class: g8rc_and_g8rc_nox0 }
index 619954e..d4b83b9 100644 (file)
@@ -32,7 +32,6 @@
 name:            fn1
 alignment:       2
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: false
 tracksRegLiveness: true
 registers:
index aaf1284..ea898ec 100644 (file)
 name:            add
 alignment:       4
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: true
 tracksRegLiveness: true
 liveins:         
index 750187e..920d653 100644 (file)
 name:            main
 alignment:       4
 exposesReturnsTwice: false
-hasInlineAsm:    false
 allVRegsAllocated: true
 tracksRegLiveness: true
 liveins: