[llvm] r191231 - Make nomips16 mask not repeat if it ends with a '.'.

Reed Kotler rkotler at mips.com
Mon Sep 23 15:36:11 PDT 2013


Author: rkotler
Date: Mon Sep 23 17:36:11 2013
New Revision: 191231

URL: http://llvm.org/viewvc/llvm-project?rev=191231&view=rev
Log:
Make nomips16 mask not repeat if it ends with a '.'.
This mask is purely for debugging and testing.


Modified:
    llvm/trunk/lib/Target/Mips/MipsOs16.cpp
    llvm/trunk/test/CodeGen/Mips/fp16mix.ll

Modified: llvm/trunk/lib/Target/Mips/MipsOs16.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsOs16.cpp?rev=191231&r1=191230&r2=191231&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsOs16.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsOs16.cpp Mon Sep 23 17:36:11 2013
@@ -94,6 +94,7 @@ namespace llvm {
 
 bool MipsOs16::runOnModule(Module &M) {
   bool usingMask = Mips32FunctionMask.length() > 0;
+  bool doneUsingMask = false; // this will make it stop repeating
   DEBUG(dbgs() << "Run on Module MipsOs16 \n" << Mips32FunctionMask << "\n");
   if (usingMask)
     DEBUG(dbgs() << "using mask \n" << Mips32FunctionMask << "\n");
@@ -103,13 +104,22 @@ bool MipsOs16::runOnModule(Module &M) {
     if (F->isDeclaration()) continue;
     DEBUG(dbgs() << "Working on " << F->getName() << "\n");
     if (usingMask) {
-      if (functionIndex == Mips32FunctionMask.length())
-        functionIndex = 0;
-      if (Mips32FunctionMask[functionIndex] == '1') {
-        DEBUG(dbgs() << "mask forced mips32: " << F->getName() << "\n");
-        F->addFnAttr("nomips16");
+      if (!doneUsingMask) {
+        if (functionIndex == Mips32FunctionMask.length())
+          functionIndex = 0;
+        switch (Mips32FunctionMask[functionIndex]) {
+        case '1':
+          DEBUG(dbgs() << "mask forced mips32: " << F->getName() << "\n");
+          F->addFnAttr("nomips16");
+          break;
+        case '.':
+          doneUsingMask = true;
+          break;
+        default:
+          break;
+        }
+        functionIndex++;
       }
-      functionIndex++;
     }
     else {
       if (needsFP(*F)) {

Modified: llvm/trunk/test/CodeGen/Mips/fp16mix.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/fp16mix.ll?rev=191231&r1=191230&r2=191231&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/fp16mix.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/fp16mix.ll Mon Sep 23 17:36:11 2013
@@ -2,6 +2,8 @@
 
 ; RUN: llc -mtriple=mipsel-linux-gnu -march=mipsel -mcpu=mips16 -soft-float -mips16-hard-float -relocation-model=static -mips32-function-mask=01 -mips-os16 < %s | FileCheck %s -check-prefix=fmask2 
 
+; RUN: llc -mtriple=mipsel-linux-gnu -march=mipsel -mcpu=mips16 -soft-float -mips16-hard-float -relocation-model=static -mips32-function-mask=10. -mips-os16 < %s | FileCheck %s -check-prefix=fmask1nr
+
 ; Function Attrs: nounwind optsize readnone
 define void @foo1()  {
 entry:
@@ -17,6 +19,14 @@ entry:
 ; fmask2: .ent	foo1
 ; fmask2: save	{{.*}}
 ; fmask2: .end	foo1
+; fmask1nr: .ent foo1
+; fmask1nr: .set	noreorder
+; fmask1nr: .set	nomacro
+; fmask1nr: .set	noat
+; fmask1nr: .set	at
+; fmask1nr: .set	macro
+; fmask1nr: .set	reorder
+; fmask1nr: .end	foo1
 }
 
 ; Function Attrs: nounwind optsize readnone
@@ -34,6 +44,9 @@ entry:
 ; fmask1: .ent	foo2
 ; fmask1: save	{{.*}}
 ; fmask1: .end	foo2
+; fmask1nr: .ent	foo2
+; fmask1nr: save	{{.*}}
+; fmask1nr: .end	foo2
 }
 
 ; Function Attrs: nounwind optsize readnone
@@ -51,6 +64,9 @@ entry:
 ; fmask2:  .ent	foo3
 ; fmask2:  save	{{.*}}
 ; fmask2:  .end	foo3
+; fmask1r:  .ent	foo3
+; fmask1r:  save	{{.*}}
+; fmask1r:  .end	foo3
 }
 
 ; Function Attrs: nounwind optsize readnone
@@ -68,6 +84,9 @@ entry:
 ; fmask1: .ent	foo4
 ; fmask1: save	{{.*}}
 ; fmask1: .end	foo4
+; fmask1nr: .ent	foo4
+; fmask1nr: save	{{.*}}
+; fmask1nr: .end	foo4
 }
 
 





More information about the llvm-commits mailing list