Commit more code over to new cast style

llvm-svn: 697
diff --git a/llvm/lib/Target/Sparc/SparcInstrSelection.cpp b/llvm/lib/Target/Sparc/SparcInstrSelection.cpp
index b1b5e01..e4ae8a8 100644
--- a/llvm/lib/Target/Sparc/SparcInstrSelection.cpp
+++ b/llvm/lib/Target/Sparc/SparcInstrSelection.cpp
@@ -2010,9 +2010,8 @@
                 // Also, mark the operands of the Call as implicit operands
                 // of the machine instruction.
         {
-        CallInst* callInstr = (CallInst*) subtreeRoot->getInstruction();
+        CallInst *callInstr = cast<CallInst>(subtreeRoot->getInstruction());
         Method* callee = callInstr->getCalledMethod();
-        assert(callInstr->getOpcode() == Instruction::Call); 
         
         Instruction* jmpAddrReg = new TmpInstruction(Instruction::UserOp1,
                                                      callee, NULL);
diff --git a/llvm/lib/Target/TargetData.cpp b/llvm/lib/Target/TargetData.cpp
index 24a5e85..0b4dc98 100644
--- a/llvm/lib/Target/TargetData.cpp
+++ b/llvm/lib/Target/TargetData.cpp
@@ -147,14 +147,14 @@
 
 unsigned TargetData::getIndexedOffset(const Type *ptrTy,
 				      const vector<ConstPoolVal*> &Idx) const {
-  const PointerType *PtrTy = ptrTy->castPointerType();
+  const PointerType *PtrTy = cast<const PointerType>(ptrTy);
   unsigned Result = 0;
 
   // Get the type pointed to...
   const Type *Ty = PtrTy->getValueType();
 
   for (unsigned CurIDX = 0; CurIDX < Idx.size(); ++CurIDX) {
-    if (const StructType *STy = Ty->dyncastStructType()) {
+    if (const StructType *STy = dyn_cast<const StructType>(Ty)) {
       assert(Idx[CurIDX]->getType() == Type::UByteTy && "Illegal struct idx");
       unsigned FieldNo = ((ConstPoolUInt*)Idx[CurIDX++])->getValue();
 
@@ -168,7 +168,7 @@
       // Update Ty to refer to current element
       Ty = STy->getElementTypes()[FieldNo];
 
-    } else if (const ArrayType *ATy = Ty->dyncastArrayType()) {
+    } else if (const ArrayType *ATy = dyn_cast<const ArrayType>(Ty)) {
       assert(0 && "Loading from arrays not implemented yet!");
     } else {
       assert(0 && "Indexing type that is not struct or array?");