LLVM  4.0.0
GlobalAlias.h
Go to the documentation of this file.
1 //===-------- llvm/GlobalAlias.h - GlobalAlias class ------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the declaration of the GlobalAlias class, which
11 // represents a single function or variable alias in the IR.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_IR_GLOBALALIAS_H
16 #define LLVM_IR_GLOBALALIAS_H
17 
18 #include "llvm/ADT/ilist_node.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 
29  public ilist_node<GlobalAlias> {
31 
33  const Twine &Name, Constant *Aliasee, Module *Parent);
34 
35 public:
36  GlobalAlias(const GlobalAlias &) = delete;
37  GlobalAlias &operator=(const GlobalAlias &) = delete;
38 
39  /// If a parent module is specified, the alias is automatically inserted into
40  /// the end of the specified module's alias list.
41  static GlobalAlias *create(Type *Ty, unsigned AddressSpace,
43  Constant *Aliasee, Module *Parent);
44 
45  // Without the Aliasee.
46  static GlobalAlias *create(Type *Ty, unsigned AddressSpace,
48  Module *Parent);
49 
50  // The module is taken from the Aliasee.
51  static GlobalAlias *create(Type *Ty, unsigned AddressSpace,
53  GlobalValue *Aliasee);
54 
55  // Type, Parent and AddressSpace taken from the Aliasee.
57  GlobalValue *Aliasee);
58 
59  // Linkage, Type, Parent and AddressSpace taken from the Aliasee.
60  static GlobalAlias *create(const Twine &Name, GlobalValue *Aliasee);
61 
62  /// removeFromParent - This method unlinks 'this' from the containing module,
63  /// but does not delete it.
64  ///
65  void removeFromParent() override;
66 
67  /// eraseFromParent - This method unlinks 'this' from the containing module
68  /// and deletes it.
69  ///
70  void eraseFromParent() override;
71 
72  /// These methods retrieve and set alias target.
73  void setAliasee(Constant *Aliasee);
74  const Constant *getAliasee() const {
75  return getIndirectSymbol();
76  }
78  return getIndirectSymbol();
79  }
80 
81  static bool isValidLinkage(LinkageTypes L) {
82  return isExternalLinkage(L) || isLocalLinkage(L) ||
84  }
85 
86  // Methods for support type inquiry through isa, cast, and dyn_cast:
87  static inline bool classof(const Value *V) {
88  return V->getValueID() == Value::GlobalAliasVal;
89  }
90 };
91 
92 } // end namespace llvm
93 
94 #endif // LLVM_IR_GLOBALALIAS_H
MachineLoop * L
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:52
static bool isExternalLinkage(LinkageTypes Linkage)
Definition: GlobalValue.h:270
GlobalAlias & operator=(const GlobalAlias &)=delete
const Constant * getAliasee() const
Definition: GlobalAlias.h:74
static bool isLocalLinkage(LinkageTypes Linkage)
Definition: GlobalValue.h:300
static bool isLinkOnceLinkage(LinkageTypes Linkage)
Definition: GlobalValue.h:279
Constant * getAliasee()
Definition: GlobalAlias.h:77
static bool classof(const Value *V)
Definition: GlobalAlias.h:87
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
This is an important base class in LLVM.
Definition: Constant.h:42
static bool isValidLinkage(LinkageTypes L)
Definition: GlobalAlias.h:81
void removeFromParent() override
removeFromParent - This method unlinks 'this' from the containing module, but does not delete it...
Definition: Globals.cpp:413
unsigned getValueID() const
Return an ID for the concrete type of this object.
Definition: Value.h:434
static bool isWeakLinkage(LinkageTypes Linkage)
Definition: GlobalValue.h:288
AddressSpace
Definition: NVPTXBaseInfo.h:22
unsigned Linkage
Definition: GlobalValue.h:93
void eraseFromParent() override
eraseFromParent - This method unlinks 'this' from the containing module and deletes it...
Definition: Globals.cpp:417
LinkageTypes
An enumeration for the kinds of linkage for global values.
Definition: GlobalValue.h:48
const Constant * getIndirectSymbol() const
LLVM Value Representation.
Definition: Value.h:71
static GlobalAlias * create(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Aliasee, Module *Parent)
If a parent module is specified, the alias is automatically inserted into the end of the specified mo...
Definition: Globals.cpp:384
void setAliasee(Constant *Aliasee)
These methods retrieve and set alias target.
Definition: Globals.cpp:421