54 assert(FirstMod->getTargetTriple() == M->getTargetTriple());
59 SymTab.push_back(&GV);
62 SymTab.push_back(
new (AsmSymbols.Allocate())
73 if (M.getContext().getDiagHandlerPtr()->HasErrors)
75 if (!M.hasModuleInlineAsm())
79 const Triple TT(M.getTargetTriple());
83 std::unique_ptr<MCRegisterInfo> MRI(
T->createMCRegInfo(TT));
88 std::unique_ptr<MCAsmInfo> MAI(
T->createMCAsmInfo(*MRI, TT, MCOptions));
92 std::unique_ptr<MCInstrInfo> MCII(
T->createMCInstrInfo());
97 std::unique_ptr<MCSubtargetInfo> STI(
T->createMCSubtargetInfo(
98 TT, Frag.Props.TargetCPU, Frag.Props.TargetFeatures));
102 std::unique_ptr<MemoryBuffer> Buffer(
105 SrcMgr.AddNewSourceBuffer(std::move(Buffer),
SMLoc());
108 std::unique_ptr<MCObjectFileInfo> MOFI(
109 T->createMCObjectFileInfo(MCCtx,
false));
112 T->createNullTargetStreamer(Streamer);
114 std::unique_ptr<MCAsmParser>
Parser(
117 std::unique_ptr<MCTargetAsmParser> TAP(
118 T->createMCAsmParser(*STI, *
Parser, *MCII));
124 std::vector<const MDNode *> &LocInfos) {
125 M.getContext().diagnose(
133 Parser->setSymbolScanningMode(
true);
135 Parser->setTargetParser(*TAP);
149 for (
auto &KV : Streamer) {
182 Triple TT(M.getTargetTriple());
183 if (!TT.isOSBinFormatELF() || !TT.isX86())
185 auto CM = M.getCodeModel();
198 for (
auto &Alias : KV.second)
199 AsmSymver(KV.first->getName(), Alias);
205 OS << cast<AsmSymbol *>(S)->first;
210 if (GV->hasDLLImportStorageClass())
213 Mang.getNameWithPrefix(OS, GV,
false);
223 if (GV->isDeclarationForLinker())
225 else if (GV->hasHiddenVisibility() && !GV->hasLocalLinkage())
228 if (GVar->isConstant())
236 if (GV->hasPrivateLinkage())
238 if (!GV->hasLocalLinkage())
240 if (GV->hasCommonLinkage())
242 if (GV->hasLinkOnceLinkage() || GV->hasWeakLinkage() ||
243 GV->hasExternalWeakLinkage())
246 if (GV->getName().starts_with(
"llvm."))
249 if (Var->getSection() ==
"llvm.metadata")
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Module.h This file contains the declarations for the Module class.
static void initializeRecordStreamer(const Module &M, function_ref< void(RecordStreamer &)> Init)
Diagnostic information for SMDiagnostic reporting.
LLVM_ABI const GlobalObject * getAliaseeObject() const
Context object for machine code objects.
void setObjectFileInfo(const MCObjectFileInfo *Mofi)
void setDiagnosticHandler(DiagHandlerTy DiagHandler)
static std::unique_ptr< MemoryBuffer > getMemBuffer(StringRef InputData, StringRef BufferName="", bool RequiresNullTerminator=true)
Open the specified memory range as a MemoryBuffer.
LLVM_ABI void addModule(Module *M)
static LLVM_ABI void CollectAsmSymvers(const Module &M, function_ref< void(StringRef, StringRef)> AsmSymver)
Parse inline ASM and collect the symvers directives that are defined in the current module.
std::pair< std::string, uint32_t > AsmSymbol
LLVM_ABI void printSymbolName(raw_ostream &OS, Symbol S) const
PointerUnion< GlobalValue *, AsmSymbol * > Symbol
LLVM_ABI uint32_t getSymbolFlags(Symbol S) const
static LLVM_ABI void CollectAsmSymbols(const Module &M, function_ref< void(StringRef, object::BasicSymbolRef::Flags)> AsmSymbol)
Parse inline ASM and collect the symbols that are defined or referenced in the current module.
A Module instance is used to store all the information related to an LLVM module.
iterator_range< const_symver_iterator > symverAliases()
void flushSymverDirectives()
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Represents a location in source code.
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
Represent a constant reference to a string, i.e.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
LLVM Value Representation.
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI SourceMgr SrcMgr
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...
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
LLVM_ABI MCAsmParser * createMCAsmParser(SourceMgr &, MCContext &, MCStreamer &, const MCAsmInfo &, unsigned CB=0)
Create an MCAsmParser instance for parsing assembly similar to gas syntax.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
static LLVM_ABI const Target * lookupTarget(const Triple &TheTriple, std::string &Error)
lookupTarget - Lookup a target based on a target triple.