LLVM  10.0.0svn
GlobalIFunc.h
Go to the documentation of this file.
1 //===-------- llvm/GlobalIFunc.h - GlobalIFunc class ------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \brief
10 /// This file contains the declaration of the GlobalIFunc class, which
11 /// represents a single indirect function in the IR. Indirect function uses
12 /// ELF symbol type extension to mark that the address of a declaration should
13 /// be resolved at runtime by calling a resolver function.
14 ///
15 //===----------------------------------------------------------------------===//
16 
17 #ifndef LLVM_IR_GLOBALIFUNC_H
18 #define LLVM_IR_GLOBALIFUNC_H
19 
20 #include "llvm/ADT/ilist_node.h"
22 #include "llvm/IR/Value.h"
23 
24 namespace llvm {
25 
26 class Twine;
27 class Module;
28 
29 // Traits class for using GlobalIFunc in symbol table in Module.
30 template <typename ValueSubClass> class SymbolTableListTraits;
31 
32 class GlobalIFunc final : public GlobalIndirectSymbol,
33  public ilist_node<GlobalIFunc> {
35 
38 
39 public:
40  GlobalIFunc(const GlobalIFunc &) = delete;
41  GlobalIFunc &operator=(const GlobalIFunc &) = delete;
42 
43  /// If a parent module is specified, the ifunc is automatically inserted into
44  /// the end of the specified module's ifunc list.
45  static GlobalIFunc *create(Type *Ty, unsigned AddressSpace,
48 
49  void copyAttributesFrom(const GlobalIFunc *Src) {
51  }
52 
53  /// This method unlinks 'this' from the containing module, but does not
54  /// delete it.
55  void removeFromParent();
56 
57  /// This method unlinks 'this' from the containing module and deletes it.
58  void eraseFromParent();
59 
60  /// These methods retrieve and set ifunc resolver function.
62  setIndirectSymbol(Resolver);
63  }
64  const Constant *getResolver() const {
65  return getIndirectSymbol();
66  }
68  return getIndirectSymbol();
69  }
70 
71  // Methods for support type inquiry through isa, cast, and dyn_cast:
72  static bool classof(const Value *V) {
73  return V->getValueID() == Value::GlobalIFuncVal;
74  }
75 };
76 
77 } // end namespace llvm
78 
79 #endif // LLVM_IR_GLOBALIFUNC_H
static bool classof(const Value *V)
Definition: GlobalIFunc.h:72
void copyAttributesFrom(const GlobalValue *Src)
Copy all additional attributes (those not needed to create a GlobalValue) from the GlobalValue Src to...
Definition: Globals.cpp:65
unsigned getValueID() const
Return an ID for the concrete type of this object.
Definition: Value.h:463
void setResolver(Constant *Resolver)
These methods retrieve and set ifunc resolver function.
Definition: GlobalIFunc.h:61
This class represents lattice values for constants.
Definition: AllocatorList.h:23
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:65
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
void setIndirectSymbol(Constant *Symbol)
These methods set and retrieve indirect symbol.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:80
static GlobalIFunc * create(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Resolver, Module *Parent)
If a parent module is specified, the ifunc is automatically inserted into the end of the specified mo...
Definition: Globals.cpp:500
const Constant * getResolver() const
Definition: GlobalIFunc.h:64
void eraseFromParent()
This method unlinks &#39;this&#39; from the containing module and deletes it.
Definition: Globals.cpp:510
Constant * getResolver()
Definition: GlobalIFunc.h:67
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:41
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
Definition: Record.h:1856
AddressSpace
Definition: NVPTXBaseInfo.h:21
void copyAttributesFrom(const GlobalIFunc *Src)
Definition: GlobalIFunc.h:49
unsigned Linkage
Definition: GlobalValue.h:94
LinkageTypes
An enumeration for the kinds of linkage for global values.
Definition: GlobalValue.h:47
GlobalIFunc & operator=(const GlobalIFunc &)=delete
void removeFromParent()
This method unlinks &#39;this&#39; from the containing module, but does not delete it.
Definition: Globals.cpp:506
const Constant * getIndirectSymbol() const
LLVM Value Representation.
Definition: Value.h:72