mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-02 08:46:37 +00:00
Add support for forward referencing types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@445 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e1fe875fc2
commit
eb5ff8d517
@ -16,7 +16,7 @@
|
||||
#include "llvm/ConstPoolVals.h"
|
||||
#include "llvm/iOther.h"
|
||||
#include "llvm/Method.h"
|
||||
#include "llvm/Type.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/Assembly/Parser.h"
|
||||
#include "llvm/Support/StringExtras.h"
|
||||
|
||||
@ -134,6 +134,13 @@ public:
|
||||
int getLineNum() const { return LineNum; }
|
||||
};
|
||||
|
||||
struct TypePlaceHolderHelper : public OpaqueType {
|
||||
TypePlaceHolderHelper(const Type *Ty) : OpaqueType() {
|
||||
assert(Ty == Type::TypeTy);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct InstPlaceHolderHelper : public Instruction {
|
||||
InstPlaceHolderHelper(const Type *Ty) : Instruction(Ty, UserOp1, "") {}
|
||||
|
||||
@ -154,20 +161,23 @@ struct MethPlaceHolderHelper : public Method {
|
||||
}
|
||||
};
|
||||
|
||||
typedef PlaceholderValue<TypePlaceHolderHelper> TypePlaceHolder;
|
||||
typedef PlaceholderValue<InstPlaceHolderHelper> ValuePlaceHolder;
|
||||
typedef PlaceholderValue<BBPlaceHolderHelper> BBPlaceHolder;
|
||||
typedef PlaceholderValue<MethPlaceHolderHelper> MethPlaceHolder;
|
||||
|
||||
static inline ValID &getValIDFromPlaceHolder(Value *Val) {
|
||||
static inline ValID &getValIDFromPlaceHolder(const Value *Val) {
|
||||
switch (Val->getType()->getPrimitiveID()) {
|
||||
case Type::TypeTyID: return ((TypePlaceHolder*)Val)->getDef();
|
||||
case Type::LabelTyID: return ((BBPlaceHolder*)Val)->getDef();
|
||||
case Type::MethodTyID: return ((MethPlaceHolder*)Val)->getDef();
|
||||
default: return ((ValuePlaceHolder*)Val)->getDef();
|
||||
}
|
||||
}
|
||||
|
||||
static inline int getLineNumFromPlaceHolder(Value *Val) {
|
||||
static inline int getLineNumFromPlaceHolder(const Value *Val) {
|
||||
switch (Val->getType()->getPrimitiveID()) {
|
||||
case Type::TypeTyID: return ((TypePlaceHolder*)Val)->getLineNum();
|
||||
case Type::LabelTyID: return ((BBPlaceHolder*)Val)->getLineNum();
|
||||
case Type::MethodTyID: return ((MethPlaceHolder*)Val)->getLineNum();
|
||||
default: return ((ValuePlaceHolder*)Val)->getLineNum();
|
||||
|
Loading…
Reference in New Issue
Block a user