25 std::string TripleName;
38 "no register info for target %s",
41 MCOptions.AsmVerbose =
true;
46 "no asm info for target %s", TripleName.c_str());
51 "no subtarget info for target %s",
54 MC.reset(
new MCContext(TheTriple, *MAI, *MRI, *MSTI,
nullptr,
true,
55 Swift5ReflectionSegmentName));
57 MC->setObjectFileInfo(MOFI.get());
62 "no asm backend for target %s",
68 "no instr info info for target %s",
74 "no code emitter for target %s",
77 switch (OutFileType) {
80 TheTriple, MAI->getAssemblerDialect(), *MAI, *MII, *MRI));
82 *MC, std::make_unique<formatted_raw_ostream>(OutFile), std::move(MIP),
83 std::unique_ptr<MCCodeEmitter>(MCE),
84 std::unique_ptr<MCAsmBackend>(MAB));
89 TheTriple, *MC, std::unique_ptr<MCAsmBackend>(MAB),
90 MAB->createObjectWriter(OutFile), std::unique_ptr<MCCodeEmitter>(MCE),
98 "no object streamer for target %s",
106 "no target machine for target %s",
109 Asm.reset(TheTarget->
createAsmPrinter(*TM, std::unique_ptr<MCStreamer>(MS)));
112 "no asm printer for target %s",
114 Asm->setDwarfUsesRelocationsAcrossSections(
false);
116 DebugInfoSectionSize = 0;
122 const SmallVector<std::unique_ptr<DIEAbbrev>> &Abbrevs,
123 unsigned DwarfVersion) {
124 MS->switchSection(MOFI->getDwarfAbbrevSection());
125 MC->setDwarfVersion(DwarfVersion);
126 Asm->emitDwarfAbbrevs(Abbrevs);
130 MS->switchSection(MOFI->getDwarfInfoSection());
131 MC->setDwarfVersion(Unit.getVersion());
136 Asm->emitInt32(Unit.getUnitSize() - 4);
137 Asm->emitInt16(Unit.getVersion());
139 if (Unit.getVersion() >= 5) {
141 Asm->emitInt8(RootTag == dwarf::DW_TAG_partial_unit ? dwarf::DW_UT_partial
142 : dwarf::DW_UT_compile);
143 Asm->emitInt8(Unit.getFormParams().AddrSize);
146 DebugInfoSectionSize += 12;
150 Asm->emitInt8(Unit.getFormParams().AddrSize);
151 DebugInfoSectionSize += 11;
156 MS->switchSection(MOFI->getDwarfInfoSection());
157 Asm->emitDwarfDIE(Die);
158 DebugInfoSectionSize += Die.
getSize();
164 if (CUOffsets.empty())
167 Asm->OutStreamer->switchSection(MOFI->getDwarfDebugNamesSection());
173 Asm.get(),
Table, CUOffsets,
175 -> std::optional<DWARF5AccelTable::UnitIndexAndEncoding> {
176 if (CUidToIdx.size() > 1)
177 return {{CUidToIdx[Entry.getUnitID()],
178 {dwarf::DW_IDX_compile_unit, Form}}};
185 Asm->OutStreamer->switchSection(MOFI->getDwarfAccelNamespaceSection());
186 auto *SectionBegin = Asm->createTempSymbol(
"namespac_begin");
187 Asm->OutStreamer->emitLabel(SectionBegin);
193 Asm->OutStreamer->switchSection(MOFI->getDwarfAccelNamesSection());
194 auto *SectionBegin = Asm->createTempSymbol(
"names_begin");
195 Asm->OutStreamer->emitLabel(SectionBegin);
201 Asm->OutStreamer->switchSection(MOFI->getDwarfAccelObjCSection());
202 auto *SectionBegin = Asm->createTempSymbol(
"objc_begin");
203 Asm->OutStreamer->emitLabel(SectionBegin);
209 Asm->OutStreamer->switchSection(MOFI->getDwarfAccelTypesSection());
210 auto *SectionBegin = Asm->createTempSymbol(
"types_begin");
211 Asm->OutStreamer->emitLabel(SectionBegin);
This class holds an abstract representation of an Accelerator Table, consisting of a sequence of buck...
static dwarf::Form BestForm(bool IsSigned, uint64_t Int)
Choose the best form for integer.
A structured debug information entry.
The Data class implementation for DWARF v5 accelerator table.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Context object for machine code objects.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Target - Wrapper for Target specific information.
TargetMachine * createTargetMachine(const Triple &TT, StringRef CPU, StringRef Features, const TargetOptions &Options, std::optional< Reloc::Model > RM, std::optional< CodeModel::Model > CM=std::nullopt, CodeGenOptLevel OL=CodeGenOptLevel::Default, bool JIT=false) const
createTargetMachine - Create a target specific machine implementation for the specified Triple.
MCRegisterInfo * createMCRegInfo(const Triple &TT) const
Create a MCRegisterInfo implementation.
MCCodeEmitter * createMCCodeEmitter(const MCInstrInfo &II, MCContext &Ctx) const
createMCCodeEmitter - Create a target specific code emitter.
MCObjectFileInfo * createMCObjectFileInfo(MCContext &Ctx, bool PIC, bool LargeCodeModel=false) const
Create a MCObjectFileInfo implementation for the specified target triple.
MCAsmInfo * createMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TheTriple, const MCTargetOptions &Options) const
Create a MCAsmInfo implementation for the specified target triple.
MCAsmBackend * createMCAsmBackend(const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options) const
createMCAsmBackend - Create a target specific assembly parser.
LLVM_ABI MCStreamer * createAsmStreamer(MCContext &Ctx, std::unique_ptr< formatted_raw_ostream > OS, std::unique_ptr< MCInstPrinter > IP, std::unique_ptr< MCCodeEmitter > CE, std::unique_ptr< MCAsmBackend > TAB) const
LLVM_ABI MCStreamer * createMCObjectStreamer(const Triple &T, MCContext &Ctx, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter, const MCSubtargetInfo &STI) const
Create a target specific MCStreamer.
MCInstPrinter * createMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI) const
MCSubtargetInfo * createMCSubtargetInfo(const Triple &TheTriple, StringRef CPU, StringRef Features) const
createMCSubtargetInfo - Create a MCSubtargetInfo implementation.
AsmPrinter * createAsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > &&Streamer) const
createAsmPrinter - Create a target specific assembly printer pass.
MCInstrInfo * createMCInstrInfo() const
createMCInstrInfo - Create a MCInstrInfo implementation.
Triple - Helper class for working with autoconf configuration names.
const std::string & getTriple() const
void emitCompileUnitHeader(DwarfUnit &Unit)
Emit compile unit header.
Error init(Triple TheTriple, StringRef Swift5ReflectionSegmentName)
Initialize AsmPrinter data.
void emitAppleNames(AccelTable< AppleAccelTableStaticOffsetData > &Table)
Emits .apple_names section according to the specified Table.
void emitAbbrevs(const SmallVector< std::unique_ptr< DIEAbbrev > > &Abbrevs, unsigned DwarfVersion)
Emit abbreviations.
void emitAppleTypes(AccelTable< AppleAccelTableStaticTypeData > &Table)
Emits .apple_types section according to the specified Table.
void emitDIE(DIE &Die)
Emit DIE recursively.
void emitAppleNamespaces(AccelTable< AppleAccelTableStaticOffsetData > &Table)
Emits .apple_namespaces section according to the specified Table.
void emitDebugNames(DWARF5AccelTable &Table, DebugNamesUnitsOffsets &CUOffsets, CompUnitIDToIdx &UnitIDToIdxMap)
Emits .debug_names section according to the specified Table.
void emitAppleObjc(AccelTable< AppleAccelTableStaticOffsetData > &Table)
Emits .apple_objc section according to the specified Table.
Base class for all Dwarf units(Compile unit/Type table unit).
std::vector< std::variant< MCSymbol *, uint64_t > > DebugNamesUnitsOffsets
DenseMap< unsigned, unsigned > CompUnitIDToIdx
This is an optimization pass for GlobalISel generic memory operations.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
void emitAppleAccelTable(AsmPrinter *Asm, AccelTable< DataT > &Contents, StringRef Prefix, const MCSymbol *SecBegin)
Emit an Apple Accelerator Table consisting of entries in the specified AccelTable.
LLVM_ABI void emitDWARF5AccelTable(AsmPrinter *Asm, DWARF5AccelTable &Contents, const DwarfDebug &DD, ArrayRef< std::unique_ptr< DwarfCompileUnit > > CUs)
static LLVM_ABI const Target * lookupTarget(const Triple &TheTriple, std::string &Error)
lookupTarget - Lookup a target based on a target triple.