Expand the mask capability for deciding which functions are mips16 and mips32
[oota-llvm.git] / lib / Target / Mips / MipsOs16.cpp
index 5f9b60c6608f52016a0c542b33177c439fe757d3..49c73b561425e36ef51d06d43c2a4d1d7fa8aad8 100644 (file)
@@ -103,8 +103,9 @@ bool MipsOs16::runOnModule(Module &M) {
     if (F->isDeclaration()) continue;
     DEBUG(dbgs() << "Working on " << F->getName() << "\n");
     if (usingMask) {
-      if ((functionIndex < Mips32FunctionMask.length()) &&
-          (Mips32FunctionMask[functionIndex] == '1')) {
+      if (functionIndex == Mips32FunctionMask.length())
+        functionIndex = 0;
+      if (Mips32FunctionMask[functionIndex] == '1') {
         DEBUG(dbgs() << "mask forced mips32: " << F->getName() << "\n");
         F->addFnAttr("nomips16");
       }