summaryrefslogtreecommitdiff
path: root/include/llvm/IR/GlobalAlias.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/IR/GlobalAlias.h')
-rw-r--r--include/llvm/IR/GlobalAlias.h44
1 files changed, 7 insertions, 37 deletions
diff --git a/include/llvm/IR/GlobalAlias.h b/include/llvm/IR/GlobalAlias.h
index b0772143309f6..3ae3e4a001e1f 100644
--- a/include/llvm/IR/GlobalAlias.h
+++ b/include/llvm/IR/GlobalAlias.h
@@ -15,17 +15,17 @@
#ifndef LLVM_IR_GLOBALALIAS_H
#define LLVM_IR_GLOBALALIAS_H
-#include "llvm/ADT/Twine.h"
#include "llvm/ADT/ilist_node.h"
-#include "llvm/IR/GlobalValue.h"
-#include "llvm/IR/OperandTraits.h"
+#include "llvm/IR/GlobalIndirectSymbol.h"
namespace llvm {
+class Twine;
class Module;
template <typename ValueSubClass> class SymbolTableListTraits;
-class GlobalAlias : public GlobalValue, public ilist_node<GlobalAlias> {
+class GlobalAlias : public GlobalIndirectSymbol,
+ public ilist_node<GlobalAlias> {
friend class SymbolTableListTraits<GlobalAlias>;
void operator=(const GlobalAlias &) = delete;
GlobalAlias(const GlobalAlias &) = delete;
@@ -36,11 +36,6 @@ class GlobalAlias : public GlobalValue, public ilist_node<GlobalAlias> {
const Twine &Name, Constant *Aliasee, Module *Parent);
public:
- // allocate space for exactly one operand
- void *operator new(size_t s) {
- return User::operator new(s, 1);
- }
-
/// If a parent module is specified, the alias is automatically inserted into
/// the end of the specified module's alias list.
static GlobalAlias *create(Type *Ty, unsigned AddressSpace,
@@ -64,9 +59,6 @@ public:
// Linkage, Type, Parent and AddressSpace taken from the Aliasee.
static GlobalAlias *create(const Twine &Name, GlobalValue *Aliasee);
- /// Provide fast operand accessors
- DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
-
/// removeFromParent - This method unlinks 'this' from the containing module,
/// but does not delete it.
///
@@ -77,28 +69,13 @@ public:
///
void eraseFromParent() override;
- /// These methods retrive and set alias target.
+ /// These methods retrieve and set alias target.
void setAliasee(Constant *Aliasee);
const Constant *getAliasee() const {
- return const_cast<GlobalAlias *>(this)->getAliasee();
+ return getIndirectSymbol();
}
Constant *getAliasee() {
- return getOperand(0);
- }
-
- const GlobalObject *getBaseObject() const {
- return const_cast<GlobalAlias *>(this)->getBaseObject();
- }
- GlobalObject *getBaseObject() {
- return dyn_cast<GlobalObject>(getAliasee()->stripInBoundsOffsets());
- }
-
- const GlobalObject *getBaseObject(const DataLayout &DL, APInt &Offset) const {
- return const_cast<GlobalAlias *>(this)->getBaseObject(DL, Offset);
- }
- GlobalObject *getBaseObject(const DataLayout &DL, APInt &Offset) {
- return dyn_cast<GlobalObject>(
- getAliasee()->stripAndAccumulateInBoundsConstantOffsets(DL, Offset));
+ return getIndirectSymbol();
}
static bool isValidLinkage(LinkageTypes L) {
@@ -112,13 +89,6 @@ public:
}
};
-template <>
-struct OperandTraits<GlobalAlias> :
- public FixedNumOperandTraits<GlobalAlias, 1> {
-};
-
-DEFINE_TRANSPARENT_OPERAND_ACCESSORS(GlobalAlias, Constant)
-
} // End llvm namespace
#endif