[PATCH] [mips] [IAS] Add missing constraints and improve testing for the .module directive.

Daniel Sanders daniel.sanders at imgtec.com
Thu Feb 26 03:35:51 PST 2015


The code change looks correct to me but I think there's a problem with the test.


================
Comment at: test/MC/Mips/module-set-directives-bad.s:1-134
@@ +1,134 @@
+# RUN: not llvm-mc -triple mips-unknown-unknown %s 2>%t1
+# RUN: FileCheck %s < %t1
+
+    .set mips0
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set mips1
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set mips2
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set mips3
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set mips4
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set mips5
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set mips32
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set mips32r2
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set mips32r6
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set mips64
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set mips64r2
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set mips64r6
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set arch=mips32
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set mips16
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set nomips16
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set micromips
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set nomicromips
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set msa
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set nomsa
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set dsp
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set nodsp
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set push
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set pop
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set reorder
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set noreorder
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set macro
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set nomacro
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set at
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set at=$3
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set noat
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .set fp=32
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .cpload $25
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
+
+    .cpsetup $25, 8, __cerror
+    .module fp=32
+# CHECK: :[[@LINE-1]]:13: error: .module directive must appear before any code
----------------
I don't think this test covers what you think it does. It looks like it's only testing that '.set mips0' triggers the errors. All the subsequent errors will appear as a consequence of '.set mips0' regardless of whether those directives do the right thing.

I think we need a special directive for testing purposes to reset the flag in between each test (.llvm_internal_reallow_module_directive?). That way we can reset the flag between each subtest. The alternative is to have a separate file (and associated process overhead) for each subtest which seems unreasonable.

http://reviews.llvm.org/D7140

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list