diff --git a/include/llvm/AbstractTypeUser.h b/include/llvm/AbstractTypeUser.h index c995b61cad6..659c1b9b617 100644 --- a/include/llvm/AbstractTypeUser.h +++ b/include/llvm/AbstractTypeUser.h @@ -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. // diff --git a/lib/AsmParser/ParserInternals.h b/lib/AsmParser/ParserInternals.h index e1e2c4954c0..2291a5a975f 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 BBPlaceHolderHelper : public BasicBlock { } }; -struct MethPlaceHolderHelper : public Method { - MethPlaceHolderHelper(const Type *Ty) : Method(cast(Ty), - true) {} +struct MethPlaceHolderHelper : public Function { + MethPlaceHolderHelper(const Type *Ty) + : Function(cast(Ty), true) {} }; typedef PlaceholderValue ValuePlaceHolder; @@ -185,7 +185,7 @@ typedef PlaceholderValue BBPlaceHolder; static inline ValID &getValIDFromPlaceHolder(const Value *Val) { const Type *Ty = Val->getType(); if (isa(Ty) && - isa(cast(Ty)->getElementType())) + isa(cast(Ty)->getElementType())) Ty = cast(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(Ty) && - isa(cast(Ty)->getElementType())) + isa(cast(Ty)->getElementType())) Ty = cast(Ty)->getElementType(); switch (Ty->getPrimitiveID()) { diff --git a/lib/Bytecode/Reader/InstructionReader.cpp b/lib/Bytecode/Reader/InstructionReader.cpp index 8402db5e827..2d28db1b4c0 100644 --- a/lib/Bytecode/Reader/InstructionReader.cpp +++ b/lib/Bytecode/Reader/InstructionReader.cpp @@ -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(M->getType()); if (PTy == 0) return failure(true); - MethodType *MTy = dyn_cast(PTy->getElementType()); + FunctionType *MTy = dyn_cast(PTy->getElementType()); if (MTy == 0) return failure(true); vector 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(M->getType()); if (PTy == 0) return failure(true); - MethodType *MTy = dyn_cast(PTy->getElementType()); + FunctionType *MTy = dyn_cast(PTy->getElementType()); if (MTy == 0) return failure(true); vector Params; - const MethodType::ParamTypes &PL = MTy->getParamTypes(); + const FunctionType::ParamTypes &PL = MTy->getParamTypes(); vector &args = *Raw.VarArgs; BasicBlock *Normal, *Except; @@ -305,7 +305,7 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf, Normal = cast(getValue(Type::LabelTy, Raw.Arg2)); Except = cast(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 f047ab5e1c5..0be903aad0a 100644 --- a/lib/Bytecode/Writer/InstructionWriter.cpp +++ b/lib/Bytecode/Writer/InstructionWriter.cpp @@ -226,13 +226,13 @@ void BytecodeWriter::processInstruction(const Instruction *I) { NumOperands++; } else if (const CallInst *CI = dyn_cast(I)) {// Handle VarArg calls PointerType *Ty = cast(CI->getCalledValue()->getType()); - if (cast(Ty->getElementType())->isVarArg()) { + if (cast(Ty->getElementType())->isVarArg()) { outputInstrVarArgsCall(I, Table, Type, Out); return; } } else if (const InvokeInst *II = dyn_cast(I)) { // ... & Invokes PointerType *Ty = cast(II->getCalledValue()->getType()); - if (cast(Ty->getElementType())->isVarArg()) { + if (cast(Ty->getElementType())->isVarArg()) { outputInstrVarArgsCall(I, Table, Type, Out); return; } diff --git a/lib/Target/SparcV9/SparcV9InstrSelection.cpp b/lib/Target/SparcV9/SparcV9InstrSelection.cpp index 18b4a0a4278..7b6e597e4dc 100644 --- a/lib/Target/SparcV9/SparcV9InstrSelection.cpp +++ b/lib/Target/SparcV9/SparcV9InstrSelection.cpp @@ -327,9 +327,9 @@ ChooseAddInstructionByType(const Type* resultType) MachineOpCode opCode = INVALID_OPCODE; if (resultType->isIntegral() || - resultType->isPointerType() || - resultType->isLabelType() || - isa(resultType) || + isa(resultType) || + isa(resultType) || + resultType == Type::LabelTy || resultType == Type::BoolTy) { opCode = ADD; diff --git a/lib/Target/SparcV9/SparcV9RegInfo.cpp b/lib/Target/SparcV9/SparcV9RegInfo.cpp index 434816e0a6b..8ec23991083 100644 --- a/lib/Target/SparcV9/SparcV9RegInfo.cpp +++ b/lib/Target/SparcV9/SparcV9RegInfo.cpp @@ -264,10 +264,8 @@ bool UltraSparcRegInfo::isVarArgCall(const MachineInstr *CallMI) const { const MachineOperand & calleeOp = CallMI->getOperand(0); Value *calleeVal = calleeOp.getVRegValue(); - PointerType *PT = cast (calleeVal->getType()); - MethodType *MT = cast(PT->getElementType()); - - return MT->isVarArg(); + PointerType *PT = cast(calleeVal->getType()); + return cast(PT->getElementType())->isVarArg(); } diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp index cd76bdbf1f3..790f68f7a37 100644 --- a/lib/Transforms/ExprTypeConvert.cpp +++ b/lib/Transforms/ExprTypeConvert.cpp @@ -832,7 +832,7 @@ static bool OperandConvertableToType(User *U, Value *V, const Type *Ty, if (OpNum == 0) { PointerType *PTy = dyn_cast(Ty); if (PTy == 0) return false; // Can't convert to a non-pointer type... - MethodType *MTy = dyn_cast(PTy->getElementType()); + FunctionType *MTy = dyn_cast(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(I->getOperand(0)->getType()); - const MethodType *MTy = cast(MPtr->getElementType()); + const FunctionType *MTy = cast(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(NewVal->getType()); - MethodType *NewTy = cast(NewPTy->getElementType()); - const MethodType::ParamTypes &PTs = NewTy->getParamTypes(); + FunctionType *NewTy = cast(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 e064caa8176..e31aeb8185b 100644 --- a/lib/Transforms/Instrumentation/TraceValues.cpp +++ b/lib/Transforms/Instrumentation/TraceValues.cpp @@ -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(1, SBP), true); + const FunctionType *MTy = + FunctionType::get(Type::IntTy, vector(1, SBP), true); PrintfFunc = M->getOrInsertFunction("printf", MTy); return false; diff --git a/lib/VMCore/iCall.cpp b/lib/VMCore/iCall.cpp index 37eb24e86cb..d757ea2349a 100644 --- a/lib/VMCore/iCall.cpp +++ b/lib/VMCore/iCall.cpp @@ -15,16 +15,16 @@ CallInst::CallInst(Value *Meth, const std::vector ¶ms, const std::string &Name) - : Instruction(cast(cast(Meth->getType()) + : Instruction(cast(cast(Meth->getType()) ->getElementType())->getReturnType(), Instruction::Call, Name) { Operands.reserve(1+params.size()); Operands.push_back(Use(Meth, this)); - const MethodType *MTy = - cast(cast(Meth->getType())->getElementType()); + const FunctionType *MTy = + cast(cast(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 ¶ms, const std::string &Name) - : TerminatorInst(cast(cast(Meth->getType()) + : TerminatorInst(cast(cast(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(cast(Meth->getType())->getElementType()); + const FunctionType *MTy = + cast(cast(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 2fbcb887e3b..7fbcfdedd28 100644 --- a/support/lib/Support/NameMangling.cpp +++ b/support/lib/Support/NameMangling.cpp @@ -25,10 +25,10 @@ string MangleTypeName(const Type *Ty) { mangledName += MangleTypeName(STy->getContainedType(i)); } else if (ArrayType *ATy = dyn_cast(Ty)) { mangledName = string("A_" +MangleTypeName(ATy->getElementType())); - } else if (MethodType *MTy = dyn_cast(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(Ty)) { + mangledName = string("M_") + MangleTypeName(FTy->getReturnType()); + for (unsigned i = 1; i < FTy->getNumContainedTypes(); ++i) + mangledName += string(MangleTypeName(FTy->getContainedType(i))); } return mangledName;