mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-20 02:28:23 +00:00
Transform uses of Method into uses of Function.
Rename MethodArgument to FunctionArgument Fix some _really_ out of date comments llvm-svn: 1986
This commit is contained in:
parent
9e84a283e3
commit
a874026838
@ -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<MethodArgument, Method, Method> ArgumentListType;
|
||||
typedef ValueHolder<BasicBlock , Method, Method> BasicBlocksType;
|
||||
typedef ValueHolder<FunctionArgument, Function, Function> ArgumentListType;
|
||||
typedef ValueHolder<BasicBlock , Function, Function> 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
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
@ -22,7 +22,7 @@ class ConstantPointerRef;
|
||||
class Module : public Value, public SymTabValue {
|
||||
public:
|
||||
typedef ValueHolder<GlobalVariable, Module, Module> GlobalListType;
|
||||
typedef ValueHolder<Method, Module, Module> MethodListType;
|
||||
typedef ValueHolder<Function, Module, Module> FunctionListType;
|
||||
|
||||
// Global Variable iterators...
|
||||
typedef GlobalListType::iterator giterator;
|
||||
@ -30,15 +30,15 @@ public:
|
||||
typedef std::reverse_iterator<giterator> reverse_giterator;
|
||||
typedef std::reverse_iterator<const_giterator> 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<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_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; }
|
||||
|
@ -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<Constant, const Value*>(const Value *Val) {
|
||||
template <> inline bool isa<Constant, Value*>(Value *Val) {
|
||||
return Val->getValueType() == Value::ConstantVal;
|
||||
}
|
||||
template <> inline bool isa<MethodArgument, const Value*>(const Value *Val) {
|
||||
return Val->getValueType() == Value::MethodArgumentVal;
|
||||
template <> inline bool isa<FunctionArgument, const Value*>(const Value *Val) {
|
||||
return Val->getValueType() == Value::FunctionArgumentVal;
|
||||
}
|
||||
template <> inline bool isa<MethodArgument, Value*>(Value *Val) {
|
||||
return Val->getValueType() == Value::MethodArgumentVal;
|
||||
template <> inline bool isa<FunctionArgument, Value*>(Value *Val) {
|
||||
return Val->getValueType() == Value::FunctionArgumentVal;
|
||||
}
|
||||
template <> inline bool isa<Instruction, const Value*>(const Value *Val) {
|
||||
return Val->getValueType() == Value::InstructionVal;
|
||||
@ -276,10 +277,10 @@ template <> inline bool isa<BasicBlock, Value*>(Value *Val) {
|
||||
return Val->getValueType() == Value::BasicBlockVal;
|
||||
}
|
||||
template <> inline bool isa<Function, const Value*>(const Value *Val) {
|
||||
return Val->getValueType() == Value::MethodVal;
|
||||
return Val->getValueType() == Value::FunctionVal;
|
||||
}
|
||||
template <> inline bool isa<Function, Value*>(Value *Val) {
|
||||
return Val->getValueType() == Value::MethodVal;
|
||||
return Val->getValueType() == Value::FunctionVal;
|
||||
}
|
||||
template <> inline bool isa<GlobalVariable, const Value*>(const Value *Val) {
|
||||
return Val->getValueType() == Value::GlobalVariableVal;
|
||||
|
@ -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<MethodArgument,Method,Method>;
|
||||
inline void setParent(Method *parent) { Parent = parent; }
|
||||
friend class ValueHolder<FunctionArgument,Function,Function>;
|
||||
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<Method>(Operands[0]);
|
||||
const Function *getCalledFunction() const {
|
||||
return dyn_cast<Function>(Operands[0]);
|
||||
}
|
||||
Method *getCalledMethod() {
|
||||
return dyn_cast<Method>(Operands[0]);
|
||||
Function *getCalledFunction() {
|
||||
return dyn_cast<Function>(Operands[0]);
|
||||
}
|
||||
|
||||
// FIXME: Remove getCalledMethod's
|
||||
const Function*getCalledMethod()const{return dyn_cast<Function>(Operands[0]);}
|
||||
Function *getCalledMethod() { return dyn_cast<Function>(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]; }
|
||||
|
Loading…
Reference in New Issue
Block a user