Add support for the PowerPC-specific inline asm Z constraint and y modifier.
[oota-llvm.git] / lib / Target / PowerPC / PPCISelLowering.cpp
index 0922011d97c062ef04fa057625182632cb477aad..cda7e8cdc1969cc9780f8a5684a175ad6a3ecf41 100644 (file)
@@ -6443,6 +6443,14 @@ PPCTargetLowering::getConstraintType(const std::string &Constraint) const {
     case 'v':
     case 'y':
       return C_RegisterClass;
+    case 'Z':
+      // FIXME: While Z does indicate a memory constraint, it specifically
+      // indicates an r+r address (used in conjunction with the 'y' modifier
+      // in the replacement string). Currently, we're forcing the base
+      // register to be r0 in the asm printer (which is interpreted as zero)
+      // and forming the complete address in the second register. This is
+      // suboptimal.
+      return C_Memory;
     }
   }
   return TargetLowering::getConstraintType(Constraint);
@@ -6485,6 +6493,9 @@ PPCTargetLowering::getSingleConstraintMatchWeight(
   case 'y':
     weight = CW_Register;
     break;
+  case 'Z':
+    weight = CW_Memory;
+    break;
   }
   return weight;
 }