| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
#ifndef LLVM_IR_GLOBALALIAS_H |
| 15 |
#define LLVM_IR_GLOBALALIAS_H |
| 16 |
|
| 17 |
#include "llvm/ADT/ilist_node.h" |
| 18 |
#include "llvm/IR/GlobalValue.h" |
| 19 |
#include "llvm/IR/OperandTraits.h" |
| 20 |
#include "llvm/IR/Value.h" |
| 21 |
|
| 22 |
namespace llvm { |
| 23 |
|
| 24 |
class Twine; |
| 25 |
class Module; |
| 26 |
template <typename ValueSubClass> class SymbolTableListTraits; |
| 27 |
|
| 28 |
class GlobalAlias : public GlobalValue, public ilist_node<GlobalAlias> { |
| 29 |
friend class SymbolTableListTraits<GlobalAlias>; |
| 30 |
|
| 31 |
GlobalAlias(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, |
| 32 |
const Twine &Name, Constant *Aliasee, Module *Parent); |
| 33 |
|
| 34 |
public: |
| 35 |
GlobalAlias(const GlobalAlias &) = delete; |
| 36 |
GlobalAlias &operator=(const GlobalAlias &) = delete; |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
static GlobalAlias *create(Type *Ty, unsigned AddressSpace, |
| 41 |
LinkageTypes Linkage, const Twine &Name, |
| 42 |
Constant *Aliasee, Module *Parent); |
| 43 |
|
| 44 |
|
| 45 |
static GlobalAlias *create(Type *Ty, unsigned AddressSpace, |
| 46 |
LinkageTypes Linkage, const Twine &Name, |
| 47 |
Module *Parent); |
| 48 |
|
| 49 |
|
| 50 |
static GlobalAlias *create(Type *Ty, unsigned AddressSpace, |
| 51 |
LinkageTypes Linkage, const Twine &Name, |
| 52 |
GlobalValue *Aliasee); |
| 53 |
|
| 54 |
|
| 55 |
static GlobalAlias *create(LinkageTypes Linkage, const Twine &Name, |
| 56 |
GlobalValue *Aliasee); |
| 57 |
|
| 58 |
|
| 59 |
static GlobalAlias *create(const Twine &Name, GlobalValue *Aliasee); |
| 60 |
|
| 61 |
|
| 62 |
void *operator new(size_t S) { return User::operator new(S, 1); } |
| 63 |
void operator delete(void *Ptr) { User::operator delete(Ptr); } |
| 64 |
|
| 65 |
|
| 66 |
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant); |
| 67 |
|
| 68 |
void copyAttributesFrom(const GlobalAlias *Src) { |
| 69 |
GlobalValue::copyAttributesFrom(Src); |
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
void removeFromParent(); |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
void eraseFromParent(); |
| 81 |
|
| 82 |
|
| 83 |
void setAliasee(Constant *Aliasee); |
| 84 |
const Constant *getAliasee() const { |
| 85 |
return static_cast<Constant *>(Op<0>().get()); |
| 86 |
} |
| 87 |
Constant *getAliasee() { return static_cast<Constant *>(Op<0>().get()); } |
| 88 |
|
| 89 |
const GlobalObject *getAliaseeObject() const; |
| 90 |
GlobalObject *getAliaseeObject() { |
| 91 |
return const_cast<GlobalObject *>( |
| 92 |
static_cast<const GlobalAlias *>(this)->getAliaseeObject()); |
| 93 |
} |
| 94 |
|
| 95 |
static bool isValidLinkage(LinkageTypes L) { |
| 96 |
return isExternalLinkage(L) || isLocalLinkage(L) || |
| 97 |
isWeakLinkage(L) || isLinkOnceLinkage(L); |
| 98 |
} |
| 99 |
|
| 100 |
|
| 101 |
static bool classof(const Value *V) { |
| 102 |
return V->getValueID() == Value::GlobalAliasVal; |
| 103 |
} |
| 104 |
}; |
| 105 |
|
| 106 |
template <> |
| 107 |
struct OperandTraits<GlobalAlias> |
| 108 |
: public FixedNumOperandTraits<GlobalAlias, 1> {}; |
| 109 |
|
| 110 |
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(GlobalAlias, Constant) |
| 111 |
|
| 112 |
} |
| 113 |
|
| 114 |
#endif |