From a874026838a4b87c0947d6c8e808553ed11bf1e3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 26 Mar 2002 17:48:08 +0000 Subject: [PATCH] Transform uses of Method into uses of Function. Rename MethodArgument to FunctionArgument Fix some _really_ out of date comments llvm-svn: 1986 --- include/llvm/Function.h | 12 ++++------ include/llvm/GlobalValue.h | 2 +- include/llvm/Module.h | 46 +++++++++++++++++++------------------- include/llvm/Value.h | 21 ++++++++--------- include/llvm/iOther.h | 36 ++++++++++++++++------------- 5 files changed, 59 insertions(+), 58 deletions(-) diff --git a/include/llvm/Function.h b/include/llvm/Function.h index 5be1dd4a3fd..d7e304d768c 100644 --- a/include/llvm/Function.h +++ b/include/llvm/Function.h @@ -15,16 +15,12 @@ #include "llvm/GlobalValue.h" #include "llvm/ValueHolder.h" -class Instruction; -class BasicBlock; -class MethodArgument; class MethodType; -class Module; class Function : public GlobalValue, public SymTabValue { public: - typedef ValueHolder ArgumentListType; - typedef ValueHolder BasicBlocksType; + typedef ValueHolder ArgumentListType; + typedef ValueHolder BasicBlocksType; // BasicBlock iterators... typedef BasicBlocksType::iterator iterator; @@ -55,7 +51,7 @@ public: // this is true for external methods, defined as forward "declare"ations bool isExternal() const { return BasicBlocks.empty(); } - // Get the underlying elements of the Method... both the argument list and + // Get the underlying elements of the Function... both the argument list and // basic block list are empty for external methods. // inline const ArgumentListType &getArgumentList() const{ return ArgumentList; } @@ -91,7 +87,7 @@ public: // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const Function *) { return true; } static inline bool classof(const Value *V) { - return V->getValueType() == Value::MethodVal; + return V->getValueType() == Value::FunctionVal; } // dropAllReferences() - This function causes all the subinstructions to "let diff --git a/include/llvm/GlobalValue.h b/include/llvm/GlobalValue.h index 1527940d796..69345ce1854 100644 --- a/include/llvm/GlobalValue.h +++ b/include/llvm/GlobalValue.h @@ -42,7 +42,7 @@ public: // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const GlobalValue *T) { return true; } static inline bool classof(const Value *V) { - return V->getValueType() == Value::MethodVal || + return V->getValueType() == Value::FunctionVal || V->getValueType() == Value::GlobalVariableVal; } }; diff --git a/include/llvm/Module.h b/include/llvm/Module.h index 7a6153edc97..8223f6f6125 100644 --- a/include/llvm/Module.h +++ b/include/llvm/Module.h @@ -22,7 +22,7 @@ class ConstantPointerRef; class Module : public Value, public SymTabValue { public: typedef ValueHolder GlobalListType; - typedef ValueHolder MethodListType; + typedef ValueHolder FunctionListType; // Global Variable iterators... typedef GlobalListType::iterator giterator; @@ -30,15 +30,15 @@ public: typedef std::reverse_iterator reverse_giterator; typedef std::reverse_iterator const_reverse_giterator; - // Method iterators... - typedef MethodListType::iterator iterator; - typedef MethodListType::const_iterator const_iterator; + // Function iterators... + typedef FunctionListType::iterator iterator; + typedef FunctionListType::const_iterator const_iterator; typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; private: GlobalListType GlobalList; // The Global Variables - MethodListType MethodList; // The Methods + FunctionListType FunctionList; // The Functions GlobalValueRefMap *GVRefMap; @@ -57,14 +57,14 @@ public: // bool reduceApply(bool (*Func)(GlobalVariable*)); bool reduceApply(bool (*Func)(const GlobalVariable*)) const; - bool reduceApply(bool (*Func)(Method*)); - bool reduceApply(bool (*Func)(const Method*)) const; + bool reduceApply(bool (*Func)(Function*)); + bool reduceApply(bool (*Func)(const Function*)) const; // Get the underlying elements of the Module... inline const GlobalListType &getGlobalList() const { return GlobalList; } inline GlobalListType &getGlobalList() { return GlobalList; } - inline const MethodListType &getMethodList() const { return MethodList; } - inline MethodListType &getMethodList() { return MethodList; } + inline const FunctionListType &getFunctionList() const { return FunctionList;} + inline FunctionListType &getFunctionList() { return FunctionList;} //===--------------------------------------------------------------------===// // Module iterator forwarding functions @@ -88,22 +88,22 @@ public: - inline iterator begin() { return MethodList.begin(); } - inline const_iterator begin() const { return MethodList.begin(); } - inline iterator end () { return MethodList.end(); } - inline const_iterator end () const { return MethodList.end(); } + inline iterator begin() { return FunctionList.begin(); } + inline const_iterator begin() const { return FunctionList.begin(); } + inline iterator end () { return FunctionList.end(); } + inline const_iterator end () const { return FunctionList.end(); } - inline reverse_iterator rbegin() { return MethodList.rbegin(); } - inline const_reverse_iterator rbegin() const { return MethodList.rbegin(); } - inline reverse_iterator rend () { return MethodList.rend(); } - inline const_reverse_iterator rend () const { return MethodList.rend(); } + inline reverse_iterator rbegin() { return FunctionList.rbegin(); } + inline const_reverse_iterator rbegin() const { return FunctionList.rbegin(); } + inline reverse_iterator rend () { return FunctionList.rend(); } + inline const_reverse_iterator rend () const { return FunctionList.rend(); } - inline unsigned size() const { return MethodList.size(); } - inline bool empty() const { return MethodList.empty(); } - inline const Method *front() const { return MethodList.front(); } - inline Method *front() { return MethodList.front(); } - inline const Method *back() const { return MethodList.back(); } - inline Method *back() { return MethodList.back(); } + inline unsigned size() const { return FunctionList.size(); } + inline bool empty() const { return FunctionList.empty(); } + inline const Function *front() const { return FunctionList.front(); } + inline Function *front() { return FunctionList.front(); } + inline const Function *back() const { return FunctionList.back(); } + inline Function *back() { return FunctionList.back(); } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const Module *T) { return true; } diff --git a/include/llvm/Value.h b/include/llvm/Value.h index bb321df71b2..ce822fe7958 100644 --- a/include/llvm/Value.h +++ b/include/llvm/Value.h @@ -1,7 +1,8 @@ //===-- llvm/Value.h - Definition of the Value class -------------*- C++ -*--=// // // This file defines the very important Value class. This is subclassed by a -// bunch of other important classes, like Def, Method, Module, Type, etc... +// bunch of other important classes, like Instruction, Function, Module, Type, +// etc... // // This file also defines the Use<> template for users of value. // @@ -19,7 +20,7 @@ class User; class Type; class Constant; -class MethodArgument; +class FunctionArgument; class Instruction; class BasicBlock; class GlobalValue; @@ -41,10 +42,10 @@ public: enum ValueTy { TypeVal, // This is an instance of Type ConstantVal, // This is an instance of Constant - MethodArgumentVal, // This is an instance of MethodArgument + FunctionArgumentVal, // This is an instance of FunctionArgument InstructionVal, // This is an instance of Instruction BasicBlockVal, // This is an instance of BasicBlock - MethodVal, // This is an instance of Method + FunctionVal, // This is an instance of Function GlobalVariableVal, // This is an instance of GlobalVariable ModuleVal, // This is an instance of Module }; @@ -257,11 +258,11 @@ template <> inline bool isa(const Value *Val) { template <> inline bool isa(Value *Val) { return Val->getValueType() == Value::ConstantVal; } -template <> inline bool isa(const Value *Val) { - return Val->getValueType() == Value::MethodArgumentVal; +template <> inline bool isa(const Value *Val) { + return Val->getValueType() == Value::FunctionArgumentVal; } -template <> inline bool isa(Value *Val) { - return Val->getValueType() == Value::MethodArgumentVal; +template <> inline bool isa(Value *Val) { + return Val->getValueType() == Value::FunctionArgumentVal; } template <> inline bool isa(const Value *Val) { return Val->getValueType() == Value::InstructionVal; @@ -276,10 +277,10 @@ template <> inline bool isa(Value *Val) { return Val->getValueType() == Value::BasicBlockVal; } template <> inline bool isa(const Value *Val) { - return Val->getValueType() == Value::MethodVal; + return Val->getValueType() == Value::FunctionVal; } template <> inline bool isa(Value *Val) { - return Val->getValueType() == Value::MethodVal; + return Val->getValueType() == Value::FunctionVal; } template <> inline bool isa(const Value *Val) { return Val->getValueType() == Value::GlobalVariableVal; diff --git a/include/llvm/iOther.h b/include/llvm/iOther.h index 85698da7617..5100ac32ed7 100644 --- a/include/llvm/iOther.h +++ b/include/llvm/iOther.h @@ -9,7 +9,7 @@ #define LLVM_IOTHER_H #include "llvm/InstrTypes.h" -#include "llvm/Method.h" +#include "llvm/Function.h" //===----------------------------------------------------------------------===// // CastInst Class @@ -45,31 +45,31 @@ public: //===----------------------------------------------------------------------===// -// MethodArgument Class +// FunctionArgument Class //===----------------------------------------------------------------------===// -class MethodArgument : public Value { // Defined in the InstrType.cpp file - Method *Parent; +class FunctionArgument : public Value { // Defined in the InstrType.cpp file + Function *Parent; - friend class ValueHolder; - inline void setParent(Method *parent) { Parent = parent; } + friend class ValueHolder; + inline void setParent(Function *parent) { Parent = parent; } public: - MethodArgument(const Type *Ty, const std::string &Name = "") - : Value(Ty, Value::MethodArgumentVal, Name) { + FunctionArgument(const Type *Ty, const std::string &Name = "") + : Value(Ty, Value::FunctionArgumentVal, Name) { Parent = 0; } // Specialize setName to handle symbol table majik... virtual void setName(const std::string &name, SymbolTable *ST = 0); - inline const Method *getParent() const { return Parent; } - inline Method *getParent() { return Parent; } + inline const Function *getParent() const { return Parent; } + inline Function *getParent() { return Parent; } // Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const MethodArgument *) { return true; } + static inline bool classof(const FunctionArgument *) { return true; } static inline bool classof(const Value *V) { - return V->getValueType() == MethodArgumentVal; + return V->getValueType() == FunctionArgumentVal; } }; @@ -88,13 +88,17 @@ public: virtual Instruction *clone() const { return new CallInst(*this); } bool hasSideEffects() const { return true; } - const Method *getCalledMethod() const { - return dyn_cast(Operands[0]); + const Function *getCalledFunction() const { + return dyn_cast(Operands[0]); } - Method *getCalledMethod() { - return dyn_cast(Operands[0]); + Function *getCalledFunction() { + return dyn_cast(Operands[0]); } + // FIXME: Remove getCalledMethod's + const Function*getCalledMethod()const{return dyn_cast(Operands[0]);} + Function *getCalledMethod() { return dyn_cast(Operands[0]); } + // getCalledValue - Get a pointer to a method that is invoked by this inst. inline const Value *getCalledValue() const { return Operands[0]; } inline Value *getCalledValue() { return Operands[0]; }