Broad superficial changes:
* Renamed getOpcode to getOpcodeName
* Changed getOpcodeName to return a const char * instead of string
* Added a getOpcode method to replace getInstType
* Changed code to use getOpcode instead of getInstType


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp
index de76dcd..b7cefac 100644
--- a/lib/Transforms/IPO/InlineSimple.cpp
+++ b/lib/Transforms/IPO/InlineSimple.cpp
@@ -63,7 +63,7 @@
 // method by one level.
 //
 bool opt::InlineMethod(BasicBlock::iterator CIIt) {
-  assert((*CIIt)->getInstType() == Instruction::Call && 
+  assert((*CIIt)->getOpcode() == Instruction::Call && 
 	 "InlineMethod only works on CallInst nodes!");
   assert((*CIIt)->getParent() && "Instruction not embedded in basic block!");
   assert((*CIIt)->getParent()->getParent() && "Instruction not in method!");
@@ -149,7 +149,7 @@
     }
 
     // Copy over the terminator now...
-    switch (TI->getInstType()) {
+    switch (TI->getOpcode()) {
     case Instruction::Ret: {
       const ReturnInst *RI = (const ReturnInst*)TI;
 
@@ -209,7 +209,7 @@
   // block of the inlined method.
   //
   TerminatorInst *Br = OrigBB->getTerminator();
-  assert(Br && Br->getInstType() == Instruction::Br && 
+  assert(Br && Br->getOpcode() == Instruction::Br && 
 	 "splitBasicBlock broken!");
   Br->setOperand(0, ValueMap[CalledMeth->front()]);
 
@@ -249,7 +249,7 @@
 
 static inline bool DoMethodInlining(BasicBlock *BB) {
   for (BasicBlock::iterator I = BB->begin(); I != BB->end(); ++I) {
-    if ((*I)->getInstType() == Instruction::Call) {
+    if ((*I)->getOpcode() == Instruction::Call) {
       // Check to see if we should inline this method
       CallInst *CI = (CallInst*)*I;
       Method *M = CI->getCalledMethod();
diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp
index 91a21c3..f6b76c9 100644
--- a/lib/Transforms/Scalar/ConstantProp.cpp
+++ b/lib/Transforms/Scalar/ConstantProp.cpp
@@ -73,7 +73,7 @@
 ConstantFoldUnaryInst(Method *M, Method::inst_iterator &DI,
                       UnaryOperator *Op, ConstPoolVal *D) {
   ConstPoolVal *ReplaceWith = 
-    opt::ConstantFoldUnaryInstruction(Op->getInstType(), D);
+    opt::ConstantFoldUnaryInstruction(Op->getOpcode(), D);
 
   if (!ReplaceWith) return false;   // Nothing new to change...
 
@@ -100,7 +100,7 @@
 		       BinaryOperator *Op,
 		       ConstPoolVal *D1, ConstPoolVal *D2) {
   ConstPoolVal *ReplaceWith =
-    opt::ConstantFoldBinaryInstruction(Op->getInstType(), D1, D2);
+    opt::ConstantFoldBinaryInstruction(Op->getOpcode(), D1, D2);
   if (!ReplaceWith) return false;   // Nothing new to change...
 
   // Add the new value to the constant pool...
@@ -126,7 +126,7 @@
 //
 bool opt::ConstantFoldTerminator(TerminatorInst *T) {
   // Branch - See if we are conditional jumping on constant
-  if (T->getInstType() == Instruction::Br) {
+  if (T->getOpcode() == Instruction::Br) {
     BranchInst *BI = (BranchInst*)T;
     if (BI->isUnconditional()) return false;  // Can't optimize uncond branch
     BasicBlock *Dest1 = BI->getOperand(0)->castBasicBlockAsserting();
diff --git a/lib/Transforms/Scalar/InductionVars.cpp b/lib/Transforms/Scalar/InductionVars.cpp
index b39a523..c59a441 100644
--- a/lib/Transforms/Scalar/InductionVars.cpp
+++ b/lib/Transforms/Scalar/InductionVars.cpp
@@ -78,7 +78,7 @@
 
   // loop variant computations must be instructions!
   Instruction *I = V->castInstructionAsserting();
-  switch (I->getInstType()) {       // Handle each instruction seperately
+  switch (I->getOpcode()) {       // Handle each instruction seperately
   case Instruction::Neg: {
     Value *SubV = ((UnaryOperator*)I)->getOperand(0);
     LIVType SubLIVType = isLinearInductionVariableH(Int, SubV, PN);
@@ -107,12 +107,12 @@
       // either a Loop Invariant computation, or a LIV type.
       if (SubLIVType1 == isLIC) {
 	// Loop invariant computation, we know this is a LIV then.
-	return (I->getInstType() == Instruction::Add) ? 
+	return (I->getOpcode() == Instruction::Add) ? 
 	               SubLIVType2 : neg(SubLIVType2);
       }
 
       // If the LHS is also a LIV Expression, we cannot add two LIVs together
-      if (I->getInstType() == Instruction::Add) return isOther;
+      if (I->getOpcode() == Instruction::Add) return isOther;
 
       // We can only subtract two LIVs if they are the same type, which yields
       // a LIC, because the LIVs cancel each other out.
@@ -155,7 +155,7 @@
 
   Value *StepExpr = PN->getIncomingValue(1);
   if (!StepExpr->isInstruction() ||
-      ((Instruction*)StepExpr)->getInstType() != Instruction::Add)
+      ((Instruction*)StepExpr)->getOpcode() != Instruction::Add)
     return false;
 
   BinaryOperator *I = (BinaryOperator*)StepExpr;
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index 5bb75c7..43eb26f 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -307,7 +307,7 @@
   if (IValue.isOverdefined())
     return; // If already overdefined, we aren't going to effect anything
 
-  switch (I->getInstType()) {
+  switch (I->getOpcode()) {
     //===-----------------------------------------------------------------===//
     // Handle PHI nodes...
     //
@@ -424,7 +424,7 @@
   }
 
   default: break;  // Handle math operators as groups.
-  } // end switch(I->getInstType())
+  } // end switch(I->getOpcode())
 
   
   //===-------------------------------------------------------------------===//
@@ -437,7 +437,7 @@
       markOverdefined(I);
     } else if (VState.isConstant()) {    // Propogate constant value
       ConstPoolVal *Result = 
-	opt::ConstantFoldUnaryInstruction(I->getInstType(), 
+	opt::ConstantFoldUnaryInstruction(I->getOpcode(), 
 					  VState.getConstant());
 
       if (Result) {
@@ -466,7 +466,7 @@
       markOverdefined(I);
     } else if (V1State.isConstant() && V2State.isConstant()) {
       ConstPoolVal *Result = 
-	opt::ConstantFoldBinaryInstruction(I->getInstType(), 
+	opt::ConstantFoldBinaryInstruction(I->getOpcode(), 
 					   V1State.getConstant(),
 					   V2State.getConstant());
       if (Result) {
diff --git a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
index 0217ce0..ab600bd 100644
--- a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
+++ b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
@@ -25,7 +25,7 @@
   // return.
   //
   for(Method::iterator I = M->begin(), E = M->end(); I != E; ++I)
-    if ((*I)->getTerminator()->getInstType() == Instruction::Ret)
+    if ((*I)->getTerminator()->getOpcode() == Instruction::Ret)
       ReturningBlocks.push_back(*I);
 
   if (ReturningBlocks.size() == 0)