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