s/MethodType/FunctionType
authorChris Lattner <sabre@nondot.org>
Thu, 4 Apr 2002 22:19:18 +0000 (22:19 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 4 Apr 2002 22:19:18 +0000 (22:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2115 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/AbstractTypeUser.h
lib/AsmParser/ParserInternals.h
lib/Bytecode/Reader/InstructionReader.cpp
lib/Bytecode/Writer/InstructionWriter.cpp
lib/Target/SparcV9/SparcV9InstrSelection.cpp
lib/Target/SparcV9/SparcV9RegInfo.cpp
lib/Transforms/ExprTypeConvert.cpp
lib/Transforms/Instrumentation/TraceValues.cpp
lib/VMCore/iCall.cpp
support/lib/Support/NameMangling.cpp

index c995b61cad6a60491b8a641b1dfbcff80a8b0103..659c1b9b6170269794055fc597a5a75bd7621be8 100644 (file)
@@ -53,7 +53,7 @@ public:
 
 
 // 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.
 //
index e1e2c4954c020aa225ffed56679b5866258ed86e..2291a5a975f86a9940df1699f59bbb093b282644 100644 (file)
@@ -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 BBPlaceHolderHelper : public BasicBlock {
   }
 };
 
-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 @@ typedef PlaceholderValue<BBPlaceHolderHelper>    BBPlaceHolder;
 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 ValID &getValIDFromPlaceHolder(const Value *Val) {
 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()) {
index 8402db5e827baa989e825af1e28eee56d80edb87..2d28db1b4c0f3827538e90a5ef5fae6d3871510a 100644 (file)
@@ -230,14 +230,14 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf,
     // 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 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf,
     // 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 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf,
       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!
index f047ab5e1c566b0c29ec08e1f222401dd206cb43..0be903aad0afae1c353a23f09b23bd9f3539af57 100644 (file)
@@ -226,13 +226,13 @@ void BytecodeWriter::processInstruction(const Instruction *I) {
     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;
     }
index 18b4a0a427841c9685ff1ea0afa932ddd005f00c..7b6e597e4dc5db818301d44440c8187843d8fb6f 100644 (file)
@@ -327,9 +327,9 @@ ChooseAddInstructionByType(const Type* resultType)
   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;
index 434816e0a6b023cbcd01549ca603f62dffd19347..8ec23991083d10439b3d93eb7e58b853c989d9e6 100644 (file)
@@ -264,10 +264,8 @@ bool UltraSparcRegInfo::isVarArgCall(const MachineInstr *CallMI) const {
   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();
 }
 
 
index cd76bdbf1f39999311da5b5a17e1f0e0555f197d..790f68f7a37bb01713d430e09ed94c37a9677da2 100644 (file)
@@ -832,7 +832,7 @@ static bool OperandConvertableToType(User *U, Value *V, const Type *Ty,
     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 @@ static bool OperandConvertableToType(User *U, Value *V, const Type *Ty,
       // 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 @@ static bool OperandConvertableToType(User *U, Value *V, const Type *Ty,
     }
     
     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 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
 
     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
index e064caa8176f6164488567a3ec8b32db8814bad0..e31aeb8185b37d6c9d5f7d6163f42a41877e5c80 100644 (file)
@@ -67,8 +67,8 @@ Pass *createTraceValuesPassForBasicBlocks() {  // Trace BB's and methods
 //
 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;
index 37eb24e86cbdc0d7f1bea3ebd735a417940beab7..d757ea2349a2a9c24f8aac0428d4f207f4bef4fe 100644 (file)
 
 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 @@ InvokeInst::InvokeInst(Value *Meth, BasicBlock *IfNormal, \
                       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");
index 2fbcb887e3b411957aab7ba122bd671d1585ab5c..7fbcfdedd287ec012a9e5ef77930c64d4aec0690 100644 (file)
@@ -25,10 +25,10 @@ string MangleTypeName(const Type *Ty) {
       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;