51using namespace object;
60 SymTab.push_back(&GV);
63 SymTab.push_back(
new (AsmSymbols.
Allocate())
76 const Triple TT(M.getTargetTriple());
80 std::unique_ptr<MCRegisterInfo>
MRI(
T->createMCRegInfo(TT.str()));
85 std::unique_ptr<MCAsmInfo> MAI(
T->createMCAsmInfo(*
MRI, TT.str(), MCOptions));
89 std::unique_ptr<MCSubtargetInfo> STI(
90 T->createMCSubtargetInfo(TT.str(),
"",
""));
94 std::unique_ptr<MCInstrInfo> MCII(
T->createMCInstrInfo());
103 std::unique_ptr<MCObjectFileInfo> MOFI(
104 T->createMCObjectFileInfo(MCCtx,
false));
105 MOFI->setSDKVersion(M.getSDKVersion());
108 T->createNullTargetStreamer(Streamer);
110 std::unique_ptr<MCAsmParser>
Parser(
113 std::unique_ptr<MCTargetAsmParser> TAP(
114 T->createMCAsmParser(*STI, *
Parser, *MCII, MCOptions));
122 Parser->setTargetParser(*TAP);
135 for (
auto &KV : Streamer) {
170 for (
auto &Alias : KV.second)
171 AsmSymver(KV.first->getName(), Alias);
176 if (isa<AsmSymbol *>(S)) {
177 OS << cast<AsmSymbol *>(S)->first;
181 auto *GV = cast<GlobalValue *>(S);
182 if (GV->hasDLLImportStorageClass())
189 if (isa<AsmSymbol *>(S))
190 return cast<AsmSymbol *>(S)->second;
192 auto *GV = cast<GlobalValue *>(S);
195 if (GV->isDeclarationForLinker())
197 else if (GV->hasHiddenVisibility() && !GV->hasLocalLinkage())
200 if (GVar->isConstant())
204 if (isa<Function>(GO) || isa<GlobalIFunc>(GO))
206 if (isa<GlobalAlias>(GV))
208 if (GV->hasPrivateLinkage())
210 if (!GV->hasLocalLinkage())
212 if (GV->hasCommonLinkage())
214 if (GV->hasLinkOnceLinkage() || GV->hasWeakLinkage() ||
215 GV->hasExternalWeakLinkage())
218 if (GV->getName().startswith(
"llvm."))
220 else if (
auto *Var = dyn_cast<GlobalVariable>(GV)) {
221 if (Var->getSection() ==
"llvm.metadata")
unsigned const MachineRegisterInfo * MRI
for(const MachineOperand &MO :llvm::drop_begin(OldMI.operands(), Desc.getNumOperands()))
static void initializeRecordStreamer(const Module &M, function_ref< void(RecordStreamer &)> Init)
Module.h This file contains the declarations for the Module class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const GlobalObject * getAliaseeObject() const
Context object for machine code objects.
void setObjectFileInfo(const MCObjectFileInfo *Mofi)
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, bool CannotUsePrivateLabel) const
Print the appropriate prefix and the specified global variable's name.
static std::unique_ptr< MemoryBuffer > getMemBuffer(StringRef InputData, StringRef BufferName="", bool RequiresNullTerminator=true)
Open the specified memory range as a MemoryBuffer.
void addModule(Module *M)
static 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
void printSymbolName(raw_ostream &OS, Symbol S) const
uint32_t getSymbolFlags(Symbol S) const
static 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.
const std::string & getTargetTriple() const
Get the target triple which is a string describing the target host.
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
iterator_range< const_symver_iterator > symverAliases()
void flushSymverDirectives()
Represents a location in source code.
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
unsigned AddNewSourceBuffer(std::unique_ptr< MemoryBuffer > F, SMLoc IncludeLoc)
Add a new source buffer to this source manager.
T * Allocate(size_t num=1)
Allocate space for an array of objects without constructing them.
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.
MCAsmParser * createMCAsmParser(SourceMgr &, MCContext &, MCStreamer &, const MCAsmInfo &, unsigned CB=0)
Create an MCAsmParser instance for parsing assembly similar to gas syntax.
static const Target * lookupTarget(StringRef Triple, std::string &Error)
lookupTarget - Lookup a target based on a target triple.