LLVM 22.0.0git
Module.cpp
Go to the documentation of this file.
1//===- Module.cpp - Implement the Module class ----------------------------===//
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 implements the Module class for the IR library.
10//
11//===----------------------------------------------------------------------===//
12
13#include "llvm/IR/Module.h"
17#include "llvm/ADT/StringMap.h"
18#include "llvm/ADT/StringRef.h"
19#include "llvm/ADT/Twine.h"
20#include "llvm/IR/Attributes.h"
21#include "llvm/IR/Comdat.h"
22#include "llvm/IR/Constants.h"
23#include "llvm/IR/DataLayout.h"
26#include "llvm/IR/Function.h"
28#include "llvm/IR/GlobalAlias.h"
29#include "llvm/IR/GlobalIFunc.h"
30#include "llvm/IR/GlobalValue.h"
32#include "llvm/IR/LLVMContext.h"
33#include "llvm/IR/Metadata.h"
36#include "llvm/IR/Type.h"
37#include "llvm/IR/TypeFinder.h"
38#include "llvm/IR/Value.h"
43#include "llvm/Support/Error.h"
45#include "llvm/Support/Path.h"
49#include <cassert>
50#include <cstdint>
51#include <memory>
52#include <optional>
53#include <utility>
54#include <vector>
55
56using namespace llvm;
57
58//===----------------------------------------------------------------------===//
59// Methods to implement the globals and functions lists.
60//
61
62// Explicit instantiations of SymbolTableListTraits since some of the methods
63// are not in the public header file.
68
69//===----------------------------------------------------------------------===//
70// Primitive Module methods.
71//
72
74 : Context(C), ValSymTab(std::make_unique<ValueSymbolTable>(-1)),
75 ModuleID(std::string(MID)), SourceFileName(std::string(MID)) {
76 Context.addModule(this);
77}
78
80 assert(&Context == &Other.Context && "Module must be in the same Context");
81
82 dropAllReferences();
83
84 ModuleID = std::move(Other.ModuleID);
85 SourceFileName = std::move(Other.SourceFileName);
86
87 GlobalList.clear();
88 GlobalList.splice(GlobalList.begin(), Other.GlobalList);
89
90 FunctionList.clear();
91 FunctionList.splice(FunctionList.begin(), Other.FunctionList);
92
93 AliasList.clear();
94 AliasList.splice(AliasList.begin(), Other.AliasList);
95
96 IFuncList.clear();
97 IFuncList.splice(IFuncList.begin(), Other.IFuncList);
98
99 NamedMDList.clear();
100 NamedMDList.splice(NamedMDList.begin(), Other.NamedMDList);
101 GlobalScopeAsm = std::move(Other.GlobalScopeAsm);
102 OwnedMemoryBuffer = std::move(Other.OwnedMemoryBuffer);
103 Materializer = std::move(Other.Materializer);
104 TargetTriple = std::move(Other.TargetTriple);
105 DL = std::move(Other.DL);
106 CurrentIntrinsicIds = std::move(Other.CurrentIntrinsicIds);
107 UniquedIntrinsicNames = std::move(Other.UniquedIntrinsicNames);
108 ModuleFlags = std::move(Other.ModuleFlags);
109 Context.addModule(this);
110 return *this;
111}
112
114 Context.removeModule(this);
115 dropAllReferences();
116 GlobalList.clear();
117 FunctionList.clear();
118 AliasList.clear();
119 IFuncList.clear();
120}
121
123 if (auto *DeclareIntrinsicFn =
124 Intrinsic::getDeclarationIfExists(this, Intrinsic::dbg_declare)) {
125 assert((!isMaterialized() || DeclareIntrinsicFn->hasZeroLiveUses()) &&
126 "Debug declare intrinsic should have had uses removed.");
127 DeclareIntrinsicFn->eraseFromParent();
128 }
129 if (auto *ValueIntrinsicFn =
130 Intrinsic::getDeclarationIfExists(this, Intrinsic::dbg_value)) {
131 assert((!isMaterialized() || ValueIntrinsicFn->hasZeroLiveUses()) &&
132 "Debug value intrinsic should have had uses removed.");
133 ValueIntrinsicFn->eraseFromParent();
134 }
135 if (auto *AssignIntrinsicFn =
136 Intrinsic::getDeclarationIfExists(this, Intrinsic::dbg_assign)) {
137 assert((!isMaterialized() || AssignIntrinsicFn->hasZeroLiveUses()) &&
138 "Debug assign intrinsic should have had uses removed.");
139 AssignIntrinsicFn->eraseFromParent();
140 }
141 if (auto *LabelntrinsicFn =
142 Intrinsic::getDeclarationIfExists(this, Intrinsic::dbg_label)) {
143 assert((!isMaterialized() || LabelntrinsicFn->hasZeroLiveUses()) &&
144 "Debug label intrinsic should have had uses removed.");
145 LabelntrinsicFn->eraseFromParent();
146 }
147}
148
149std::unique_ptr<RandomNumberGenerator>
150Module::createRNG(const StringRef Name) const {
151 SmallString<32> Salt(Name);
152
153 // This RNG is guaranteed to produce the same random stream only
154 // when the Module ID and thus the input filename is the same. This
155 // might be problematic if the input filename extension changes
156 // (e.g. from .c to .bc or .ll).
157 //
158 // We could store this salt in NamedMetadata, but this would make
159 // the parameter non-const. This would unfortunately make this
160 // interface unusable by any Machine passes, since they only have a
161 // const reference to their IR Module. Alternatively we can always
162 // store salt metadata from the Module constructor.
163 Salt += sys::path::filename(getModuleIdentifier());
164
165 return std::unique_ptr<RandomNumberGenerator>(
166 new RandomNumberGenerator(Salt));
167}
168
169/// getNamedValue - Return the first global value in the module with
170/// the specified name, of arbitrary type. This method returns null
171/// if a global with the specified name is not found.
173 return cast_or_null<GlobalValue>(getValueSymbolTable().lookup(Name));
174}
175
176unsigned Module::getNumNamedValues() const {
177 return getValueSymbolTable().size();
178}
179
180/// getMDKindID - Return a unique non-zero ID for the specified metadata kind.
181/// This ID is uniqued across modules in the current LLVMContext.
182unsigned Module::getMDKindID(StringRef Name) const {
183 return Context.getMDKindID(Name);
184}
185
186/// getMDKindNames - Populate client supplied SmallVector with the name for
187/// custom metadata IDs registered in this LLVMContext. ID #0 is not used,
188/// so it is filled in as an empty string.
190 return Context.getMDKindNames(Result);
191}
192
194 return Context.getOperandBundleTags(Result);
195}
196
197//===----------------------------------------------------------------------===//
198// Methods for easy access to the functions in the module.
199//
200
201// getOrInsertFunction - Look up the specified function in the module symbol
202// table. If it does not exist, add a prototype for the function and return
203// it. This is nice because it allows most passes to get away with not handling
204// the symbol table directly for this common task.
205//
207 AttributeList AttributeList) {
208 // See if we have a definition for the specified function already.
209 GlobalValue *F = getNamedValue(Name);
210 if (!F) {
211 // Nope, add it
213 DL.getProgramAddressSpace(), Name, this);
214 if (!New->isIntrinsic()) // Intrinsics get attrs set on construction
215 New->setAttributes(AttributeList);
216 return {Ty, New}; // Return the new prototype.
217 }
218
219 // Otherwise, we just found the existing function or a prototype.
220 return {Ty, F};
221}
222
224 return getOrInsertFunction(Name, Ty, AttributeList());
225}
226
227// getFunction - Look up the specified function in the module symbol table.
228// If it does not exist, return null.
229//
231 return dyn_cast_or_null<Function>(getNamedValue(Name));
232}
233
234//===----------------------------------------------------------------------===//
235// Methods for easy access to the global variables in the module.
236//
237
238/// getGlobalVariable - Look up the specified global variable in the module
239/// symbol table. If it does not exist, return null. The type argument
240/// should be the underlying type of the global, i.e., it should not have
241/// the top-level PointerType, which represents the address of the global.
242/// If AllowLocal is set to true, this function will return types that
243/// have an local. By default, these types are not returned.
244///
246 bool AllowLocal) const {
247 if (GlobalVariable *Result =
248 dyn_cast_or_null<GlobalVariable>(getNamedValue(Name)))
249 if (AllowLocal || !Result->hasLocalLinkage())
250 return Result;
251 return nullptr;
252}
253
254/// getOrInsertGlobal - Look up the specified global in the module symbol table.
255/// If it does not exist, add a declaration of the global and return it.
256/// Otherwise, return the existing global.
258 StringRef Name, Type *Ty,
259 function_ref<GlobalVariable *()> CreateGlobalCallback) {
260 // See if we have a definition for the specified global already.
261 GlobalVariable *GV = dyn_cast_or_null<GlobalVariable>(getNamedValue(Name));
262 if (!GV)
263 GV = CreateGlobalCallback();
264 assert(GV && "The CreateGlobalCallback is expected to create a global");
265
266 // Otherwise, we just found the existing function or a prototype.
267 return GV;
268}
269
270// Overload to construct a global variable using its constructor's defaults.
272 return getOrInsertGlobal(Name, Ty, [&] {
273 return new GlobalVariable(*this, Ty, false, GlobalVariable::ExternalLinkage,
274 nullptr, Name);
275 });
276}
277
278//===----------------------------------------------------------------------===//
279// Methods for easy access to the global variables in the module.
280//
281
282// getNamedAlias - Look up the specified global in the module symbol table.
283// If it does not exist, return null.
284//
286 return dyn_cast_or_null<GlobalAlias>(getNamedValue(Name));
287}
288
290 return dyn_cast_or_null<GlobalIFunc>(getNamedValue(Name));
291}
292
293/// getNamedMetadata - Return the first NamedMDNode in the module with the
294/// specified name. This method returns null if a NamedMDNode with the
295/// specified name is not found.
297 return NamedMDSymTab.lookup(Name);
298}
299
300/// getOrInsertNamedMetadata - Return the first named MDNode in the module
301/// with the specified name. This method returns a new NamedMDNode if a
302/// NamedMDNode with the specified name is not found.
304 NamedMDNode *&NMD = NamedMDSymTab[Name];
305 if (!NMD) {
306 NMD = new NamedMDNode(Name);
307 NMD->setParent(this);
308 insertNamedMDNode(NMD);
309 if (Name == "llvm.module.flags")
310 ModuleFlags = NMD;
311 }
312 return NMD;
313}
314
315/// eraseNamedMetadata - Remove the given NamedMDNode from this module and
316/// delete it.
318 NamedMDSymTab.erase(NMD->getName());
319 if (NMD == ModuleFlags)
320 ModuleFlags = nullptr;
321 eraseNamedMDNode(NMD);
322}
323
324bool Module::isValidModFlagBehavior(Metadata *MD, ModFlagBehavior &MFB) {
326 uint64_t Val = Behavior->getLimitedValue();
327 if (Val >= ModFlagBehaviorFirstVal && Val <= ModFlagBehaviorLastVal) {
328 MFB = static_cast<ModFlagBehavior>(Val);
329 return true;
330 }
331 }
332 return false;
333}
334
335/// getModuleFlagsMetadata - Returns the module flags in the provided vector.
336void Module::
337getModuleFlagsMetadata(SmallVectorImpl<ModuleFlagEntry> &Flags) const {
338 const NamedMDNode *ModFlags = getModuleFlagsMetadata();
339 if (!ModFlags) return;
340
341 for (const MDNode *Flag : ModFlags->operands()) {
342 // The verifier will catch errors, so no need to check them here.
343 auto *MFBConstant = mdconst::extract<ConstantInt>(Flag->getOperand(0));
344 auto MFB = static_cast<ModFlagBehavior>(MFBConstant->getLimitedValue());
345 MDString *Key = cast<MDString>(Flag->getOperand(1));
346 Metadata *Val = Flag->getOperand(2);
347 Flags.push_back(ModuleFlagEntry(MFB, Key, Val));
348 }
349}
350
351/// Return the corresponding value if Key appears in module flags, otherwise
352/// return null.
354 const NamedMDNode *ModFlags = getModuleFlagsMetadata();
355 if (!ModFlags)
356 return nullptr;
357 for (const MDNode *Flag : ModFlags->operands()) {
358 if (Key == cast<MDString>(Flag->getOperand(1))->getString())
359 return Flag->getOperand(2);
360 }
361 return nullptr;
362}
363
364/// getOrInsertModuleFlagsMetadata - Returns the NamedMDNode in the module that
365/// represents module-level flags. If module-level flags aren't found, it
366/// creates the named metadata that contains them.
368 if (ModuleFlags)
369 return ModuleFlags;
370 return getOrInsertNamedMetadata("llvm.module.flags");
371}
372
373/// addModuleFlag - Add a module-level flag to the module-level flags
374/// metadata. It will create the module-level flags named metadata if it doesn't
375/// already exist.
376void Module::addModuleFlag(ModFlagBehavior Behavior, StringRef Key,
377 Metadata *Val) {
378 Type *Int32Ty = Type::getInt32Ty(Context);
379 Metadata *Ops[3] = {
380 ConstantAsMetadata::get(ConstantInt::get(Int32Ty, Behavior)),
381 MDString::get(Context, Key), Val};
382 getOrInsertModuleFlagsMetadata()->addOperand(MDNode::get(Context, Ops));
383}
384void Module::addModuleFlag(ModFlagBehavior Behavior, StringRef Key,
385 Constant *Val) {
386 addModuleFlag(Behavior, Key, ConstantAsMetadata::get(Val));
387}
388void Module::addModuleFlag(ModFlagBehavior Behavior, StringRef Key,
389 uint32_t Val) {
390 Type *Int32Ty = Type::getInt32Ty(Context);
391 addModuleFlag(Behavior, Key, ConstantInt::get(Int32Ty, Val));
392}
394 assert(Node->getNumOperands() == 3 &&
395 "Invalid number of operands for module flag!");
396 assert(mdconst::hasa<ConstantInt>(Node->getOperand(0)) &&
397 isa<MDString>(Node->getOperand(1)) &&
398 "Invalid operand types for module flag!");
399 getOrInsertModuleFlagsMetadata()->addOperand(Node);
400}
401
402void Module::setModuleFlag(ModFlagBehavior Behavior, StringRef Key,
403 Metadata *Val) {
404 NamedMDNode *ModFlags = getOrInsertModuleFlagsMetadata();
405 // Replace the flag if it already exists.
406 for (MDNode *Flag : ModFlags->operands()) {
407 if (cast<MDString>(Flag->getOperand(1))->getString() == Key) {
408 Flag->replaceOperandWith(2, Val);
409 return;
410 }
411 }
412 addModuleFlag(Behavior, Key, Val);
413}
414void Module::setModuleFlag(ModFlagBehavior Behavior, StringRef Key,
415 Constant *Val) {
416 setModuleFlag(Behavior, Key, ConstantAsMetadata::get(Val));
417}
418void Module::setModuleFlag(ModFlagBehavior Behavior, StringRef Key,
419 uint32_t Val) {
420 Type *Int32Ty = Type::getInt32Ty(Context);
421 setModuleFlag(Behavior, Key, ConstantInt::get(Int32Ty, Val));
422}
423
425
427
429 return cast<DICompileUnit>(CUs->getOperand(Idx));
430}
432 return cast<DICompileUnit>(CUs->getOperand(Idx));
433}
434
435void Module::debug_compile_units_iterator::SkipNoDebugCUs() {
436 while (CUs && (Idx < CUs->getNumOperands()) &&
437 ((*this)->getEmissionKind() == DICompileUnit::NoDebug))
438 ++Idx;
439}
440
443}
447}
448
450 return concat<GlobalValue>(functions(), globals(), aliases(), ifuncs());
451}
453Module::global_values() const {
454 return concat<const GlobalValue>(functions(), globals(), aliases(), ifuncs());
455}
456
457//===----------------------------------------------------------------------===//
458// Methods to control the materialization of GlobalValues in the Module.
459//
461 assert(!Materializer &&
462 "Module already has a GVMaterializer. Call materializeAll"
463 " to clear it out before setting another one.");
464 Materializer.reset(GVM);
465}
466
468 if (!Materializer)
469 return Error::success();
470
471 return Materializer->materialize(GV);
472}
473
475 if (!Materializer)
476 return Error::success();
477 std::unique_ptr<GVMaterializer> M = std::move(Materializer);
478 return M->materializeModule();
479}
480
482 llvm::TimeTraceScope timeScope("Materialize metadata");
483 if (!Materializer)
484 return Error::success();
485 return Materializer->materializeMetadata();
486}
487
488//===----------------------------------------------------------------------===//
489// Other module related stuff.
490//
491
492std::vector<StructType *> Module::getIdentifiedStructTypes() const {
493 // If we have a materializer, it is possible that some unread function
494 // uses a type that is currently not visible to a TypeFinder, so ask
495 // the materializer which types it created.
496 if (Materializer)
497 return Materializer->getIdentifiedStructTypes();
498
499 std::vector<StructType *> Ret;
500 TypeFinder SrcStructTypes;
501 SrcStructTypes.run(*this, true);
502 Ret.assign(SrcStructTypes.begin(), SrcStructTypes.end());
503 return Ret;
504}
505
507 const FunctionType *Proto) {
508 auto Encode = [&BaseName](unsigned Suffix) {
509 return (Twine(BaseName) + "." + Twine(Suffix)).str();
510 };
511
512 {
513 // fast path - the prototype is already known
514 auto UinItInserted = UniquedIntrinsicNames.insert({{Id, Proto}, 0});
515 if (!UinItInserted.second)
516 return Encode(UinItInserted.first->second);
517 }
518
519 // Not known yet. A new entry was created with index 0. Check if there already
520 // exists a matching declaration, or select a new entry.
521
522 // Start looking for names with the current known maximum count (or 0).
523 auto NiidItInserted = CurrentIntrinsicIds.insert({BaseName, 0});
524 unsigned Count = NiidItInserted.first->second;
525
526 // This might be slow if a whole population of intrinsics already existed, but
527 // we cache the values for later usage.
528 std::string NewName;
529 while (true) {
530 NewName = Encode(Count);
531 GlobalValue *F = getNamedValue(NewName);
532 if (!F) {
533 // Reserve this entry for the new proto
534 UniquedIntrinsicNames[{Id, Proto}] = Count;
535 break;
536 }
537
538 // A declaration with this name already exists. Remember it.
539 FunctionType *FT = dyn_cast<FunctionType>(F->getValueType());
540 auto UinItInserted = UniquedIntrinsicNames.insert({{Id, FT}, Count});
541 if (FT == Proto) {
542 // It was a declaration for our prototype. This entry was allocated in the
543 // beginning. Update the count to match the existing declaration.
544 UinItInserted.first->second = Count;
545 break;
546 }
547
548 ++Count;
549 }
550
551 NiidItInserted.first->second = Count + 1;
552
553 return NewName;
554}
555
556// dropAllReferences() - This function causes all the subelements to "let go"
557// of all references that they are maintaining. This allows one to 'delete' a
558// whole module at a time, even though there may be circular references... first
559// all references are dropped, and all use counts go to zero. Then everything
560// is deleted for real. Note that no operations are valid on an object that
561// has "dropped all references", except operator delete.
562//
564 for (Function &F : *this)
565 F.dropAllReferences();
566
567 for (GlobalVariable &GV : globals())
569
570 for (GlobalAlias &GA : aliases())
571 GA.dropAllReferences();
572
573 for (GlobalIFunc &GIF : ifuncs())
574 GIF.dropAllReferences();
575}
576
578 auto *Val =
579 cast_or_null<ConstantAsMetadata>(getModuleFlag("NumRegisterParameters"));
580 if (!Val)
581 return 0;
582 return cast<ConstantInt>(Val->getValue())->getZExtValue();
583}
584
585unsigned Module::getDwarfVersion() const {
586 auto *Val = cast_or_null<ConstantAsMetadata>(getModuleFlag("Dwarf Version"));
587 if (!Val)
588 return 0;
589 return cast<ConstantInt>(Val->getValue())->getZExtValue();
590}
591
592bool Module::isDwarf64() const {
593 auto *Val = cast_or_null<ConstantAsMetadata>(getModuleFlag("DWARF64"));
594 return Val && cast<ConstantInt>(Val->getValue())->isOne();
595}
596
597unsigned Module::getCodeViewFlag() const {
598 auto *Val = cast_or_null<ConstantAsMetadata>(getModuleFlag("CodeView"));
599 if (!Val)
600 return 0;
601 return cast<ConstantInt>(Val->getValue())->getZExtValue();
602}
603
604unsigned Module::getInstructionCount() const {
605 unsigned NumInstrs = 0;
606 for (const Function &F : FunctionList)
607 NumInstrs += F.getInstructionCount();
608 return NumInstrs;
609}
610
612 auto &Entry = *ComdatSymTab.insert(std::make_pair(Name, Comdat())).first;
613 Entry.second.Name = &Entry;
614 return &Entry.second;
615}
616
618 auto *Val = cast_or_null<ConstantAsMetadata>(getModuleFlag("PIC Level"));
619
620 if (!Val)
621 return PICLevel::NotPIC;
622
623 return static_cast<PICLevel::Level>(
624 cast<ConstantInt>(Val->getValue())->getZExtValue());
625}
626
628 // The merge result of a non-PIC object and a PIC object can only be reliably
629 // used as a non-PIC object, so use the Min merge behavior.
630 addModuleFlag(ModFlagBehavior::Min, "PIC Level", PL);
631}
632
634 auto *Val = cast_or_null<ConstantAsMetadata>(getModuleFlag("PIE Level"));
635
636 if (!Val)
637 return PIELevel::Default;
638
639 return static_cast<PIELevel::Level>(
640 cast<ConstantInt>(Val->getValue())->getZExtValue());
641}
642
644 addModuleFlag(ModFlagBehavior::Max, "PIE Level", PL);
645}
646
647std::optional<CodeModel::Model> Module::getCodeModel() const {
648 auto *Val = cast_or_null<ConstantAsMetadata>(getModuleFlag("Code Model"));
649
650 if (!Val)
651 return std::nullopt;
652
653 return static_cast<CodeModel::Model>(
654 cast<ConstantInt>(Val->getValue())->getZExtValue());
655}
656
658 // Linking object files with different code models is undefined behavior
659 // because the compiler would have to generate additional code (to span
660 // longer jumps) if a larger code model is used with a smaller one.
661 // Therefore we will treat attempts to mix code models as an error.
662 addModuleFlag(ModFlagBehavior::Error, "Code Model", CL);
663}
664
665std::optional<uint64_t> Module::getLargeDataThreshold() const {
666 auto *Val =
667 cast_or_null<ConstantAsMetadata>(getModuleFlag("Large Data Threshold"));
668
669 if (!Val)
670 return std::nullopt;
671
672 return cast<ConstantInt>(Val->getValue())->getZExtValue();
673}
674
676 // Since the large data threshold goes along with the code model, the merge
677 // behavior is the same.
678 addModuleFlag(ModFlagBehavior::Error, "Large Data Threshold",
679 ConstantInt::get(Type::getInt64Ty(Context), Threshold));
680}
681
683 if (Kind == ProfileSummary::PSK_CSInstr)
684 setModuleFlag(ModFlagBehavior::Error, "CSProfileSummary", M);
685 else
686 setModuleFlag(ModFlagBehavior::Error, "ProfileSummary", M);
687}
688
689Metadata *Module::getProfileSummary(bool IsCS) const {
690 return (IsCS ? getModuleFlag("CSProfileSummary")
691 : getModuleFlag("ProfileSummary"));
692}
693
695 Metadata *MF = getModuleFlag("SemanticInterposition");
696
697 auto *Val = cast_or_null<ConstantAsMetadata>(MF);
698 if (!Val)
699 return false;
700
701 return cast<ConstantInt>(Val->getValue())->getZExtValue();
702}
703
705 addModuleFlag(ModFlagBehavior::Error, "SemanticInterposition", SI);
706}
707
708void Module::setOwnedMemoryBuffer(std::unique_ptr<MemoryBuffer> MB) {
709 OwnedMemoryBuffer = std::move(MB);
710}
711
712bool Module::getRtLibUseGOT() const {
713 auto *Val = cast_or_null<ConstantAsMetadata>(getModuleFlag("RtLibUseGOT"));
714 return Val && (cast<ConstantInt>(Val->getValue())->getZExtValue() > 0);
715}
716
718 addModuleFlag(ModFlagBehavior::Max, "RtLibUseGOT", 1);
719}
720
723 getModuleFlag("direct-access-external-data"));
724 if (Val)
725 return cast<ConstantInt>(Val->getValue())->getZExtValue() > 0;
726 return getPICLevel() == PICLevel::NotPIC;
727}
728
730 addModuleFlag(ModFlagBehavior::Max, "direct-access-external-data", Value);
731}
732
734 if (auto *Val = cast_or_null<ConstantAsMetadata>(getModuleFlag("uwtable")))
735 return UWTableKind(cast<ConstantInt>(Val->getValue())->getZExtValue());
736 return UWTableKind::None;
737}
738
740 addModuleFlag(ModFlagBehavior::Max, "uwtable", uint32_t(Kind));
741}
742
744 auto *Val = cast_or_null<ConstantAsMetadata>(getModuleFlag("frame-pointer"));
745 return static_cast<FramePointerKind>(
746 Val ? cast<ConstantInt>(Val->getValue())->getZExtValue() : 0);
747}
748
750 addModuleFlag(ModFlagBehavior::Max, "frame-pointer", static_cast<int>(Kind));
751}
752
754 Metadata *MD = getModuleFlag("stack-protector-guard");
755 if (auto *MDS = dyn_cast_or_null<MDString>(MD))
756 return MDS->getString();
757 return {};
758}
759
762 addModuleFlag(ModFlagBehavior::Error, "stack-protector-guard", ID);
763}
764
766 Metadata *MD = getModuleFlag("stack-protector-guard-reg");
767 if (auto *MDS = dyn_cast_or_null<MDString>(MD))
768 return MDS->getString();
769 return {};
770}
771
774 addModuleFlag(ModFlagBehavior::Error, "stack-protector-guard-reg", ID);
775}
776
778 Metadata *MD = getModuleFlag("stack-protector-guard-symbol");
779 if (auto *MDS = dyn_cast_or_null<MDString>(MD))
780 return MDS->getString();
781 return {};
782}
783
785 MDString *ID = MDString::get(getContext(), Symbol);
786 addModuleFlag(ModFlagBehavior::Error, "stack-protector-guard-symbol", ID);
787}
788
790 Metadata *MD = getModuleFlag("stack-protector-guard-offset");
792 return CI->getSExtValue();
793 return INT_MAX;
794}
795
797 addModuleFlag(ModFlagBehavior::Error, "stack-protector-guard-offset", Offset);
798}
799
800unsigned Module::getOverrideStackAlignment() const {
801 Metadata *MD = getModuleFlag("override-stack-alignment");
803 return CI->getZExtValue();
804 return 0;
805}
806
807unsigned Module::getMaxTLSAlignment() const {
808 Metadata *MD = getModuleFlag("MaxTLSAlign");
810 return CI->getZExtValue();
811 return 0;
812}
813
815 addModuleFlag(ModFlagBehavior::Error, "override-stack-alignment", Align);
816}
817
818static void addSDKVersionMD(const VersionTuple &V, Module &M, StringRef Name) {
820 Entries.push_back(V.getMajor());
821 if (auto Minor = V.getMinor()) {
822 Entries.push_back(*Minor);
823 if (auto Subminor = V.getSubminor())
824 Entries.push_back(*Subminor);
825 // Ignore the 'build' component as it can't be represented in the object
826 // file.
827 }
828 M.addModuleFlag(Module::ModFlagBehavior::Warning, Name,
829 ConstantDataArray::get(M.getContext(), Entries));
830}
831
832void Module::setSDKVersion(const VersionTuple &V) {
833 addSDKVersionMD(V, *this, "SDK Version");
834}
835
838 if (!CM)
839 return {};
840 auto *Arr = dyn_cast_or_null<ConstantDataArray>(CM->getValue());
841 if (!Arr)
842 return {};
843 auto getVersionComponent = [&](unsigned Index) -> std::optional<unsigned> {
844 if (Index >= Arr->getNumElements())
845 return std::nullopt;
846 return (unsigned)Arr->getElementAsInteger(Index);
847 };
848 auto Major = getVersionComponent(0);
849 if (!Major)
850 return {};
852 if (auto Minor = getVersionComponent(1)) {
853 Result = VersionTuple(*Major, *Minor);
854 if (auto Subminor = getVersionComponent(2)) {
855 Result = VersionTuple(*Major, *Minor, *Subminor);
856 }
857 }
858 return Result;
859}
860
862 return getSDKVersionMD(getModuleFlag("SDK Version"));
863}
864
866 const Module &M, SmallVectorImpl<GlobalValue *> &Vec, bool CompilerUsed) {
867 const char *Name = CompilerUsed ? "llvm.compiler.used" : "llvm.used";
868 GlobalVariable *GV = M.getGlobalVariable(Name);
869 if (!GV || !GV->hasInitializer())
870 return GV;
871
873 for (Value *Op : Init->operands()) {
874 GlobalValue *G = cast<GlobalValue>(Op->stripPointerCasts());
875 Vec.push_back(G);
876 }
877 return GV;
878}
879
881 if (auto *SummaryMD = getProfileSummary(/*IsCS*/ false)) {
882 std::unique_ptr<ProfileSummary> ProfileSummary(
883 ProfileSummary::getFromMD(SummaryMD));
884 if (ProfileSummary) {
887 return;
888 uint64_t BlockCount = Index.getBlockCount();
889 uint32_t NumCounts = ProfileSummary->getNumCounts();
890 if (!NumCounts)
891 return;
892 double Ratio = (double)BlockCount / NumCounts;
894 setProfileSummary(ProfileSummary->getMD(getContext()),
896 }
897 }
898}
899
901 if (const auto *MD = getModuleFlag("darwin.target_variant.triple"))
902 return cast<MDString>(MD)->getString();
903 return "";
904}
905
907 addModuleFlag(ModFlagBehavior::Warning, "darwin.target_variant.triple",
909}
910
912 return getSDKVersionMD(getModuleFlag("darwin.target_variant.SDK Version"));
913}
914
916 addSDKVersionMD(Version, *this, "darwin.target_variant.SDK Version");
917}
918
920 StringRef TargetABI;
921 if (auto *TargetABIMD =
922 dyn_cast_or_null<MDString>(getModuleFlag("target-abi")))
923 TargetABI = TargetABIMD->getString();
924 return TargetABI;
925}
926
928 Metadata *MD = getModuleFlag("winx64-eh-unwindv2");
930 return static_cast<WinX64EHUnwindV2Mode>(CI->getZExtValue());
932}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the StringMap class.
Lower uses of LDS variables from non kernel functions
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file contains the simple types necessary to represent the attributes associated with functions a...
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
#define LLVM_EXPORT_TEMPLATE
Definition Compiler.h:215
This file contains the declarations for the subclasses of Constant, which represent the different fla...
dxil globals
dxil translate DXIL Translate Metadata
This file contains the declaration of the GlobalIFunc class, which represents a single indirect funct...
Module.h This file contains the declarations for the Module class.
static bool lookup(const GsymReader &GR, DataExtractor &Data, uint64_t &Offset, uint64_t BaseAddr, uint64_t Addr, SourceLocations &SrcLocs, llvm::Error &Err)
A Lookup helper functions.
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
#define F(x, y, z)
Definition MD5.cpp:55
#define G(x, y, z)
Definition MD5.cpp:56
Machine Check Debug Module
Register Reg
static Constant * getOrInsertGlobal(Module &M, StringRef Name, Type *Ty)
This file contains the declarations for metadata subclasses.
#define T
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...
StandardInstrumentations SI(Mod->getContext(), Debug, VerifyEach)
static VersionTuple getSDKVersionMD(Metadata *MD)
Definition Module.cpp:836
static void addSDKVersionMD(const VersionTuple &V, Module &M, StringRef Name)
Definition Module.cpp:818
This file defines the SmallString class.
This file defines the SmallVector class.
Defines the llvm::VersionTuple class, which represents a version in the form major[....
ConstantArray - Constant Array Declarations.
Definition Constants.h:433
static ConstantAsMetadata * get(Constant *C)
Definition Metadata.h:535
static Constant * get(LLVMContext &Context, ArrayRef< ElementTy > Elts)
get() constructor - Return a constant with array type with an element count and element type matching...
Definition Constants.h:715
This is the shared class of boolean and integer constants.
Definition Constants.h:87
This is an important base class in LLVM.
Definition Constant.h:43
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:63
static ErrorSuccess success()
Create a success value.
Definition Error.h:336
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
Definition Function.h:166
@ ExternalLinkage
Externally visible function.
Definition GlobalValue.h:53
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
bool hasInitializer() const
Definitions have initializers, declarations don't.
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:68
Metadata node.
Definition Metadata.h:1077
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition Metadata.h:1565
A single uniqued string.
Definition Metadata.h:720
static LLVM_ABI MDString * get(LLVMContext &Context, StringRef Str)
Definition Metadata.cpp:607
Class to hold module path string table and global value map, and encapsulate methods for operating on...
LLVM_ABI DICompileUnit * operator*() const
Definition Module.cpp:428
LLVM_ABI DICompileUnit * operator->() const
Definition Module.cpp:431
void setStackProtectorGuardSymbol(StringRef Symbol)
Definition Module.cpp:784
void setSemanticInterposition(bool)
Set whether semantic interposition is to be respected.
Definition Module.cpp:704
NamedMDNode * getNamedMetadata(StringRef Name) const
Return the first NamedMDNode in the module with the specified name.
Definition Module.cpp:296
@ Warning
Emits a warning if two values disagree.
Definition Module.h:124
llvm::Error materializeAll()
Make sure all GlobalValues in this Module are fully read and clear the Materializer.
Definition Module.cpp:474
WinX64EHUnwindV2Mode getWinX64EHUnwindV2Mode() const
Get how unwind v2 (epilog) information should be generated for x64 Windows.
Definition Module.cpp:927
void setOverrideStackAlignment(unsigned Align)
Definition Module.cpp:814
void setDirectAccessExternalData(bool Value)
Definition Module.cpp:729
unsigned getMaxTLSAlignment() const
Definition Module.cpp:807
StringRef getTargetABIFromMD()
Returns target-abi from MDString, null if target-abi is absent.
Definition Module.cpp:919
void setOwnedMemoryBuffer(std::unique_ptr< MemoryBuffer > MB)
Take ownership of the given memory buffer.
Definition Module.cpp:708
void setMaterializer(GVMaterializer *GVM)
Sets the GVMaterializer to GVM.
Definition Module.cpp:460
llvm::Error materialize(GlobalValue *GV)
Make sure the GlobalValue is fully read.
Definition Module.cpp:467
Function * getFunction(StringRef Name) const
Look up the specified function in the module symbol table.
Definition Module.cpp:230
void setCodeModel(CodeModel::Model CL)
Set the code model (tiny, small, kernel, medium or large)
Definition Module.cpp:657
StringRef getStackProtectorGuardSymbol() const
Get/set a symbol to use as the stack protector guard.
Definition Module.cpp:777
bool getSemanticInterposition() const
Returns whether semantic interposition is to be respected.
Definition Module.cpp:694
void getMDKindNames(SmallVectorImpl< StringRef > &Result) const
Populate client supplied SmallVector with the name for custom metadata IDs registered in this LLVMCon...
Definition Module.cpp:189
Module(StringRef ModuleID, LLVMContext &C)
The Module constructor.
Definition Module.cpp:73
void removeDebugIntrinsicDeclarations()
Used when printing this module in the new debug info format; removes all declarations of debug intrin...
Definition Module.cpp:122
void setRtLibUseGOT()
Set that PLT should be avoid for RTLib calls.
Definition Module.cpp:717
llvm::Error materializeMetadata()
Definition Module.cpp:481
NamedMDNode * getOrInsertModuleFlagsMetadata()
Returns the NamedMDNode in the module that represents module-level flags.
Definition Module.cpp:367
void eraseNamedMetadata(NamedMDNode *NMD)
Remove the given NamedMDNode from this module and delete it.
Definition Module.cpp:317
unsigned getNumNamedValues() const
Return the number of global values in the module.
Definition Module.cpp:176
unsigned getMDKindID(StringRef Name) const
Return a unique non-zero ID for the specified metadata kind.
Definition Module.cpp:182
void setFramePointer(FramePointerKind Kind)
Definition Module.cpp:749
std::optional< uint64_t > getLargeDataThreshold() const
Returns the large data threshold.
Definition Module.cpp:665
StringRef getStackProtectorGuard() const
Get/set what kind of stack protector guard to use.
Definition Module.cpp:753
bool getRtLibUseGOT() const
Returns true if PLT should be avoided for RTLib calls.
Definition Module.cpp:712
void setModuleFlag(ModFlagBehavior Behavior, StringRef Key, Metadata *Val)
Like addModuleFlag but replaces the old module flag if it already exists.
Definition Module.cpp:402
UWTableKind getUwtable() const
Get/set whether synthesized functions should get the uwtable attribute.
Definition Module.cpp:733
void dropAllReferences()
This function causes all the subinstructions to "let go" of all references that they are maintaining.
Definition Module.cpp:563
void setStackProtectorGuard(StringRef Kind)
Definition Module.cpp:760
void setProfileSummary(Metadata *M, ProfileSummary::Kind Kind)
Attach profile summary metadata to this module.
Definition Module.cpp:682
void setUwtable(UWTableKind Kind)
Definition Module.cpp:739
unsigned getCodeViewFlag() const
Returns the CodeView Version by checking module flags.
Definition Module.cpp:597
void setPartialSampleProfileRatio(const ModuleSummaryIndex &Index)
Set the partial sample profile ratio in the profile summary module flag, if applicable.
Definition Module.cpp:880
Module & operator=(Module &&Other)
Move assignment.
Definition Module.cpp:79
std::string getUniqueIntrinsicName(StringRef BaseName, Intrinsic::ID Id, const FunctionType *Proto)
Return a unique name for an intrinsic whose mangling is based on an unnamed type.
Definition Module.cpp:506
~Module()
The module destructor. This will dropAllReferences.
Definition Module.cpp:113
FramePointerKind getFramePointer() const
Get/set whether synthesized functions should get the "frame-pointer" attribute.
Definition Module.cpp:743
unsigned getOverrideStackAlignment() const
Get/set the stack alignment overridden from the default.
Definition Module.cpp:800
void addModuleFlag(ModFlagBehavior Behavior, StringRef Key, Metadata *Val)
Add a module-level flag to the module-level flags metadata.
Definition Module.cpp:376
void setStackProtectorGuardReg(StringRef Reg)
Definition Module.cpp:772
PICLevel::Level getPICLevel() const
Returns the PIC level (small or large model)
Definition Module.cpp:617
std::unique_ptr< RandomNumberGenerator > createRNG(const StringRef Name) const
Get a RandomNumberGenerator salted for use with this module.
Definition Module.cpp:150
std::vector< StructType * > getIdentifiedStructTypes() const
Definition Module.cpp:492
void setDarwinTargetVariantTriple(StringRef T)
Set the target variant triple which is a string describing a variant of the target host platform.
Definition Module.cpp:906
void setPICLevel(PICLevel::Level PL)
Set the PIC level (small or large model)
Definition Module.cpp:627
unsigned getNumberRegisterParameters() const
Returns the Number of Register ParametersDwarf Version by checking module flags.
Definition Module.cpp:577
GlobalIFunc * getNamedIFunc(StringRef Name) const
Return the global ifunc in the module with the specified name, of arbitrary type.
Definition Module.cpp:289
StringRef getStackProtectorGuardReg() const
Get/set which register to use as the stack protector guard register.
Definition Module.cpp:765
unsigned getDwarfVersion() const
Returns the Dwarf Version by checking module flags.
Definition Module.cpp:585
void setDataLayout(StringRef Desc)
Set the data layout.
Definition Module.cpp:424
GlobalVariable * getGlobalVariable(StringRef Name) const
Look up the specified global variable in the module symbol table.
Definition Module.h:430
void setLargeDataThreshold(uint64_t Threshold)
Set the large data threshold.
Definition Module.cpp:675
bool isDwarf64() const
Returns the DWARF format by checking module flags.
Definition Module.cpp:592
static bool isValidModFlagBehavior(Metadata *MD, ModFlagBehavior &MFB)
Checks if Metadata represents a valid ModFlagBehavior, and stores the converted result in MFB.
Definition Module.cpp:324
void setStackProtectorGuardOffset(int Offset)
Definition Module.cpp:796
iterator_range< global_object_iterator > global_objects()
Definition Module.cpp:441
GlobalValue * getNamedValue(StringRef Name) const
Return the global value in the module with the specified name, of arbitrary type.
Definition Module.cpp:172
unsigned getInstructionCount() const
Returns the number of non-debug IR instructions in the module.
Definition Module.cpp:604
NamedMDNode * getOrInsertNamedMetadata(StringRef Name)
Return the named MDNode in the module with the specified name.
Definition Module.cpp:303
void getOperandBundleTags(SmallVectorImpl< StringRef > &Result) const
Populate client supplied SmallVector with the bundle tags registered in this LLVMContext.
Definition Module.cpp:193
Comdat * getOrInsertComdat(StringRef Name)
Return the Comdat in the module with the specified name.
Definition Module.cpp:611
FunctionCallee getOrInsertFunction(StringRef Name, FunctionType *T, AttributeList AttributeList)
Look up the specified function in the module symbol table.
Definition Module.cpp:206
std::optional< CodeModel::Model > getCodeModel() const
Returns the code model (tiny, small, kernel, medium or large model)
Definition Module.cpp:647
VersionTuple getDarwinTargetVariantSDKVersion() const
Get the target variant version build SDK version metadata.
Definition Module.cpp:911
void setPIELevel(PIELevel::Level PL)
Set the PIE level (small or large model)
Definition Module.cpp:643
GlobalVariable * getOrInsertGlobal(StringRef Name, Type *Ty, function_ref< GlobalVariable *()> CreateGlobalCallback)
Look up the specified global in the module symbol table.
Definition Module.cpp:257
VersionTuple getSDKVersion() const
Get the build SDK version metadata.
Definition Module.cpp:861
GlobalAlias * getNamedAlias(StringRef Name) const
Return the global alias in the module with the specified name, of arbitrary type.
Definition Module.cpp:285
void setDarwinTargetVariantSDKVersion(VersionTuple Version)
Set the target variant version build SDK version metadata.
Definition Module.cpp:915
PIELevel::Level getPIELevel() const
Returns the PIE level (small or large model)
Definition Module.cpp:633
StringRef getDarwinTargetVariantTriple() const
Get the target variant triple which is a string describing a variant of the target host platform.
Definition Module.cpp:900
void setSDKVersion(const VersionTuple &V)
Attach a build SDK version metadata to this module.
Definition Module.cpp:832
iterator_range< global_value_iterator > global_values()
Definition Module.cpp:449
int getStackProtectorGuardOffset() const
Get/set what offset from the stack protector to use.
Definition Module.cpp:789
bool getDirectAccessExternalData() const
Get/set whether referencing global variables can use direct access relocations on ELF targets.
Definition Module.cpp:721
Metadata * getProfileSummary(bool IsCS) const
Returns profile summary metadata.
Definition Module.cpp:689
Metadata * getModuleFlag(StringRef Key) const
Return the corresponding value if Key appears in module flags, otherwise return null.
Definition Module.cpp:353
A tuple of MDNodes.
Definition Metadata.h:1753
LLVM_ABI StringRef getName() const
iterator_range< op_iterator > operands()
Definition Metadata.h:1849
void setPartialProfileRatio(double R)
LLVM_ABI Metadata * getMD(LLVMContext &Context, bool AddPartialField=true, bool AddPartialProfileRatioField=true)
Return summary information as metadata.
uint32_t getNumCounts() const
bool isPartialProfile() const
static LLVM_ABI ProfileSummary * getFromMD(Metadata *MD)
Construct profile summary from metdata.
A random number generator.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition SmallString.h:26
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
The TimeTraceScope is a helper class to call the begin and end functions of the time trace profiler.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
TypeFinder - Walk over a module, identifying all of the types that are used by the module.
Definition TypeFinder.h:31
iterator end()
Definition TypeFinder.h:52
void run(const Module &M, bool onlyNamed)
iterator begin()
Definition TypeFinder.h:51
static LLVM_ABI IntegerType * getInt64Ty(LLVMContext &C)
Definition Type.cpp:298
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
Definition Type.cpp:297
void dropAllReferences()
Drop all references to operands.
Definition User.h:349
This class provides a symbol table of name/value pairs.
Represents a version number in the form major[.minor[.subminor[.build]]].
An efficient, type-erasing, non-owning reference to a callable.
A range adaptor for a pair of iterators.
This file contains the declaration of the Comdat class, which represents a single COMDAT in LLVM.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
LLVM_ABI Function * getDeclarationIfExists(const Module *M, ID id)
Look up the Function declaration of the intrinsic id in the Module M and return it if it exists.
Flag
These should be considered private to the implementation of the MCInstrDesc class.
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > dyn_extract_or_null(Y &&MD)
Extract a Value from Metadata, if any, allowing null.
Definition Metadata.h:707
std::enable_if_t< detail::IsValidPointer< X, Y >::value, bool > hasa(Y &&MD)
Check whether Metadata has a Value.
Definition Metadata.h:649
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract(Y &&MD)
Extract a Value from Metadata.
Definition Metadata.h:666
Context & getContext() const
Definition BasicBlock.h:99
LLVM_ABI StringRef filename(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get filename.
Definition Path.cpp:577
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:477
FramePointerKind
Definition CodeGen.h:118
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:649
FunctionAddr VTableAddr uintptr_t uintptr_t Int32Ty
Definition InstrProf.h:296
auto cast_or_null(const Y &Val)
Definition Casting.h:720
Op::Description Desc
detail::concat_range< ValueT, RangeTs... > concat(RangeTs &&...Ranges)
Returns a concatenated range across two or more ranges.
Definition STLExtras.h:1180
auto dyn_cast_or_null(const Y &Val)
Definition Casting.h:759
UWTableKind
Definition CodeGen.h:148
@ None
No unwind table requested.
Definition CodeGen.h:149
FunctionAddr VTableAddr Count
Definition InstrProf.h:139
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:548
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
@ Other
Any other memory.
Definition ModRef.h:68
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:565
WinX64EHUnwindV2Mode
Definition CodeGen.h:161
LLVM_ABI GlobalVariable * collectUsedGlobalVariables(const Module &M, SmallVectorImpl< GlobalValue * > &Vec, bool CompilerUsed)
Given "llvm.used" or "llvm.compiler.used" as a global name, collect the initializer elements of that ...
Definition Module.cpp:865
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:851
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39