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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17#ifndef LLVM_IR_GLOBALVALUE_H

18#define LLVM_IR_GLOBALVALUE_H

19

28#include

29#include

30#include

31

32namespace llvm {

33

40

42typedef unsigned ID;

43}

44

45

46

48

50public:

51

65

66

72

73

79

80protected:

93

95

97

98

99

100 unsigned Linkage : 4;

101 unsigned Visibility : 2;

102 unsigned UnnamedAddrVal : 2;

104

105 unsigned ThreadLocal : 3;

106

107

108

109

110

112

113

114

116

117

118

120

121

122

123

125

126private:

127

128

130

132

133 void destroyConstantImpl();

135

136

137

138

139 bool mayBeDerefined() const {

144 return true;

145

154

155

156

157

159 }

160

162 }

163

164

165

166 LLVM_ABI bool isNobuiltinFnDef() const;

167

168protected:

169

170

171

172

173

174

176

178 return SubClassData;

179 }

182 SubClassData = V;

183 }

184

186

187

191

195

196public:

204

206

210

216

220

221

222

223

224

225

229

234

242

246 return const_cast<Comdat *>(

247 static_cast<const GlobalValue *>(this)->getComdat());

248 }

249

258 "local linkage requires default visibility");

262 }

263

264

276

288 "local linkage requires DefaultStorageClass");

290 }

291

294

295

297

299

304

306

310

316

317

318

323

324

325

326

327

328

329

330

331

332

333

334

335

338

339

340

341

342

343

344

345

346

347

348

350

351

352

353

355 };

356

359

360

361

362

366

370

377

423

424

425

426

433 return true;

434

438

439

444 return false;

445 }

447 }

448

449

450

455

456

457

458

459

465

466

467

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

490

491

493 return !mayBeDerefined();

494 }

495

496

498

499

500

501

502

504 }

505

506

507

508

509

512

538

549

553

555

556protected:

557

558

560

561public:

562

563

564

565

566

567

568

570 Name.consume_front("\1");

571 return Name;

572 }

573

574

575

576

578

579

580

581

582

586

587private:

588

589

591

592public:

593

594

595

597

598

599

603

604

605

606

607

608

609

610

611

612

613

615

616

618

619

620

621

622

624

627 return true;

628

630 }

631

632

633

634

635

636

637

641

645 static_cast<const GlobalValue *>(this)->getAliaseeObject());

646 }

647

648

650

651

652

654

655

656

658

659

661

662

665

666

667

668

670

671

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

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

675 V->getValueID() == Value::GlobalAliasVal ||

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

677 }

678

679

680

681

682

683

685};

686

687}

688

689#endif

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

static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")

GlobalValue::SanitizerMetadata SanitizerMetadata

This class represents a range of values.

LLVM_ABI void removeDeadConstantUsers() const

If there are any dead constant users dangling off of this constant, remove them.

A parsed version of the target data layout string in and methods for querying it.

Lightweight error class with error context and mandatory checking.

Definition GlobalValue.h:49

bool isDefinitionExact() const

Return true if the currently visible definition of this global (if any) is exactly the definition we ...

Definition GlobalValue.h:492

ThreadLocalMode

Definition GlobalValue.h:197

@ LocalExecTLSModel

Definition GlobalValue.h:202

@ GeneralDynamicTLSModel

Definition GlobalValue.h:199

@ NotThreadLocal

Definition GlobalValue.h:198

@ InitialExecTLSModel

Definition GlobalValue.h:201

@ LocalDynamicTLSModel

Definition GlobalValue.h:200

unsigned HasSanitizerMetadata

True if this symbol has sanitizer metadata available.

Definition GlobalValue.h:124

static bool isWeakAnyLinkage(LinkageTypes Linkage)

Definition GlobalValue.h:393

bool hasLinkOnceLinkage() const

Definition GlobalValue.h:517

const Module * getParent() const

Definition GlobalValue.h:664

static bool isAppendingLinkage(LinkageTypes Linkage)

Definition GlobalValue.h:402

bool hasPartition() const

Definition GlobalValue.h:311

static bool isLinkOnceAnyLinkage(LinkageTypes Linkage)

Definition GlobalValue.h:384

static LLVM_ABI GUID getGUIDAssumingExternalLinkage(StringRef GlobalName)

Return a 64-bit global unique ID constructed from the name of a global symbol.

LLVM_ABI const SanitizerMetadata & getSanitizerMetadata() const

