LLVM: include/llvm/IR/GlobalObject.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_IR_GLOBALOBJECT_H

15#define LLVM_IR_GLOBALOBJECT_H

16

22

23namespace llvm {

24

27

29public:

30

31

32

42

43protected:

50

52 enum {

56

58 };

61

62private:

64 static const unsigned AlignmentMask = (1 << AlignmentBits) - 1;

65 static const unsigned GlobalObjectMask = (1 << GlobalObjectBits) - 1;

66

67public:

69

70protected:

71

72

73

74

77 unsigned AlignmentData = Data & AlignmentMask;

79 }

80

81

83

84

85

86

88

93

100

101public:

102

103

104

105

109

110

111

112

113

117

118

119

120

121

123

124

125

126

128

129

131

136

145

146

148

152

153

154

155

156

157

159

160protected:

162

163public:

164

166 return V->getValueID() == Value::FunctionVal ||

167 V->getValueID() == Value::GlobalVariableVal ||

168 V->getValueID() == Value::GlobalIFuncVal;

169 }

170

171private:

172 void setGlobalObjectFlag(unsigned Bit, bool Val) {

173 unsigned Mask = 1 << Bit;

175 (Val ? Mask : 0u));

176 }

177

178 LLVM_ABI StringRef getSectionImpl() const;

179};

180

181}

182

183#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

Definition GlobalObject.h:28

Comdat * getComdat()

Definition GlobalObject.h:134

StringRef getSection() const

Get the custom section of this global if it has one.

Definition GlobalObject.h:114

LLVM_ABI void addTypeMetadata(unsigned Offset, Metadata *TypeID)

MaybeAlign getAlign() const

Returns the alignment of the given variable or function.

Definition GlobalObject.h:75

LLVM_ABI bool setSectionPrefix(StringRef Prefix)

If existing prefix is different from Prefix, set it to Prefix.

static bool classof(const Value *V)

Definition GlobalObject.h:165

static const unsigned GlobalObjectSubClassDataBits

Definition GlobalObject.h:59

GlobalObject(const GlobalObject &)=delete

@ LastAlignmentBit

Definition GlobalObject.h:53

@ GlobalObjectBits

Definition GlobalObject.h:57

@ LastCodeModelBit

Definition GlobalObject.h:54

@ HasSectionHashEntryBit

Definition GlobalObject.h:55

LLVM_ABI void setAlignment(Align Align)

Sets the alignment attribute of the GlobalObject.

GlobalObject(Type *Ty, ValueTy VTy, AllocInfo AllocInfo, LinkageTypes Linkage, const Twine &Name, unsigned AddressSpace=0)

Definition GlobalObject.h:44

LLVM_ABI void copyMetadata(const GlobalObject *Src, unsigned Offset)

Copy metadata from Src, adjusting offsets by Offset.

LLVM_ABI void setComdat(Comdat *C)

bool hasComdat() const

Definition GlobalObject.h:132

LLVM_ABI VCallVisibility getVCallVisibility() const

LLVM_ABI void copyAttributesFrom(const GlobalObject *Src)

LLVM_ABI void setSection(StringRef S)

Change the section for this global.

const Comdat * getComdat() const

Definition GlobalObject.h:133

Comdat * ObjComdat

Definition GlobalObject.h:51

VCallVisibility

Definition GlobalObject.h:33

@ VCallVisibilityLinkageUnit

Definition GlobalObject.h:38

@ VCallVisibilityTranslationUnit

Definition GlobalObject.h:40

@ VCallVisibilityPublic

Definition GlobalObject.h:35

LLVM_ABI std::optional< StringRef > getSectionPrefix() const

Get the section prefix for this global object.

void setGlobalObjectSubClassData(unsigned Val)

Definition GlobalObject.h:94

unsigned getGlobalObjectSubClassData() const

Definition GlobalObject.h:89

bool hasSection() const

Check if this global has a custom object file section.

Definition GlobalObject.h:106

LLVM_ABI bool canIncreaseAlignment() const

Returns true if the alignment of the value can be unilaterally increased.

LLVM_ABI void setVCallVisibilityMetadata(VCallVisibility Visibility)

static const unsigned GlobalValueSubClassDataBits

unsigned getGlobalValueSubClassData() const

void setGlobalValueSubClassData(unsigned V)

LinkageTypes

An enumeration for the kinds of linkage for global values.

GlobalValue(Type *Ty, ValueTy VTy, AllocInfo AllocInfo, LinkageTypes Linkage, const Twine &Name, unsigned AddressSpace)

StringRef - Represent a constant reference to a string, i.e.

Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...

The instances of the Type class are immutable: once they are created, they are never changed.

LLVM Value Representation.

bool hasMetadata() const

Return true if this value has any metadata attached to it.

LLVM_ABI void setMetadata(unsigned KindID, MDNode *Node)

Set a particular kind of metadata attachment.

LLVM_ABI void getAllMetadata(SmallVectorImpl< std::pair< unsigned, MDNode * > > &MDs) const

Appends all metadata attached to this value to MDs, sorting by KindID.

LLVM_ABI bool eraseMetadata(unsigned KindID)

Erase all metadata attachments with the given kind.

LLVM_ABI void addMetadata(unsigned KindID, MDNode &MD)

Add a metadata attachment.

LLVM_ABI void eraseMetadataIf(function_ref< bool(unsigned, MDNode *)> Pred)

Erase all metadata attachments matching the given predicate.

LLVM_ABI void clearMetadata()

Erase all metadata attached to this Value.

MDNode * getMetadata(unsigned KindID) const

Get the current metadata attachments for the given kind, if any.

ValueTy

Concrete subclass of this.

@ C

The default llvm calling convention, compatible with C.

This is an optimization pass for GlobalISel generic memory operations.

FunctionAddr VTableAddr uintptr_t uintptr_t Data

MaybeAlign decodeMaybeAlign(unsigned Value)

Dual operation of the encode function above.

This struct is a compact representation of a valid (non-zero power of two) alignment.

This struct is a compact representation of a valid (power of two) or undefined (0) alignment.

Information about how a User object was allocated, to be passed into the User constructor.