For PR786:
Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting
fall out by removing unused variables. Remaining warnings have to do with
unused functions (I didn't want to delete code without review) and unused
variables in generated code. Maintainers should clean up the remaining
issues when they see them. All changes pass DejaGnu tests and Olden.

llvm-svn: 31380
diff --git a/llvm/lib/AsmParser/llvmAsmParser.y.cvs b/llvm/lib/AsmParser/llvmAsmParser.y.cvs
index 684b643..d40b653 100644
--- a/llvm/lib/AsmParser/llvmAsmParser.y.cvs
+++ b/llvm/lib/AsmParser/llvmAsmParser.y.cvs
@@ -836,7 +836,7 @@
   // Depending on the opcode ..
   switch (OI.opcode) {
     default:
-      GenerateError("Invalid Obsolete OpCode");
+      GenerateError("Invalid obsolete opCode (check Lexer.l)");
       break;
     case Instruction::UDiv:
       // Handle cases where the opcode needs to change
@@ -845,12 +845,17 @@
       else if (Ty->isSigned())
         OI.opcode = Instruction::SDiv;
       break;
+    case Instruction::URem:
+      if (Ty->isFloatingPoint()) 
+        OI.opcode = Instruction::FRem;
+      else if (Ty->isSigned())
+        OI.opcode = Instruction::SRem;
+      break;
   }
   // Its not obsolete any more, we fixed it.
   OI.obsolete = false;
 }
-
-
+  
 // common code from the two 'RunVMAsmParser' functions
 static Module* RunParser(Module * M) {
 
@@ -1113,7 +1118,7 @@
 
 // Binary Operators
 %type  <BinaryOpVal> ArithmeticOps LogicalOps SetCondOps // Binops Subcatagories
-%token <BinaryOpVal> ADD SUB MUL UDIV SDIV FDIV REM AND OR XOR
+%token <BinaryOpVal> ADD SUB MUL UDIV SDIV FDIV UREM SREM FREM AND OR XOR
 %token <BinaryOpVal> SETLE SETGE SETLT SETGT SETEQ SETNE  // Binary Comparators
 
 // Memory Instructions
@@ -1151,7 +1156,7 @@
 // Operations that are notably excluded from this list include:
 // RET, BR, & SWITCH because they end basic blocks and are treated specially.
 //
-ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | REM ;
+ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | UREM | SREM | FREM;
 LogicalOps   : AND | OR | XOR;
 SetCondOps   : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE;
 
@@ -2465,8 +2470,11 @@
         !isa<PackedType>((*$2).get()))
       GEN_ERROR(
         "Arithmetic operator requires integer, FP, or packed operands!");
-    if (isa<PackedType>((*$2).get()) && $1.opcode == Instruction::Rem)
-      GEN_ERROR("Rem not supported on packed types!");
+    if (isa<PackedType>((*$2).get()) && 
+        ($1.opcode == Instruction::URem || 
+         $1.opcode == Instruction::SRem ||
+         $1.opcode == Instruction::FRem))
+      GEN_ERROR("U/S/FRem not supported on packed types!");
     // Upgrade the opcode from obsolete versions before we do anything with it.
     sanitizeOpCode($1,*$2);
     CHECK_FOR_ERROR;