54 assert(FirstMod->getTargetTriple() == M->getTargetTriple());
59 SymTab.push_back(&GV);
62 SymTab.push_back(
new (AsmSymbols.Allocate())
73 if (M.getContext().getDiagHandlerPtr()->HasErrors)
80 const Triple TT(M.getTargetTriple());
84 std::unique_ptr<MCRegisterInfo>
MRI(
T->createMCRegInfo(TT));
89 std::unique_ptr<MCAsmInfo> MAI(
T->createMCAsmInfo(*
MRI, TT, MCOptions));
93 std::unique_ptr<MCSubtargetInfo> STI(
T->createMCSubtargetInfo(TT,
"",
""));
97 std::unique_ptr<MCInstrInfo> MCII(
T->createMCInstrInfo());
101 std::unique_ptr<MemoryBuffer> Buffer(
104 SrcMgr.AddNewSourceBuffer(std::move(Buffer),
SMLoc());
107 std::unique_ptr<MCObjectFileInfo> MOFI(
108 T->createMCObjectFileInfo(MCCtx,
false));
111 T->createNullTargetStreamer(Streamer);
113 std::unique_ptr<MCAsmParser>
Parser(
116 std::unique_ptr<MCTargetAsmParser> TAP(
117 T->createMCAsmParser(*STI, *
Parser, *MCII, MCOptions));
123 std::vector<const MDNode *> &LocInfos) {
124 M.getContext().diagnose(
132 Parser->setTargetParser(*TAP);
145 for (
auto &KV : Streamer) {
178 Triple TT(M.getTargetTriple());
179 if (!TT.isOSBinFormatELF() || !TT.isX86())
181 auto CM = M.getCodeModel();
194 for (
auto &Alias : KV.second)
195 AsmSymver(KV.first->getName(), Alias);
201 OS << cast<AsmSymbol *>(S)->first;
206 if (GV->hasDLLImportStorageClass())
209 Mang.getNameWithPrefix(OS, GV,
false);
219 if (GV->isDeclarationForLinker())
221 else if (GV->hasHiddenVisibility() && !GV->hasLocalLinkage())
224 if (GVar->isConstant())
232 if (GV->hasPrivateLinkage())
234 if (!GV->hasLocalLinkage())
236 if (GV->hasCommonLinkage())
238 if (GV->hasLinkOnceLinkage() || GV->hasWeakLinkage() ||
239 GV->hasExternalWeakLinkage())
242 if (GV->getName().starts_with(
"llvm."))
245 if (Var->getSection() ==
"llvm.metadata")
unsigned const MachineRegisterInfo * MRI
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.
StringRef - 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.
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 const Target * lookupTarget(StringRef TripleStr, std::string &Error)
lookupTarget - Lookup a target based on a target triple.