LLVM  14.0.0git
GlobalIndirectSymbol.h
Go to the documentation of this file.
1 //===- llvm/GlobalIndirectSymbol.h - GlobalIndirectSymbol 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 // This file contains the declaration of the GlobalIndirectSymbol class, which
10 // is a base class for GlobalAlias and GlobalIFunc. It contains all common code
11 // for aliases and ifuncs.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_IR_GLOBALINDIRECTSYMBOL_H
16 #define LLVM_IR_GLOBALINDIRECTSYMBOL_H
17 
18 #include "llvm/IR/GlobalObject.h"
19 #include "llvm/IR/GlobalValue.h"
20 #include "llvm/IR/OperandTraits.h"
21 #include "llvm/IR/User.h"
22 #include "llvm/IR/Value.h"
23 #include "llvm/Support/Casting.h"
24 #include <cstddef>
25 
26 namespace llvm {
27 
29 protected:
30  GlobalIndirectSymbol(Type *Ty, ValueTy VTy, unsigned AddressSpace,
32 
33 public:
36 
37  // allocate space for exactly one operand
38  void *operator new(size_t S) { return User::operator new(S, 1); }
39  void operator delete(void *Ptr) { User::operator delete(Ptr); }
40 
41  /// Provide fast operand accessors
43 
44  void copyAttributesFrom(const GlobalValue *Src) {
46  }
47 
48  /// These methods set and retrieve indirect symbol.
50  setOperand(0, Symbol);
51  }
52  const Constant *getIndirectSymbol() const {
53  return getOperand(0);
54  }
56  return const_cast<Constant *>(
57  static_cast<const GlobalIndirectSymbol *>(this)->getIndirectSymbol());
58  }
59 
60  const GlobalObject *getAliaseeObject() const;
62  return const_cast<GlobalObject *>(
63  static_cast<const GlobalIndirectSymbol *>(this)->getAliaseeObject());
64  }
65 
66  // Methods for support type inquiry through isa, cast, and dyn_cast:
67  static bool classof(const Value *V) {
68  return V->getValueID() == Value::GlobalAliasVal ||
69  V->getValueID() == Value::GlobalIFuncVal;
70  }
71 };
72 
73 template <>
75  public FixedNumOperandTraits<GlobalIndirectSymbol, 1> {
76 };
77 
79 
80 } // end namespace llvm
81 
82 #endif // LLVM_IR_GLOBALINDIRECTSYMBOL_H
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::GlobalIndirectSymbol::setIndirectSymbol
void setIndirectSymbol(Constant *Symbol)
These methods set and retrieve indirect symbol.
Definition: GlobalIndirectSymbol.h:49
llvm::GlobalIndirectSymbol
Definition: GlobalIndirectSymbol.h:28
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
DEFINE_TRANSPARENT_OPERAND_ACCESSORS
#define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS)
Macro for generating out-of-class operand accessor definitions.
Definition: OperandTraits.h:125
GlobalObject.h
llvm::GlobalIndirectSymbol::copyAttributesFrom
void copyAttributesFrom(const GlobalValue *Src)
Definition: GlobalIndirectSymbol.h:44
llvm::GlobalValue::LinkageTypes
LinkageTypes
An enumeration for the kinds of linkage for global values.
Definition: GlobalValue.h:47
GlobalValue.h
llvm::OperandTraits
Compile-time customization of User operands.
Definition: User.h:42
llvm::GlobalObject
Definition: GlobalObject.h:28
llvm::GlobalValue::copyAttributesFrom
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
llvm::GlobalIndirectSymbol::GlobalIndirectSymbol
GlobalIndirectSymbol(Type *Ty, ValueTy VTy, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Symbol)
Definition: Globals.cpp:427
llvm::Value::getValueID
unsigned getValueID() const
Return an ID for the concrete type of this object.
Definition: Value.h:533
llvm::GlobalIndirectSymbol::getAliaseeObject
const GlobalObject * getAliaseeObject() const
OperandTraits.h
llvm::AddressSpace
AddressSpace
Definition: NVPTXBaseInfo.h:21
llvm::GlobalValue
Definition: GlobalValue.h:44
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::GlobalIndirectSymbol::getIndirectSymbol
Constant * getIndirectSymbol()
Definition: GlobalIndirectSymbol.h:55
llvm::GlobalValue::Linkage
unsigned Linkage
Definition: GlobalValue.h:94
llvm::GlobalIndirectSymbol::getAliaseeObject
GlobalObject * getAliaseeObject()
Definition: GlobalIndirectSymbol.h:61
llvm::GlobalIndirectSymbol::DECLARE_TRANSPARENT_OPERAND_ACCESSORS
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant)
Provide fast operand accessors.
llvm::User::setOperand
void setOperand(unsigned i, Value *Val)
Definition: User.h:174
llvm::Value::ValueTy
ValueTy
Concrete subclass of this.
Definition: Value.h:514
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::GlobalIndirectSymbol::getIndirectSymbol
const Constant * getIndirectSymbol() const
Definition: GlobalIndirectSymbol.h:52
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:83
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
Casting.h
llvm::ARMBuildAttrs::Symbol
@ Symbol
Definition: ARMBuildAttributes.h:79
User.h
llvm::GlobalIndirectSymbol::operator=
GlobalIndirectSymbol & operator=(const GlobalIndirectSymbol &)=delete
llvm::GlobalIndirectSymbol::classof
static bool classof(const Value *V)
Definition: GlobalIndirectSymbol.h:67
llvm::FixedNumOperandTraits
FixedNumOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...
Definition: OperandTraits.h:30
llvm::User::getOperand
Value * getOperand(unsigned i) const
Definition: User.h:169
Value.h
llvm::Value
LLVM Value Representation.
Definition: Value.h:75