llvm/llvm/lib/IR/Globals.cpp

//===-- Globals.cpp - Implement the GlobalValue & GlobalVariable class ----===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file implements the GlobalValue & GlobalVariable classes for the IR
// library.
//
//===----------------------------------------------------------------------===//

#include "LLVMContextImpl.h"
#include "llvm/IR/ConstantRange.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MD5.h"
#include "llvm/TargetParser/Triple.h"
usingnamespacellvm;

//===----------------------------------------------------------------------===//
//                            GlobalValue Class
//===----------------------------------------------------------------------===//

// GlobalValue should be a Constant, plus a type, a module, some flags, and an
// intrinsic ID. Add an assert to prevent people from accidentally growing
// GlobalValue while adding flags.
static_assert;

// GlobalObject adds a comdat.
static_assert;

bool GlobalValue::isMaterializable() const {}
Error GlobalValue::materialize() {}

/// Override destroyConstantImpl to make sure it doesn't get called on
/// GlobalValue's because they shouldn't be treated like other constants.
void GlobalValue::destroyConstantImpl() {}

Value *GlobalValue::handleOperandChangeImpl(Value *From, Value *To) {}

/// copyAttributesFrom - copy all additional attributes (those not needed to
/// create a GlobalValue) from the GlobalValue Src to this one.
void GlobalValue::copyAttributesFrom(const GlobalValue *Src) {}

GlobalValue::GUID GlobalValue::getGUID(StringRef GlobalName) {}

void GlobalValue::removeFromParent() {}

void GlobalValue::eraseFromParent() {}

GlobalObject::~GlobalObject() {}

bool GlobalValue::isInterposable() const {}

bool GlobalValue::canBenefitFromLocalAlias() const {}

const DataLayout &GlobalValue::getDataLayout() const {}

void GlobalObject::setAlignment(MaybeAlign Align) {}

void GlobalObject::setAlignment(Align Align) {}

void GlobalObject::copyAttributesFrom(const GlobalObject *Src) {}

std::string GlobalValue::getGlobalIdentifier(StringRef Name,
                                             GlobalValue::LinkageTypes Linkage,
                                             StringRef FileName) {}

std::string GlobalValue::getGlobalIdentifier() const {}

StringRef GlobalValue::getSection() const {}

const Comdat *GlobalValue::getComdat() const {}

void GlobalObject::setComdat(Comdat *C) {}

StringRef GlobalValue::getPartition() const {}

void GlobalValue::setPartition(StringRef S) {}

SanitizerMetadata;
const SanitizerMetadata &GlobalValue::getSanitizerMetadata() const {}

void GlobalValue::setSanitizerMetadata(SanitizerMetadata Meta) {}

void GlobalValue::removeSanitizerMetadata() {}

void GlobalValue::setNoSanitizeMetadata() {}

StringRef GlobalObject::getSectionImpl() const {}

void GlobalObject::setSection(StringRef S) {}

bool GlobalValue::isNobuiltinFnDef() const {}

bool GlobalValue::isDeclaration() const {}

bool GlobalObject::canIncreaseAlignment() const {}

template <typename Operation>
static const GlobalObject *
findBaseObject(const Constant *C, DenseSet<const GlobalAlias *> &Aliases,
               const Operation &Op) {}

const GlobalObject *GlobalValue::getAliaseeObject() const {}

bool GlobalValue::isAbsoluteSymbolRef() const {}

std::optional<ConstantRange> GlobalValue::getAbsoluteSymbolRange() const {}

bool GlobalValue::canBeOmittedFromSymbolTable() const {}

//===----------------------------------------------------------------------===//
// GlobalVariable Implementation
//===----------------------------------------------------------------------===//

GlobalVariable::GlobalVariable(Type *Ty, bool constant, LinkageTypes Link,
                               Constant *InitVal, const Twine &Name,
                               ThreadLocalMode TLMode, unsigned AddressSpace,
                               bool isExternallyInitialized)
    :{}

GlobalVariable::GlobalVariable(Module &M, Type *Ty, bool constant,
                               LinkageTypes Link, Constant *InitVal,
                               const Twine &Name, GlobalVariable *Before,
                               ThreadLocalMode TLMode,
                               std::optional<unsigned> AddressSpace,
                               bool isExternallyInitialized)
    :{}

void GlobalVariable::removeFromParent() {}

void GlobalVariable::eraseFromParent() {}

void GlobalVariable::setInitializer(Constant *InitVal) {}

void GlobalVariable::replaceInitializer(Constant *InitVal) {}

/// Copy all additional attributes (those not needed to create a GlobalVariable)
/// from the GlobalVariable Src to this one.
void GlobalVariable::copyAttributesFrom(const GlobalVariable *Src) {}

void GlobalVariable::dropAllReferences() {}

void GlobalVariable::setCodeModel(CodeModel::Model CM) {}

//===----------------------------------------------------------------------===//
// GlobalAlias Implementation
//===----------------------------------------------------------------------===//

GlobalAlias::GlobalAlias(Type *Ty, unsigned AddressSpace, LinkageTypes Link,
                         const Twine &Name, Constant *Aliasee,
                         Module *ParentModule)
    :{}

GlobalAlias *GlobalAlias::create(Type *Ty, unsigned AddressSpace,
                                 LinkageTypes Link, const Twine &Name,
                                 Constant *Aliasee, Module *ParentModule) {}

GlobalAlias *GlobalAlias::create(Type *Ty, unsigned AddressSpace,
                                 LinkageTypes Linkage, const Twine &Name,
                                 Module *Parent) {}

GlobalAlias *GlobalAlias::create(Type *Ty, unsigned AddressSpace,
                                 LinkageTypes Linkage, const Twine &Name,
                                 GlobalValue *Aliasee) {}

GlobalAlias *GlobalAlias::create(LinkageTypes Link, const Twine &Name,
                                 GlobalValue *Aliasee) {}

GlobalAlias *GlobalAlias::create(const Twine &Name, GlobalValue *Aliasee) {}

void GlobalAlias::removeFromParent() {}

void GlobalAlias::eraseFromParent() {}

void GlobalAlias::setAliasee(Constant *Aliasee) {}

const GlobalObject *GlobalAlias::getAliaseeObject() const {}

//===----------------------------------------------------------------------===//
// GlobalIFunc Implementation
//===----------------------------------------------------------------------===//

GlobalIFunc::GlobalIFunc(Type *Ty, unsigned AddressSpace, LinkageTypes Link,
                         const Twine &Name, Constant *Resolver,
                         Module *ParentModule)
    :{}

GlobalIFunc *GlobalIFunc::create(Type *Ty, unsigned AddressSpace,
                                 LinkageTypes Link, const Twine &Name,
                                 Constant *Resolver, Module *ParentModule) {}

void GlobalIFunc::removeFromParent() {}

void GlobalIFunc::eraseFromParent() {}

const Function *GlobalIFunc::getResolverFunction() const {}

void GlobalIFunc::applyAlongResolverPath(
    function_ref<void(const GlobalValue &)> Op) const {}