LLVM 24.0.0git
SPIRVNonSemanticDebugHandler.h
Go to the documentation of this file.
1//===-- SPIRVNonSemanticDebugHandler.h - NSDI AsmPrinter handler -*- C++
2//-*-===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9//
10// This file declares SPIRVNonSemanticDebugHandler, a DebugHandlerBase subclass
11// that emits NonSemantic.Shader.DebugInfo.100 instructions in the SPIR-V
12// AsmPrinter. It replaces SPIRVEmitNonSemanticDI, which was a
13// MachineFunctionPass, with a handler that controls instruction placement
14// directly instead of routing through SPIRVModuleAnalysis.
15//
16//===----------------------------------------------------------------------===//
17
18#ifndef LLVM_LIB_TARGET_SPIRV_SPIRVNONSEMANTICDEBUGHANDLER_H
19#define LLVM_LIB_TARGET_SPIRV_SPIRVNONSEMANTICDEBUGHANDLER_H
20
22#include "SPIRVModuleAnalysis.h"
23#include "llvm/ADT/DenseMap.h"
26#include "llvm/ADT/StringMap.h"
29#include "llvm/MC/MCInst.h"
30#include "llvm/MC/MCRegister.h"
31#include <optional>
32
33namespace llvm {
34
35class GlobalVariable;
36class SPIRVSubtarget;
37
38/// AsmPrinter handler that emits NonSemantic.Shader.DebugInfo.100 (NSDI)
39/// instructions for the SPIR-V backend. Registered with SPIRVAsmPrinter when
40/// the module contains debug info (llvm.dbg.cu).
41///
42/// Call sequence:
43/// - beginModule() collects compile-unit metadata.
44/// - prepareModuleOutput() adds the extension and ext-inst set to MAI.
45/// - emitNonSemanticDebugStrings() emits NSDI OpStrings in section 7.
46/// - emitNonSemanticGlobalDebugInfo() emits module-scope NSDI and sets
47/// GlobalNSDIEnabled.
48/// - beginFunctionImpl() prepares per-function DebugFunctionDefinition state.
49/// - endInstruction() emits DebugFunctionDefinition after the last function-
50/// level OpVariable; SPIRVAsmPrinter calls notifyEntryLabelEmitted() after
51/// the synthesized entry OpLabel when there are no OpVariables.
52/// - endFunctionImpl() resets per-function state.
54 static constexpr unsigned NSSet = static_cast<unsigned>(
55 SPIRV::InstructionSet::NonSemantic_Shader_DebugInfo_100);
56
57 struct CompileUnitInfo {
58 const DICompileUnit *TheCU = nullptr;
59 SmallString<128> FilePath;
60 unsigned SpirvSourceLanguage = 0; // NonSemantic.Shader.DebugInfo.100 source
61 // language code (section 4.3)
62 };
64 int64_t DwarfVersion = 0;
65
66 // DI types partitioned from DebugInfoFinder.types() in beginModule()
67 // (basics, pointers, vectors, subroutine types NSDI v1 may emit).
71 // DICompositeType nodes with DW_TAG_array_type and DINode::FlagVector,
72 // partitioned from DebugInfoFinder.types() in beginModule().
74 // DICompositeType nodes with DW_TAG_array_type that are not vectors,
75 // partitioned in beginModule().
77 // DICompositeType nodes with DW_TAG_structure_type, DW_TAG_class_type, or
78 // DW_TAG_union_type, partitioned in beginModule() for DebugTypeComposite.
80 // DIDerivedType nodes with DW_TAG_typedef, partitioned in beginModule() for
81 // DebugTypedef emission.
83
84 // Filled in emitNonSemanticGlobalDebugInfo(): DI types to their result
85 // registers.
87
88 // DISubprogram nodes that are declarations only (!isDefinition()), collected
89 // in beginModule() for DebugFunctionDeclaration emission.
90 SmallVector<const DISubprogram *> SubprogramDeclarations;
91
92 // DISubprogram nodes that are definitions, collected in beginModule() for
93 // DebugFunction emission.
94 SmallVector<const DISubprogram *> SubprogramDefinitions;
95
96 struct GlobalVariableDebugInfo {
97 const DIExpression *Expr = nullptr;
98 const GlobalVariable *LLVMGV = nullptr;
99 };
101 GlobalVariableDebugInfoMap;
102
103 // DebugFunctionDeclaration result id per emitted declaration DISubprogram
104 // (only entries where emission succeeded).
105 DenseMap<const DISubprogram *, MCRegister> DebugFunctionDeclarationRegs;
106
107 // DebugFunction result id per emitted definition DISubprogram (only entries
108 // where emission succeeded).
110
111 // Path \c OpString result id per \c DIScope (CU, \c DIFile, declaration
112 // \c DISubprogram, …). Filled during \c emitNonSemanticDebugStrings() using
113 // \c getDebugFullPath + \c emitOpStringIfNew; section 10 uses it for
114 // \c DebugSource without recomputing path text.
115 DenseMap<const DIScope *, MCRegister> ScopeToPathOpStringReg;
116
117 // DebugCompilationUnit result id per DICompileUnit (for Parent operands).
118 DenseMap<const DICompileUnit *, MCRegister> CUToCompilationUnitDbgReg;
119
120 // DebugSource result id keyed by path \c OpString id (\c MCRegister::id()),
121 // deduplicating when the same file string is reused.
122 DenseMap<unsigned, MCRegister> DebugSourceRegByFileStr;
123
124 // Maps OpString contents to result id. Populated only by emitOpStringIfNew()
125 // during section 7; section 10 uses getCachedOpStringReg() (lookup only).
126 StringMap<MCRegister> OpStringContentCache;
127
128#ifndef NDEBUG // Only declare the variable for debugging purposes.
129 // True after emitNonSemanticDebugStrings() emitted the NSDI OpStrings for
130 // this module. SPIRVAsmPrinter calls that before
131 // emitNonSemanticGlobalDebugInfo().
132 bool NonSemanticOpStringsSectionEmitted = false;
133#endif
134
135 MCRegister CachedEmptyStringReg;
136
137 MCRegister CachedDebugInfoNoneReg;
138
139 MCRegister CachedOpTypeVoidReg;
140
141 MCRegister CachedOpTypeInt32Reg;
142
143 // Cache of already-emitted i32 constants, keyed by value. Prevents
144 // duplicate OpConstant instructions for the same integer value.
145 DenseMap<uint32_t, MCRegister> I32ConstantCache;
146
147 // Cache of already-emitted DebugTypeFunction instructions, keyed by operand
148 // ids (flags, return type, parameters).
149 DenseMap<SmallVector<MCRegister, 8>, MCRegister> DebugTypeFunctionCache;
150
151 // True once emitNonSemanticGlobalDebugInfo() has run. Both
152 // SPIRVAsmPrinter::emitFunctionHeader() and emitEndOfAsmFile() may call
153 // outputModuleSections(), each guarded by ModuleSectionsEmitted, so only
154 // one fires. This flag provides a secondary guard in case the call sites
155 // change.
156 bool GlobalDIEmitted = false;
157
158 // True when emitNonSemanticGlobalDebugInfo() completed module-scope NSDI
159 // emission for this module.
160 bool GlobalNSDIEnabled = false;
161
162 SPIRV::ModuleAnalysisInfo *CurrentMAI = nullptr;
163
164 const MachineFunction *CurrentMF = nullptr;
165
166 const MachineInstr *LastFunctionOpVariable = nullptr;
167
168 bool DebugFunctionDefinitionEmitted = false;
169
170public:
172
173 /// Collect compile-unit metadata from the module. Called by
174 /// AsmPrinter::doInitialization() via the handler list. No emission.
175 void beginModule(Module *M) override;
176
177 /// Emit OpString instructions for all NSDI file paths and basic type names
178 /// into the debug section (section 7 of the SPIR-V module layout). Must be
179 /// called from SPIRVAsmPrinter::outputDebugSourceAndStrings(), after
180 /// prepareModuleOutput() has registered the ext inst set. Registers are
181 /// stored in \c OpStringContentCache and \c ScopeToPathOpStringReg;
182 /// \c emitNonSemanticGlobalDebugInfo() resolves them via
183 /// \c getCachedOpStringReg() and path maps.
185
186 /// Add SPV_KHR_non_semantic_info extension and
187 /// NonSemantic.Shader.DebugInfo.100 ext inst set entry to MAI. Must be called
188 /// before outputGlobalRequirements() and outputOpExtInstImports() in
189 /// SPIRVAsmPrinter::outputModuleSections().
190 void prepareModuleOutput(const SPIRVSubtarget &ST,
192
193 /// Emit module-scope NSDI instructions (DebugSource, DebugCompilationUnit,
194 /// DebugTypeBasic, DebugTypePointer, DebugTypeFunction,
195 /// DebugFunctionDeclaration, DebugFunction). Called by
196 /// SPIRVAsmPrinter::outputModuleSections() at section 10 in place of
197 /// outputModuleSection(MB_NonSemanticGlobalDI). Requires
198 /// emitNonSemanticDebugStrings() to have run first when NSDI strings apply.
199 /// Sets \c GlobalNSDIEnabled when module-scope NSDI emission completes.
201
202 /// Called after the synthesized entry \c OpLabel has been emitted.
204
205protected:
206 // All module-level output is driven by emitNonSemanticGlobalDebugInfo(),
207 // called explicitly from SPIRVAsmPrinter::outputModuleSections(). Nothing
208 // needs to happen in the AsmPrinterHandler::endModule() callback.
209 void endModule() override {}
210
211 // DebugHandlerBase stores MMI as a pointer copy from Asm->MMI at construction
212 // time (DebugHandlerBase.cpp: `MMI(Asm->MMI)`). The handler is constructed
213 // before AsmPrinter::doInitialization() runs, so Asm->MMI is null at that
214 // point and MMI remains null for this handler's entire lifetime. Do not call
215 // the base-class beginInstruction/endInstruction — they dereference MMI to
216 // create temp symbols for label tracking and would crash.
217 // Future local NSDI that needs MCContext must use
218 // Asm->OutStreamer->getContext() rather than MMI->getContext().
219 void beginInstruction(const MachineInstr *MI) override;
220 void endInstruction() override;
221
222 // Override beginFunctionImpl(), not beginFunction():
223 // DebugHandlerBase::beginFunction() populates LScopes and DbgValues needed
224 // for future DebugLine emission.
225 void beginFunctionImpl(const MachineFunction *MF) override;
226 void endFunctionImpl(const MachineFunction *MF) override;
227
228private:
229 void emitDebugFunctionDefinition(MCRegister DebugFunctionReg,
230 MCRegister OpFunctionReg,
232
233 void resetPerFunctionDebugState();
234 void preparePerFunctionDebug(const MachineFunction *MF);
235 void tryEmitDebugFunctionDefinition(SPIRV::ModuleAnalysisInfo &MAI);
236
237 void emitMCInst(MCInst &Inst);
238 MCRegister emitOpString(StringRef S, SPIRV::ModuleAnalysisInfo &MAI);
239
240 /// Section 7 only: emit OpString and cache it if not already present. Must
241 /// not be called after NonSemanticOpStringsSectionEmitted is set. Returns
242 /// the path (or string) \c OpString result id.
243 MCRegister emitOpStringIfNew(StringRef S, SPIRV::ModuleAnalysisInfo &MAI);
244
245 /// Section 10 only: lookup OpString id from cache; asserts if missing or if
246 /// section 7 did not complete.
247 MCRegister getCachedOpStringReg(StringRef S);
248
249 /// Section 7 only: emit the path \c OpString for \p Scope and cache it under
250 /// \p Scope. Returns the \c OpString result id. A \p Scope already seen
251 /// returns the cached id without rebuilding the path. A null \p Scope maps to
252 /// the empty path and is cached like any other, though section 10 reads it
253 /// through \c getCachedScopePathOpStringReg, which handles null separately.
254 MCRegister emitAndCacheScopePathOpStringReg(const DIScope *Scope,
256
257 /// Section 10 only: lookup path \c OpString id for \p Scope from
258 /// \c ScopeToPathOpStringReg; asserts if missing or invalid. When
259 /// \p UseEmptyPathIfNullScope is true and \p Scope is null, returns
260 /// \c CachedEmptyStringReg instead.
262 getCachedScopePathOpStringReg(const DIScope *Scope,
263 bool UseEmptyPathIfNullScope = false);
264 MCRegister emitOpConstantI32(uint32_t Value, MCRegister I32TypeReg,
266 MCRegister emitExtInst(SPIRV::NonSemanticExtInst::NonSemanticExtInst Opcode,
267 MCRegister VoidTypeReg, MCRegister ExtInstSetReg,
268 ArrayRef<MCRegister> Operands,
270
271 /// Return a cached DebugTypeFunction id when \p Ops matches a prior emission,
272 /// otherwise emit and cache a new instruction.
273 MCRegister getOrEmitDebugTypeFunction(ArrayRef<MCRegister> Ops,
274 MCRegister VoidTypeReg,
275 MCRegister ExtInstSetReg,
277
278 /// Return OpTypeVoid id for this module (lazy lookup / emit, then cache).
279 MCRegister getOrEmitOpTypeVoidReg(SPIRV::ModuleAnalysisInfo &MAI);
280
281 /// Return OpTypeInt 32 0 id for this module (lazy lookup / emit, then cache).
282 MCRegister getOrEmitOpTypeInt32Reg(SPIRV::ModuleAnalysisInfo &MAI);
283
284 /// Find OpTypeVoid in the already-emitted TypeConstVars section, or emit one
285 /// if the module does not contain it (e.g. no void-returning functions).
286 MCRegister findOrEmitOpTypeVoid(SPIRV::ModuleAnalysisInfo &MAI);
287
288 /// Find OpTypeInt 32 0 in the already-emitted TypeConstVars section, or emit
289 /// one if the module does not contain it.
290 MCRegister findOrEmitOpTypeInt32(SPIRV::ModuleAnalysisInfo &MAI);
291
292 /// Emit \c DebugTypePointer for pointer metadata \p PT.
293 ///
294 /// \returns The result id register on success. Returns \c std::nullopt and
295 /// emits nothing if \p PT has no DWARF address space (needed to pick the
296 /// SPIR-V storage class), or if \p PT has a non-null base DI type that is not
297 /// yet in \c DebugTypeRegs (the pointee was not emitted as a debug type).
298 ///
299 /// Base Type operand: the register from \c DebugTypeRegs for \p PT's base
300 /// type when it is set and mapped; \c DebugInfoNone when there is no base
301 /// type (e.g. \c void * in IR), consistent with SPIRV-LLVM-Translator.
302 std::optional<MCRegister>
303 emitDebugTypePointer(const DIDerivedType *PT, MCRegister ExtInstSetReg,
305
306 /// Emit one DebugTypeFunction for ST when every DI operand maps to a debug
307 /// type id; otherwise emit nothing and return std::nullopt.
308 std::optional<MCRegister>
309 emitDebugTypeFunctionForSubroutineType(const DISubroutineType *ST,
310 MCRegister ExtInstSetReg,
312
313 /// Emit \c DebugFunctionDeclaration for a \c DISubprogram that is not a
314 /// definition (\p SP must satisfy \c !isDefinition()).
315 ///
316 /// \returns The result id register on success. Returns \c std::nullopt and
317 /// emits nothing if \p SP is null, is a definition, has no \c
318 /// DISubroutineType type, the signature type was not emitted in \c
319 /// DebugTypeRegs, no path
320 /// \c OpString was recorded for \p SP in section 7, or
321 /// \c resolveDebugFunctionParent returns no id for the \c Parent
322 /// operand.
323 std::optional<MCRegister>
324 emitDebugFunctionDeclaration(const DISubprogram *SP, MCRegister VoidTypeReg,
325 MCRegister I32TypeReg, MCRegister ExtInstSetReg,
327
328 /// Emit \c DebugFunction for a defining \c DISubprogram (\p SP must satisfy
329 /// \c isDefinition()).
330 std::optional<MCRegister> emitDebugFunction(const DISubprogram *SP,
331 MCRegister VoidTypeReg,
332 MCRegister I32TypeReg,
333 MCRegister ExtInstSetReg,
335
336 /// Emit \c DebugGlobalVariable for the source global variable \p GV.
337 ///
338 /// (\c SPIRVDebug::Operand::GlobalVariable): Name, Type, Source, Line,
339 /// Column, Parent, Linkage Name, Variable, Flags, and an optional Static
340 /// Member Declaration. Line, Column, and Flags are emitted as \c OpConstant
341 /// ids as required for non-semantic debug info.
342 ///
343 /// \c DebugInfoNone is used for two operands when LLVM has no value to
344 /// supply:
345 /// \c Type when \p GV is a declaration with no DI type (e.g. \c extern void;
346 /// valid IR, \c isDefinition: false); \c Variable when no \c
347 /// llvm::GlobalVariable in this module carries \p GV in its \c !dbg metadata.
348 ///
349 /// \returns The result id register on success. Returns \c std::nullopt and
350 /// emits nothing if a non-null \p GV type was not emitted in \c
351 /// DebugTypeRegs, or \p GV has a static data member declaration that was not
352 /// emitted in \c DebugTypeRegs.
353 std::optional<MCRegister> emitDebugGlobalVariable(
354 const DIGlobalVariable *GV, const GlobalVariableDebugInfo &Info,
355 MCRegister VoidTypeReg, MCRegister I32TypeReg, MCRegister ExtInstSetReg,
357
358 /// Resolve the \c Parent operand for \c DebugGlobalVariable.
359 MCRegister resolveGlobalVariableParent(const DIGlobalVariable *GV) const;
360
361 /// Emit \c DebugExpression for \p Expr. Unimplemented: defined as a no-op
362 /// (\returns \c std::nullopt, emits nothing) so \c emitDebugGlobalVariable
363 /// can complete Variable-operand resolution for the opcodes we support today.
364 std::optional<MCRegister> emitDebugExpression(const DIExpression *Expr,
365 MCRegister VoidTypeReg,
366 MCRegister ExtInstSetReg,
368
369 /// Emit \c DebugTypeVector for the vector composite type \p VT.
370 ///
371 /// \returns The result id register on success. Returns \c std::nullopt and
372 /// emits nothing if \p VT has no \c DIBasicType base type, if the base type
373 /// has not been emitted yet, if \p VT has more than one \c DISubrange
374 /// element, or if the component count is not a compile-time constant.
375 std::optional<MCRegister> emitDebugTypeVector(const DICompositeType *VT,
376 MCRegister ExtInstSetReg,
378
379 /// Emit \c DebugTypeArray for the array composite type \p AT.
380 ///
381 /// Emits the element (base) type id followed by one Component Count per
382 /// \c DISubrange, in DWARF subrange order. A count that is not a
383 /// compile-time constant is emitted as 0, matching \c OpTypeRuntimeArray. A
384 /// matrix arrives here as a multi-subrange array and is emitted with one
385 /// count per dimension.
386 ///
387 /// \returns The result id register on success. Returns \c std::nullopt and
388 /// emits nothing if \p AT's element type has not been emitted into
389 /// \c DebugTypeRegs.
390 std::optional<MCRegister> emitDebugTypeArray(const DICompositeType *AT,
391 MCRegister ExtInstSetReg,
393
394 /// Emit \c DebugTypeMember for the data member \p M (a \c DIDerivedType with
395 /// \c DW_TAG_member). Operands: Name, Type, Source, Line, Column, Offset,
396 /// Size, Flags. NonSemantic \c DebugTypeMember carries no Parent operand: the
397 /// enclosing \c DebugTypeComposite references its members, not the reverse.
398 ///
399 /// \returns The result id register on success. Returns \c std::nullopt and
400 /// emits nothing if \p M's type has not been emitted into \c DebugTypeRegs.
401 std::optional<MCRegister> emitDebugTypeMember(const DIDerivedType *M,
402 MCRegister VoidTypeReg,
403 MCRegister I32TypeReg,
404 MCRegister ExtInstSetReg,
406
407 /// Emit \c DebugTypeComposite for the struct, class, or union \p CT, listing
408 /// the already-emitted \p MemberRegs in its Members operand. A forward
409 /// declaration emits \c DebugInfoNone for Size and no members.
410 ///
411 /// \returns The result id register on success. Returns \c std::nullopt and
412 /// emits nothing if the Parent scope cannot be resolved.
413 std::optional<MCRegister> emitDebugTypeComposite(
414 const DICompositeType *CT, ArrayRef<MCRegister> MemberRegs,
415 MCRegister VoidTypeReg, MCRegister I32TypeReg, MCRegister ExtInstSetReg,
417
418 /// Emit \c DebugTypedef for the typedef derived type \p TD (a \c
419 /// DIDerivedType with \c DW_TAG_typedef). Operands: Name, Base Type, Source,
420 /// Line, Column, Parent. Parent is the enclosing type when \c TD->getScope()
421 /// is an emitted \c DIType, otherwise the first module \c
422 /// DebugCompilationUnit.
423 ///
424 /// \returns The result id register on success. Returns \c std::nullopt and
425 /// emits nothing if \p TD's base type has not been emitted into \c
426 /// DebugTypeRegs.
427 std::optional<MCRegister> emitDebugTypedef(const DIDerivedType *TD,
428 MCRegister VoidTypeReg,
429 MCRegister I32TypeReg,
430 MCRegister ExtInstSetReg,
432
433 /// Map a \c DISubroutineType::getTypeArray() element to an operand register
434 /// for
435 /// \c DebugTypeFunction. Non-null \p Ty resolves via \c DebugTypeRegs; if the
436 /// type was never emitted, returns \c std::nullopt.
437 ///
438 /// LLVM encodes a void return as a null first element (and may use null in
439 /// later slots). NonSemantic \c DebugTypeFunction
440 /// requires a concrete return-type operand, so when \p ReturnType is true and
441 /// \p Ty is null, this returns \p VoidTypeReg (\c OpTypeVoid). When
442 /// \p ReturnType is false and \p Ty is null, this returns
443 /// \c CachedDebugInfoNoneReg (\c DebugInfoNone).
444 std::optional<MCRegister> mapDISignatureTypeToReg(const DIType *Ty,
445 MCRegister VoidTypeReg,
446 bool ReturnType);
447
448 /// Map a DWARF source language code to a NonSemantic.Shader.DebugInfo.100
449 /// source language code.
450 static unsigned toNSDISrcLang(unsigned DwarfSrcLang);
451
452 /// Build a full path from debug \p Scope for OpString / DebugSource, matching
453 /// SPIRV-LLVM-Translator \c getFullPath (OCLUtil.h): \c DIScope::getFilename,
454 /// \c getDirectory, and \c sys::path::Style::native. Works for any \c DIScope
455 /// that carries file path fields (e.g. \c DIFile, \c DISubprogram,
456 /// \c DICompileUnit). Returns an empty path when \p Scope is null.
457 SmallString<128> getDebugFullPath(const DIScope *Scope) const;
458
459 /// Return an existing \c DebugSource id for file path \c OpString \p
460 /// FileStrReg or emit \c DebugSource and cache it (keyed by \p FileStrReg
461 /// id).
462 MCRegister getOrEmitDebugSourceForFileStrReg(MCRegister FileStrReg,
463 MCRegister VoidTypeReg,
464 MCRegister ExtInstSetReg,
466
467 /// Resolve the \c Parent operand for \c DebugFunctionDeclaration and
468 /// \c DebugFunction: an emitted debug type id when \c SP->getScope() is a
469 /// \c DIType in \c DebugTypeRegs, otherwise \c DebugCompilationUnit for
470 /// \c SP->getUnit() (or the first module CU when \c unit: is absent).
471 /// \returns \c std::nullopt when the scope requires a parent we cannot supply
472 /// (non-file scope that is not a mapped \c DIType) or the CU has no emitted
473 /// id.
474 std::optional<MCRegister>
475 resolveDebugFunctionParent(const DISubprogram *SP) const;
476
477 /// Resolve the \c Parent operand for a type instruction (\c
478 /// DebugTypeComposite) from its \p Scope: an emitted debug type id when \p
479 /// Scope is a \c DIType in \c DebugTypeRegs (a type nested in another type),
480 /// otherwise the first module \c DebugCompilationUnit.
481 /// \returns \c std::nullopt when \p Scope is a \c DIType that has not been
482 /// emitted, or when there is no compile unit.
483 std::optional<MCRegister> resolveTypeScopeParent(const DIScope *Scope) const;
484};
485
486} // namespace llvm
487
488#endif // LLVM_LIB_TARGET_SPIRV_SPIRVNONSEMANTICDEBUGHANDLER_H
This file defines the StringMap class.
This file defines the DenseMap class.
IRTranslator LLVM IR MI
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
This file defines the SmallString class.
This file defines the SmallVector class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
This class is intended to be used as a driving class for all asm writers.
Definition AsmPrinter.h:91
DWARF expression.
Base class for scope-like contexts.
Subprogram description. Uses SubclassData1.
Type array for a subprogram.
Base class for types.
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Wrapper class representing physical registers. Should be passed by value.
Definition MCRegister.h:41
Representation of each machine instruction.
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
void beginInstruction(const MachineInstr *MI) override
Process beginning of an instruction.
void endModule() override
Emit all sections that should come after the content.
void emitNonSemanticDebugStrings(SPIRV::ModuleAnalysisInfo &MAI)
Emit OpString instructions for all NSDI file paths and basic type names into the debug section (secti...
void beginModule(Module *M) override
Collect compile-unit metadata from the module.
void endFunctionImpl(const MachineFunction *MF) override
void beginFunctionImpl(const MachineFunction *MF) override
void emitNonSemanticGlobalDebugInfo(SPIRV::ModuleAnalysisInfo &MAI)
Emit module-scope NSDI instructions (DebugSource, DebugCompilationUnit, DebugTypeBasic,...
void prepareModuleOutput(const SPIRVSubtarget &ST, SPIRV::ModuleAnalysisInfo &MAI)
Add SPV_KHR_non_semantic_info extension and NonSemantic.Shader.DebugInfo.100 ext inst set entry to MA...
void endInstruction() override
Process end of an instruction.
void notifyEntryLabelEmitted(const MachineFunction &MF)
Called after the synthesized entry OpLabel has been emitted.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition SmallString.h:26
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition StringMap.h:128
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
LLVM Value Representation.
Definition Value.h:75
This is an optimization pass for GlobalISel generic memory operations.