Lines Matching full:module

1 //===- Module.cpp - Implement the Module class ----------------------------===//
9 // This file implements the Module class for the IR library.
13 #include "llvm/IR/Module.h"
71 // Primitive Module methods.
74 Module::Module(StringRef MID, LLVMContext &C)
81 Module::~Module() {
90 void Module::removeDebugIntrinsicDeclarations() {
113 Module::createRNG(const StringRef Name) const {
117 // when the Module ID and thus the input filename is the same. This
124 // const reference to their IR Module. Alternatively we can always
125 // store salt metadata from the Module constructor.
132 /// getNamedValue - Return the first global value in the module with
135 GlobalValue *Module::getNamedValue(StringRef Name) const {
139 unsigned Module::getNumNamedValues() const {
145 unsigned Module::getMDKindID(StringRef Name) const {
152 void Module::getMDKindNames(SmallVectorImpl<StringRef> &Result) const {
156 void Module::getOperandBundleTags(SmallVectorImpl<StringRef> &Result) const {
161 // Methods for easy access to the functions in the module.
164 // getOrInsertFunction - Look up the specified function in the module symbol
169 FunctionCallee Module::getOrInsertFunction(StringRef Name, FunctionType *Ty,
186 FunctionCallee Module::getOrInsertFunction(StringRef Name, FunctionType *Ty) {
190 // getFunction - Look up the specified function in the module symbol table.
193 Function *Module::getFunction(StringRef Name) const {
198 // Methods for easy access to the global variables in the module.
201 /// getGlobalVariable - Look up the specified global variable in the module
208 GlobalVariable *Module::getGlobalVariable(StringRef Name,
217 /// getOrInsertGlobal - Look up the specified global in the module symbol table.
223 Constant *Module::getOrInsertGlobal(
237 Constant *Module::getOrInsertGlobal(StringRef Name, Type *Ty) {
245 // Methods for easy access to the global variables in the module.
248 // getNamedAlias - Look up the specified global in the module symbol table.
251 GlobalAlias *Module::getNamedAlias(StringRef Name) const {
255 GlobalIFunc *Module::getNamedIFunc(StringRef Name) const {
259 /// getNamedMetadata - Return the first NamedMDNode in the module with the
262 NamedMDNode *Module::getNamedMetadata(const Twine &Name) const {
268 /// getOrInsertNamedMetadata - Return the first named MDNode in the module
271 NamedMDNode *Module::getOrInsertNamedMetadata(StringRef Name) {
281 /// eraseNamedMetadata - Remove the given NamedMDNode from this module and
283 void Module::eraseNamedMetadata(NamedMDNode *NMD) {
288 bool Module::isValidModFlagBehavior(Metadata *MD, ModFlagBehavior &MFB) {
299 bool Module::isValidModuleFlag(const MDNode &ModFlag, ModFlagBehavior &MFB,
313 /// getModuleFlagsMetadata - Returns the module flags in the provided vector.
314 void Module::
331 /// Return the corresponding value if Key appears in module flags, otherwise
333 Metadata *Module::getModuleFlag(StringRef Key) const {
334 SmallVector<Module::ModuleFlagEntry, 8> ModuleFlags;
343 /// getModuleFlagsMetadata - Returns the NamedMDNode in the module that
344 /// represents module-level flags. This method returns null if there are no
345 /// module-level flags.
346 NamedMDNode *Module::getModuleFlagsMetadata() const {
347 return getNamedMetadata("llvm.module.flags");
350 /// getOrInsertModuleFlagsMetadata - Returns the NamedMDNode in the module that
351 /// represents module-level flags. If module-level flags aren't found, it
353 NamedMDNode *Module::getOrInsertModuleFlagsMetadata() {
354 return getOrInsertNamedMetadata("llvm.module.flags");
357 /// addModuleFlag - Add a module-level flag to the module-level flags
358 /// metadata. It will create the module-level flags named metadata if it doesn't
360 void Module::addModuleFlag(ModFlagBehavior Behavior, StringRef Key,
368 void Module::addModuleFlag(ModFlagBehavior Behavior, StringRef Key,
372 void Module::addModuleFlag(ModFlagBehavior Behavior, StringRef Key,
377 void Module::addModuleFlag(MDNode *Node) {
379 "Invalid number of operands for module flag!");
382 "Invalid operand types for module flag!");
386 void Module::setModuleFlag(ModFlagBehavior Behavior, StringRef Key,
401 void Module::setModuleFlag(ModFlagBehavior Behavior, StringRef Key,
405 void Module::setModuleFlag(ModFlagBehavior Behavior, StringRef Key,
411 void Module::setDataLayout(StringRef Desc) {
415 void Module::setDataLayout(const DataLayout &Other) { DL = Other; }
417 DICompileUnit *Module::debug_compile_units_iterator::operator*() const {
420 DICompileUnit *Module::debug_compile_units_iterator::operator->() const {
424 void Module::debug_compile_units_iterator::SkipNoDebugCUs() {
430 iterator_range<Module::global_object_iterator> Module::global_objects() {
433 iterator_range<Module::const_global_object_iterator>
434 Module::global_objects() const {
438 iterator_range<Module::global_value_iterator> Module::global_values() {
441 iterator_range<Module::const_global_value_iterator>
442 Module::global_values() const {
447 // Methods to control the materialization of GlobalValues in the Module.
449 void Module::setMaterializer(GVMaterializer *GVM) {
451 "Module already has a GVMaterializer. Call materializeAll"
456 Error Module::materialize(GlobalValue *GV) {
463 Error Module::materializeAll() {
470 Error Module::materializeMetadata() {
477 // Other module related stuff.
480 std::vector<StructType *> Module::getIdentifiedStructTypes() const {
494 std::string Module::getUniqueIntrinsicName(StringRef BaseName, Intrinsic::ID Id,
546 // whole module at a time, even though there may be circular references... first
551 void Module::dropAllReferences() {
565 unsigned Module::getNumberRegisterParameters() const {
573 unsigned Module::getDwarfVersion() const {
580 bool Module::isDwarf64() const {
585 unsigned Module::getCodeViewFlag() const {
592 unsigned Module::getInstructionCount() const {
599 Comdat *Module::getOrInsertComdat(StringRef Name) {
605 PICLevel::Level Module::getPICLevel() const {
615 void Module::setPICLevel(PICLevel::Level PL) {
621 PIELevel::Level Module::getPIELevel() const {
631 void Module::setPIELevel(PIELevel::Level PL) {
635 std::optional<CodeModel::Model> Module::getCodeModel() const {
645 void Module::setCodeModel(CodeModel::Model CL) {
653 std::optional<uint64_t> Module::getLargeDataThreshold() const {
663 void Module::setLargeDataThreshold(uint64_t Threshold) {
670 void Module::setProfileSummary(Metadata *M, ProfileSummary::Kind Kind) {
677 Metadata *Module::getProfileSummary(bool IsCS) const {
682 bool Module::getSemanticInterposition() const {
692 void Module::setSemanticInterposition(bool SI) {
696 void Module::setOwnedMemoryBuffer(std::unique_ptr<MemoryBuffer> MB) {
700 bool Module::getRtLibUseGOT() const {
705 void Module::setRtLibUseGOT() {
709 bool Module::getDirectAccessExternalData() const {
717 void Module::setDirectAccessExternalData(bool Value) {
721 UWTableKind Module::getUwtable() const {
727 void Module::setUwtable(UWTableKind Kind) {
731 FramePointerKind Module::getFramePointer() const {
737 void Module::setFramePointer(FramePointerKind Kind) {
741 StringRef Module::getStackProtectorGuard() const {
748 void Module::setStackProtectorGuard(StringRef Kind) {
753 StringRef Module::getStackProtectorGuardReg() const {
760 void Module::setStackProtectorGuardReg(StringRef Reg) {
765 StringRef Module::getStackProtectorGuardSymbol() const {
772 void Module::setStackProtectorGuardSymbol(StringRef Symbol) {
777 int Module::getStackProtectorGuardOffset() const {
784 void Module::setStackProtectorGuardOffset(int Offset) {
788 unsigned Module::getOverrideStackAlignment() const {
795 unsigned Module::getMaxTLSAlignment() const {
802 void Module::setOverrideStackAlignment(unsigned Align) {
806 static void addSDKVersionMD(const VersionTuple &V, Module &M, StringRef Name) {
816 M.addModuleFlag(Module::ModFlagBehavior::Warning, Name,
820 void Module::setSDKVersion(const VersionTuple &V) {
849 VersionTuple Module::getSDKVersion() const {
854 const Module &M, SmallVectorImpl<GlobalValue *> &Vec, bool CompilerUsed) {
868 void Module::setPartialSampleProfileRatio(const ModuleSummaryIndex &Index) {
888 StringRef Module::getDarwinTargetVariantTriple() const {
894 void Module::setDarwinTargetVariantTriple(StringRef T) {
899 VersionTuple Module::getDarwinTargetVariantSDKVersion() const {
903 void Module::setDarwinTargetVariantSDKVersion(VersionTuple Version) {