Type * ValueType

Definition GlobalValue.h:94

bool hasExternalLinkage() const

Definition GlobalValue.h:513

bool isDSOLocal() const

Definition GlobalValue.h:307

unsigned HasPartition

True if this symbol has a partition name assigned (see https://lld.llvm.org/Partitions....

Definition GlobalValue.h:119

LLVM_ABI void removeSanitizerMetadata()

bool isThreadLocal() const

If the value is "Thread Local", its value isn't shared by the threads.

Definition GlobalValue.h:265

static bool isExternalWeakLinkage(LinkageTypes Linkage)

Definition GlobalValue.h:414

VisibilityTypes getVisibility() const

Definition GlobalValue.h:250

bool isImplicitDSOLocal() const

Definition GlobalValue.h:300

static bool isLocalLinkage(LinkageTypes Linkage)

Definition GlobalValue.h:411

LLVM_ABI bool isDeclaration() const

Return true if the primary definition of this global value is outside of the current translation unit...

bool hasValidDeclarationLinkage() const

Definition GlobalValue.h:535

LinkageTypes getLinkage() const

Definition GlobalValue.h:548

void setUnnamedAddr(UnnamedAddr Val)

Definition GlobalValue.h:233

static bool isWeakODRLinkage(LinkageTypes Linkage)

Definition GlobalValue.h:396

bool hasLinkOnceAnyLinkage() const

Definition GlobalValue.h:518

uint64_t GUID

Declare a type to represent a global unique identifier for a global value.

Definition GlobalValue.h:577

bool hasLocalLinkage() const

Definition GlobalValue.h:530

bool hasDefaultVisibility() const

Definition GlobalValue.h:251

static StringRef dropLLVMManglingEscape(StringRef Name)

If the given string begins with the GlobalValue name mangling escape character '\1',...

Definition GlobalValue.h:569

bool hasPrivateLinkage() const

Definition GlobalValue.h:529

LLVM_ABI bool isAbsoluteSymbolRef() const

Returns whether this is a reference to an absolute symbol.

bool isTagged() const

Definition GlobalValue.h:367

void setDLLStorageClass(DLLStorageClassTypes C)

Definition GlobalValue.h:286

LLVM_ABI const Comdat * getComdat() const

void setThreadLocalMode(ThreadLocalMode Val)

Definition GlobalValue.h:269

unsigned Visibility

Definition GlobalValue.h:101

static bool isLinkOnceLinkage(LinkageTypes Linkage)

Definition GlobalValue.h:390

Intrinsic::ID IntID

The intrinsic ID for this subclass (which must be a Function).

Definition GlobalValue.h:175

bool hasHiddenVisibility() const

Definition GlobalValue.h:252

bool hasExternalWeakLinkage() const

Definition GlobalValue.h:531

ThreadLocalMode getThreadLocalMode() const

Definition GlobalValue.h:273

bool hasExactDefinition() const

Return true if this global has an exact defintion.

Definition GlobalValue.h:497

unsigned HasLLVMReservedName

True if the function's name starts with "llvm.".

Definition GlobalValue.h:111

static bool isAvailableExternallyLinkage(LinkageTypes Linkage)

Definition GlobalValue.h:381

friend class Constant

Definition GlobalValue.h:131

bool hasWeakAnyLinkage() const

Definition GlobalValue.h:525

void setParent(Module *parent)

Definition GlobalValue.h:188

bool hasDLLImportStorageClass() const

Definition GlobalValue.h:280

void setLinkage(LinkageTypes LT)

Definition GlobalValue.h:539

DLLStorageClassTypes

Storage classes of global values for PE targets.

Definition GlobalValue.h:74

@ DefaultStorageClass

Definition GlobalValue.h:75

@ DLLExportStorageClass

Function to be accessible from DLL.

Definition GlobalValue.h:77

@ DLLImportStorageClass

Function to be imported from DLL.

Definition GlobalValue.h:76

bool hasDLLExportStorageClass() const

Definition GlobalValue.h:283

bool isDeclarationForLinker() const

Definition GlobalValue.h:625

Comdat * getComdat()

Definition GlobalValue.h:245

bool hasSanitizerMetadata() const

Definition GlobalValue.h:357

static UnnamedAddr getMinUnnamedAddr(UnnamedAddr A, UnnamedAddr B)

Definition GlobalValue.h:235

GlobalObject * getAliaseeObject()

Definition GlobalValue.h:643

unsigned getAddressSpace() const

Definition GlobalValue.h:207

GUID getGUID() const

Return a 64-bit global unique ID constructed from global value name (i.e.

Definition GlobalValue.h:600

LLVM_ABI StringRef getSection() const

LLVM_ABI StringRef getPartition() const

Module * getParent()

Get the module that this global value is contained inside of...

Definition GlobalValue.h:663

static bool isCommonLinkage(LinkageTypes Linkage)

Definition GlobalValue.h:417

LLVM_ABI const GlobalObject * getAliaseeObject() const

void setDSOLocal(bool Local)

Definition GlobalValue.h:305

LLVM_ABI std::optional< ConstantRange > getAbsoluteSymbolRange() const

If this is an absolute symbol reference, returns the range of the symbol, otherwise returns std::null...

bool hasInternalLinkage() const

Definition GlobalValue.h:528

LLVM_ABI void eraseFromParent()

This method unlinks 'this' from the containing module and deletes it.

static bool isPrivateLinkage(LinkageTypes Linkage)

Definition GlobalValue.h:408

bool isDiscardableIfUnused() const

Definition GlobalValue.h:550

static bool isExternalLinkage(LinkageTypes Linkage)

Definition GlobalValue.h:378

bool isStrongDefinitionForLinker() const

Returns true if this global's definition will be the one chosen by the linker.

Definition GlobalValue.h:638

PointerType * getType() const

Global values are always pointers.

Definition GlobalValue.h:296

VisibilityTypes

An enumeration for the kinds of visibility of global values.

Definition GlobalValue.h:67

@ DefaultVisibility

The GV is visible.

Definition GlobalValue.h:68

@ HiddenVisibility

The GV is hidden.

Definition GlobalValue.h:69

@ ProtectedVisibility

The GV is protected.

Definition GlobalValue.h:70

LLVM_ABI void copyAttributesFrom(const GlobalValue *Src)

Copy all additional attributes (those not needed to create a GlobalValue) from the GlobalValue Src to...

static bool isValidDeclarationLinkage(LinkageTypes Linkage)

Definition GlobalValue.h:420

static const unsigned GlobalValueSubClassDataBits

Definition GlobalValue.h:96

static bool isInternalLinkage(LinkageTypes Linkage)

Definition GlobalValue.h:405

static LLVM_ABI std::string getGlobalIdentifier(StringRef Name, GlobalValue::LinkageTypes Linkage, StringRef FileName)

Return the modified name for a global value suitable to be used as the key for a global lookup (e....

LLVM_ABI void setNoSanitizeMetadata()

bool hasSection() const

Definition GlobalValue.h:292

LLVM_ABI bool isInterposable() const

Return true if this global's definition can be substituted with an arbitrary definition at link time ...

void setVisibility(VisibilityTypes V)

Definition GlobalValue.h:256

LLVM_ABI const DataLayout & getDataLayout() const

Get the data layout of the module this global belongs to.

LLVM_ABI bool canBenefitFromLocalAlias() const

bool hasComdat() const

Definition GlobalValue.h:243

static bool isInterposableLinkage(LinkageTypes Linkage)

Whether the definition of this global may be replaced by something non-equivalent at link time.

Definition GlobalValue.h:427

bool hasWeakLinkage() const

Definition GlobalValue.h:524

bool hasAtLeastLocalUnnamedAddr() const

Returns true if this value's address is not significant in this module.

Definition GlobalValue.h:226

unsigned getGlobalValueSubClassData() const

Definition GlobalValue.h:177

static LinkageTypes getWeakLinkage(bool ODR)

Definition GlobalValue.h:374

bool hasWeakODRLinkage() const

Definition GlobalValue.h:526

void setGlobalValueSubClassData(unsigned V)

Definition GlobalValue.h:180

unsigned IsDSOLocal

If true then there is a definition within the same linkage unit and that definition cannot be runtime...

Definition GlobalValue.h:115

static LinkageTypes getLinkOnceLinkage(bool ODR)

Definition GlobalValue.h:371

LLVM_ABI bool isMaterializable() const

If this function's Module is being lazily streamed in functions from disk or some other source,...

bool isWeakForLinker() const

Definition GlobalValue.h:554

bool hasCommonLinkage() const

Definition GlobalValue.h:534

bool hasGlobalUnnamedAddr() const

Definition GlobalValue.h:217

LLVM_ABI Error materialize()

Make sure this GlobalValue is fully read.

UnnamedAddr getUnnamedAddr() const

Definition GlobalValue.h:230

static bool isWeakForLinker(LinkageTypes Linkage)

Whether the definition of this global may be replaced at link time.

Definition GlobalValue.h:460

GlobalValue(const GlobalValue &)=delete

bool hasAppendingLinkage() const

Definition GlobalValue.h:527

Module * Parent

Definition GlobalValue.h:185

~GlobalValue()

Definition GlobalValue.h:192

unsigned ThreadLocal

Definition GlobalValue.h:105

static bool isWeakLinkage(LinkageTypes Linkage)

Definition GlobalValue.h:399

unsigned Linkage

Definition GlobalValue.h:100

static bool isDiscardableIfUnused(LinkageTypes Linkage)

Whether the definition of this global may be discarded if it is not used in its compilation unit.

Definition GlobalValue.h:451

LLVM_ABI void setSanitizerMetadata(SanitizerMetadata Meta)

static bool classof(const Value *V)

Definition GlobalValue.h:672

bool hasLinkOnceODRLinkage() const

Definition GlobalValue.h:521

LLVM_ABI bool canBeOmittedFromSymbolTable() const

True if GV can be left out of the object symbol table.

LLVM_ABI void removeFromParent()

This method unlinks 'this' from the containing module, but does not delete it.

bool hasAvailableExternallyLinkage() const

Definition GlobalValue.h:514

UnnamedAddr

Definition GlobalValue.h:211

@ Global

Definition GlobalValue.h:214

@ Local

Definition GlobalValue.h:213

@ None

Definition GlobalValue.h:212

LinkageTypes

An enumeration for the kinds of linkage for global values.

Definition GlobalValue.h:52

@ PrivateLinkage

Like Internal, but omit from symbol table.

Definition GlobalValue.h:61

@ CommonLinkage

Tentative definitions.

Definition GlobalValue.h:63

@ InternalLinkage

Rename collisions when linking (static functions).

Definition GlobalValue.h:60

@ LinkOnceAnyLinkage

Keep one copy of function when linking (inline)

Definition GlobalValue.h:55

@ WeakODRLinkage

Same, but only replaced by something equivalent.

Definition GlobalValue.h:58

@ ExternalLinkage

Externally visible function.

Definition GlobalValue.h:53

@ WeakAnyLinkage

Keep one copy of named function when linking (weak)

Definition GlobalValue.h:57

@ AppendingLinkage

Special purpose, only applies to global arrays.

Definition GlobalValue.h:59

@ AvailableExternallyLinkage

Available for inspection, not emission.

Definition GlobalValue.h:54

@ ExternalWeakLinkage

ExternalWeak linkage description.

Definition GlobalValue.h:62

@ LinkOnceODRLinkage

Same, but only replaced by something equivalent.

Definition GlobalValue.h:56

void setThreadLocal(bool Val)

Definition GlobalValue.h:266

DLLStorageClassTypes getDLLStorageClass() const

Definition GlobalValue.h:277

Type * getValueType() const

Definition GlobalValue.h:298

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

Definition GlobalValue.h:81

static bool isLinkOnceODRLinkage(LinkageTypes Linkage)

Definition GlobalValue.h:387

bool hasProtectedVisibility() const

Definition GlobalValue.h:253

unsigned DllStorageClass

Definition GlobalValue.h:103

unsigned UnnamedAddrVal

Definition GlobalValue.h:102

LLVM_ABI void setPartition(StringRef Part)

A Module instance is used to store all the information related to an LLVM module.

Class to represent pointers.

unsigned getAddressSpace() const

Return the address space of the Pointer type.

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

constexpr bool empty() const

empty - Check if the string is empty.

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.

Type * getType() const

All values are typed, get the type of this value.

LLVM_ABI void setName(const Twine &Name)

Change the name of the value.

unsigned getValueID() const

Return an ID for the concrete type of this object.

LLVM_ABI LLVMContext & getContext() const

All values hold a context through their type.

ValueTy

Concrete subclass of this.

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

@ C

The default llvm calling convention, compatible with C.

This namespace contains an enum with a value for every intrinsic/builtin function known by LLVM.

This is an optimization pass for GlobalISel generic memory operations.

decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)

constexpr char GlobalIdentifierDelimiter

Definition GlobalValue.h:47

decltype(auto) cast(const From &Val)

cast - Return the argument parameter cast to the specified type.

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