[llvm-commits] [SignlessTypes] CVS: llvm/lib/Target/CBackend/Writer.cpp

Zhou Sheng zhousheng00 at gmail.com
Sun Oct 29 00:36:13 PDT 2006



Changes in directory llvm/lib/Target/CBackend:

Writer.cpp updated: 1.272.2.7 -> 1.272.2.8
---
Log message:



---
Diffs of the changes:  (+13 -5)

 Writer.cpp |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)


Index: llvm/lib/Target/CBackend/Writer.cpp
diff -u llvm/lib/Target/CBackend/Writer.cpp:1.272.2.7 llvm/lib/Target/CBackend/Writer.cpp:1.272.2.8
--- llvm/lib/Target/CBackend/Writer.cpp:1.272.2.7	Wed Oct 25 20:58:05 2006
+++ llvm/lib/Target/CBackend/Writer.cpp	Sun Oct 29 01:35:49 2006
@@ -592,10 +592,10 @@
     case Instruction::Mul:
     case Instruction::URem:
     case Instruction::SRem:
+    case Instruction::FRem:
     case Instruction::SDiv:
     case Instruction::UDiv:
     case Instruction::FDiv:
-    case Instruction::FRem:
     case Instruction::And:
     case Instruction::Or:
     case Instruction::Xor:
@@ -607,6 +607,7 @@
     case Instruction::SetGE:
     case Instruction::Shl:
     case Instruction::Shr:
+    {
       Out << '(';
       bool NeedsClosingParens = printConstExprCast(CE); 
       printConstantWithCast(CE->getOperand(0), CE->getOpcode());
@@ -638,6 +639,7 @@
         Out << "))";
       Out << ')';
       return;
+    }
 
     default:
       std::cerr << "CWriter Error: Unhandled constant expression: "
@@ -827,7 +829,9 @@
   bool Result = false;
   const Type* Ty = CE->getOperand(0)->getType();
   switch (CE->getOpcode()) {
+  case Instruction::URem:
   case Instruction::UDiv: Result = Ty->isSigned(); break;
+  case Instruction::SRem:
   case Instruction::SDiv: Result = Ty->isUnsigned(); break;
   default: break;
   }
@@ -857,6 +861,7 @@
     default:
       // for most instructions, it doesn't matter
       break; 
+    case Instruction::URem:
     case Instruction::UDiv:
       // For UDiv to have unsigned operands
       if (OpTy->isSigned()) {
@@ -864,6 +869,7 @@
         shouldCast = true;
       }
       break;
+    case Instruction::SRem:
     case Instruction::SDiv:
       if (OpTy->isUnsigned()) {
         OpTy = OpTy->getSignedVersion();
@@ -921,7 +927,9 @@
   bool Result = false;
   const Type* Ty = I.getOperand(0)->getType();
   switch (I.getOpcode()) {
+  case Instruction::URem:
   case Instruction::UDiv: Result = Ty->isSigned(); break;
+  case Instruction::SRem:
   case Instruction::SDiv: Result = Ty->isUnsigned(); break;
   default: break;
   }
@@ -951,6 +959,7 @@
     default:
       // for most instructions, it doesn't matter
       break; 
+    case Instruction::URem:
     case Instruction::UDiv:
       // For UDiv to have unsigned operands
       if (OpTy->isSigned()) {
@@ -958,6 +967,7 @@
         shouldCast = true;
       }
       break;
+    case Instruction::SRem:
     case Instruction::SDiv:
       if (OpTy->isUnsigned()) {
         OpTy = OpTy->getSignedVersion();
@@ -1776,8 +1786,7 @@
     Out << "-(";
     writeOperand(BinaryOperator::getNegArgument(cast<BinaryOperator>(&I)));
     Out << ")";
-  } else if ((I.getOpcode() == Instruction::URem  ||
-              I.getOpcode() == Instruction::SRem) && 
+  } else if (I.getOpcode() == Instruction::FRem && 
              I.getType()->isFloatingPoint()) {
     // Output a call to fmod/fmodf instead of emitting a%b
     if (I.getType() == Type::FloatTy)
@@ -1804,8 +1813,7 @@
     case Instruction::Sub: Out << " - "; break;
     case Instruction::Mul: Out << '*'; break;
     case Instruction::URem:
-    case Instruction::SRem:
-    case Instruction::FRem: Out << '%'; break;
+    case Instruction::SRem:Out << '%'; break;
     case Instruction::UDiv:
     case Instruction::SDiv: 
     case Instruction::FDiv: Out << '/'; break;






More information about the llvm-commits mailing list