s/MethodType/FunctionType


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2115 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/llvm/AbstractTypeUser.h b/include/llvm/AbstractTypeUser.h
index c995b61..659c1b9 100644
--- a/include/llvm/AbstractTypeUser.h
+++ b/include/llvm/AbstractTypeUser.h
@@ -53,7 +53,7 @@
 
 
 // PATypeHandle - Handle to a Type subclass.  This class is parameterized so
-// that users can have handles to MethodType's that are still specialized, for
+// that users can have handles to FunctionType's that are still specialized, for
 // example.  This class is a simple class used to keep the use list of abstract
 // types up-to-date.
 //
diff --git a/lib/AsmParser/ParserInternals.h b/lib/AsmParser/ParserInternals.h
index e1e2c49..2291a5a 100644
--- a/lib/AsmParser/ParserInternals.h
+++ b/lib/AsmParser/ParserInternals.h
@@ -15,7 +15,7 @@
 #include "llvm/BasicBlock.h"
 #include "llvm/ConstantVals.h"
 #include "llvm/iOther.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Assembly/Parser.h"
 #include "Support/StringExtras.h"
@@ -174,9 +174,9 @@
   }
 };
 
-struct MethPlaceHolderHelper : public Method {
-  MethPlaceHolderHelper(const Type *Ty) : Method(cast<const MethodType>(Ty),
-						 true) {}
+struct MethPlaceHolderHelper : public Function {
+  MethPlaceHolderHelper(const Type *Ty)
+    : Function(cast<FunctionType>(Ty), true) {}
 };
 
 typedef PlaceholderValue<InstPlaceHolderHelper>  ValuePlaceHolder;
@@ -185,7 +185,7 @@
 static inline ValID &getValIDFromPlaceHolder(const Value *Val) {
   const Type *Ty = Val->getType();
   if (isa<PointerType>(Ty) &&
-      isa<MethodType>(cast<PointerType>(Ty)->getElementType()))
+      isa<FunctionType>(cast<PointerType>(Ty)->getElementType()))
     Ty = cast<PointerType>(Ty)->getElementType();
 
   switch (Ty->getPrimitiveID()) {
@@ -197,7 +197,7 @@
 static inline int getLineNumFromPlaceHolder(const Value *Val) {
   const Type *Ty = Val->getType();
   if (isa<PointerType>(Ty) &&
-      isa<MethodType>(cast<PointerType>(Ty)->getElementType()))
+      isa<FunctionType>(cast<PointerType>(Ty)->getElementType()))
     Ty = cast<PointerType>(Ty)->getElementType();
 
   switch (Ty->getPrimitiveID()) {
diff --git a/lib/Bytecode/Reader/InstructionReader.cpp b/lib/Bytecode/Reader/InstructionReader.cpp
index 8402db5..2d28db1 100644
--- a/lib/Bytecode/Reader/InstructionReader.cpp
+++ b/lib/Bytecode/Reader/InstructionReader.cpp
@@ -230,14 +230,14 @@
     // Check to make sure we have a pointer to method type
     PointerType *PTy = dyn_cast<PointerType>(M->getType());
     if (PTy == 0) return failure(true);
-    MethodType *MTy = dyn_cast<MethodType>(PTy->getElementType());
+    FunctionType *MTy = dyn_cast<FunctionType>(PTy->getElementType());
     if (MTy == 0) return failure(true);
 
     vector<Value *> Params;
-    const MethodType::ParamTypes &PL = MTy->getParamTypes();
+    const FunctionType::ParamTypes &PL = MTy->getParamTypes();
 
     if (!MTy->isVarArg()) {
-      MethodType::ParamTypes::const_iterator It = PL.begin();
+      FunctionType::ParamTypes::const_iterator It = PL.begin();
 
       switch (Raw.NumOperands) {
       case 0: cerr << "Invalid call instruction encountered!\n";
@@ -290,11 +290,11 @@
     // Check to make sure we have a pointer to method type
     PointerType *PTy = dyn_cast<PointerType>(M->getType());
     if (PTy == 0) return failure(true);
-    MethodType *MTy = dyn_cast<MethodType>(PTy->getElementType());
+    FunctionType *MTy = dyn_cast<FunctionType>(PTy->getElementType());
     if (MTy == 0) return failure(true);
 
     vector<Value *> Params;
-    const MethodType::ParamTypes &PL = MTy->getParamTypes();
+    const FunctionType::ParamTypes &PL = MTy->getParamTypes();
     vector<unsigned> &args = *Raw.VarArgs;
 
     BasicBlock *Normal, *Except;
@@ -305,7 +305,7 @@
       Normal = cast<BasicBlock>(getValue(Type::LabelTy, Raw.Arg2));
       Except = cast<BasicBlock>(getValue(Type::LabelTy, args[0]));
 
-      MethodType::ParamTypes::const_iterator It = PL.begin();
+      FunctionType::ParamTypes::const_iterator It = PL.begin();
       for (unsigned i = 1; i < args.size(); i++) {
 	if (It == PL.end()) return failure(true);
 	// TODO: Check getValue for null!
diff --git a/lib/Bytecode/Writer/InstructionWriter.cpp b/lib/Bytecode/Writer/InstructionWriter.cpp
index f047ab5..0be903a 100644
--- a/lib/Bytecode/Writer/InstructionWriter.cpp
+++ b/lib/Bytecode/Writer/InstructionWriter.cpp
@@ -226,13 +226,13 @@
     NumOperands++;
   } else if (const CallInst *CI = dyn_cast<CallInst>(I)) {// Handle VarArg calls
     PointerType *Ty = cast<PointerType>(CI->getCalledValue()->getType());
-    if (cast<MethodType>(Ty->getElementType())->isVarArg()) {
+    if (cast<FunctionType>(Ty->getElementType())->isVarArg()) {
       outputInstrVarArgsCall(I, Table, Type, Out);
       return;
     }
   } else if (const InvokeInst *II = dyn_cast<InvokeInst>(I)) { // ...  & Invokes
     PointerType *Ty = cast<PointerType>(II->getCalledValue()->getType());
-    if (cast<MethodType>(Ty->getElementType())->isVarArg()) {
+    if (cast<FunctionType>(Ty->getElementType())->isVarArg()) {
       outputInstrVarArgsCall(I, Table, Type, Out);
       return;
     }
diff --git a/lib/Target/SparcV9/SparcV9InstrSelection.cpp b/lib/Target/SparcV9/SparcV9InstrSelection.cpp
index 18b4a0a..7b6e597 100644
--- a/lib/Target/SparcV9/SparcV9InstrSelection.cpp
+++ b/lib/Target/SparcV9/SparcV9InstrSelection.cpp
@@ -327,9 +327,9 @@
   MachineOpCode opCode = INVALID_OPCODE;
   
   if (resultType->isIntegral() ||
-      resultType->isPointerType() ||
-      resultType->isLabelType() ||
-      isa<MethodType>(resultType) ||
+      isa<PointerType>(resultType) ||
+      isa<FunctionType>(resultType) ||
+      resultType == Type::LabelTy ||
       resultType == Type::BoolTy)
     {
       opCode = ADD;
diff --git a/lib/Target/SparcV9/SparcV9RegInfo.cpp b/lib/Target/SparcV9/SparcV9RegInfo.cpp
index 434816e..8ec2399 100644
--- a/lib/Target/SparcV9/SparcV9RegInfo.cpp
+++ b/lib/Target/SparcV9/SparcV9RegInfo.cpp
@@ -264,10 +264,8 @@
   const MachineOperand & calleeOp = CallMI->getOperand(0);
   Value *calleeVal =  calleeOp.getVRegValue();
 
-  PointerType *PT =  cast<PointerType> (calleeVal->getType());
-  MethodType  *MT = cast<MethodType>(PT->getElementType());
-
-  return MT->isVarArg();
+  PointerType *PT =  cast<PointerType>(calleeVal->getType());
+  return cast<FunctionType>(PT->getElementType())->isVarArg();
 }
 
 
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp
index cd76bdb..790f68f 100644
--- a/lib/Transforms/ExprTypeConvert.cpp
+++ b/lib/Transforms/ExprTypeConvert.cpp
@@ -832,7 +832,7 @@
     if (OpNum == 0) {
       PointerType *PTy = dyn_cast<PointerType>(Ty);
       if (PTy == 0) return false;  // Can't convert to a non-pointer type...
-      MethodType *MTy = dyn_cast<MethodType>(PTy->getElementType());
+      FunctionType *MTy = dyn_cast<FunctionType>(PTy->getElementType());
       if (MTy == 0) return false;  // Can't convert to a non ptr to method...
 
       // Perform sanity checks to make sure that new method type has the
@@ -858,7 +858,7 @@
       // reason for this is that we prefer to have resolved methods but casted
       // arguments if possible.
       //
-      const MethodType::ParamTypes &PTs = MTy->getParamTypes();
+      const FunctionType::ParamTypes &PTs = MTy->getParamTypes();
       for (unsigned i = 0, NA = PTs.size(); i < NA; ++i)
         if (!PTs[i]->isLosslesslyConvertableTo(I->getOperand(i+1)->getType()))
           return false;   // Operands must have compatible types!
@@ -871,7 +871,7 @@
     }
     
     const PointerType *MPtr = cast<PointerType>(I->getOperand(0)->getType());
-    const MethodType *MTy = cast<MethodType>(MPtr->getElementType());
+    const FunctionType *MTy = cast<FunctionType>(MPtr->getElementType());
     if (!MTy->isVarArg()) return false;
 
     if ((OpNum-1) < MTy->getParamTypes().size())
@@ -1100,8 +1100,8 @@
 
     if (Meth == OldVal) {   // Changing the method pointer?
       PointerType *NewPTy = cast<PointerType>(NewVal->getType());
-      MethodType *NewTy = cast<MethodType>(NewPTy->getElementType());
-      const MethodType::ParamTypes &PTs = NewTy->getParamTypes();
+      FunctionType *NewTy = cast<FunctionType>(NewPTy->getElementType());
+      const FunctionType::ParamTypes &PTs = NewTy->getParamTypes();
 
       // Get an iterator to the call instruction so that we can insert casts for
       // operands if needbe.  Note that we do not require operands to be
diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp
index e064caa..e31aeb8 100644
--- a/lib/Transforms/Instrumentation/TraceValues.cpp
+++ b/lib/Transforms/Instrumentation/TraceValues.cpp
@@ -67,8 +67,8 @@
 //
 bool InsertTraceCode::doInitialization(Module *M) {
   const Type *SBP = PointerType::get(Type::SByteTy);
-  const MethodType *MTy =
-    MethodType::get(Type::IntTy, vector<const Type*>(1, SBP), true);
+  const FunctionType *MTy =
+    FunctionType::get(Type::IntTy, vector<const Type*>(1, SBP), true);
 
   PrintfFunc = M->getOrInsertFunction("printf", MTy);
   return false;
diff --git a/lib/VMCore/iCall.cpp b/lib/VMCore/iCall.cpp
index 37eb24e..d757ea2 100644
--- a/lib/VMCore/iCall.cpp
+++ b/lib/VMCore/iCall.cpp
@@ -15,16 +15,16 @@
 
 CallInst::CallInst(Value *Meth, const std::vector<Value*> &params, 
                    const std::string &Name) 
-  : Instruction(cast<MethodType>(cast<PointerType>(Meth->getType())
+  : Instruction(cast<FunctionType>(cast<PointerType>(Meth->getType())
 				 ->getElementType())->getReturnType(),
 		Instruction::Call, Name) {
   Operands.reserve(1+params.size());
   Operands.push_back(Use(Meth, this));
 
-  const MethodType *MTy = 
-    cast<MethodType>(cast<PointerType>(Meth->getType())->getElementType());
+  const FunctionType *MTy = 
+    cast<FunctionType>(cast<PointerType>(Meth->getType())->getElementType());
 
-  const MethodType::ParamTypes &PL = MTy->getParamTypes();
+  const FunctionType::ParamTypes &PL = MTy->getParamTypes();
   assert((params.size() == PL.size()) || 
 	 (MTy->isVarArg() && params.size() >= PL.size()) &&
 	 "Calling a function with bad signature");
@@ -47,17 +47,17 @@
 		       BasicBlock *IfException,
                        const std::vector<Value*> &params,
 		       const std::string &Name)
-  : TerminatorInst(cast<MethodType>(cast<PointerType>(Meth->getType())
+  : TerminatorInst(cast<FunctionType>(cast<PointerType>(Meth->getType())
 				    ->getElementType())->getReturnType(),
 		   Instruction::Invoke, Name) {
   Operands.reserve(3+params.size());
   Operands.push_back(Use(Meth, this));
   Operands.push_back(Use(IfNormal, this));
   Operands.push_back(Use(IfException, this));
-  const MethodType *MTy = 
-    cast<MethodType>(cast<PointerType>(Meth->getType())->getElementType());
+  const FunctionType *MTy = 
+    cast<FunctionType>(cast<PointerType>(Meth->getType())->getElementType());
   
-  const MethodType::ParamTypes &PL = MTy->getParamTypes();
+  const FunctionType::ParamTypes &PL = MTy->getParamTypes();
   assert((params.size() == PL.size()) || 
 	 (MTy->isVarArg() && params.size() > PL.size()) &&
 	 "Calling a function with bad signature");
diff --git a/support/lib/Support/NameMangling.cpp b/support/lib/Support/NameMangling.cpp
index 2fbcb88..7fbcfde 100644
--- a/support/lib/Support/NameMangling.cpp
+++ b/support/lib/Support/NameMangling.cpp
@@ -25,10 +25,10 @@
       mangledName += MangleTypeName(STy->getContainedType(i));
   } else if (ArrayType *ATy = dyn_cast<ArrayType>(Ty)) {
     mangledName = string("A_" +MangleTypeName(ATy->getElementType()));
-  } else if (MethodType *MTy = dyn_cast<MethodType>(Ty)) {
-    mangledName = string("M_") + MangleTypeName(MTy->getReturnType());
-    for (unsigned i = 1; i < MTy->getNumContainedTypes(); ++i)
-      mangledName += string(MangleTypeName(MTy->getContainedType(i)));
+  } else if (FunctionType *FTy = dyn_cast<FunctionType>(Ty)) {
+    mangledName = string("M_") + MangleTypeName(FTy->getReturnType());
+    for (unsigned i = 1; i < FTy->getNumContainedTypes(); ++i)
+      mangledName += string(MangleTypeName(FTy->getContainedType(i)));
   }
   
   return mangledName;