36 DXContainerPDB() : ModulePass(ID) {}
38 StringRef getPassName()
const override {
return "DirectX PDB Emitter"; }
40 bool runOnModule(
Module &M)
override;
42 void getAnalysisUsage(AnalysisUsage &AU)
const override {
46 bool shouldSkipSection(StringRef SectionName,
size_t SectionSize)
override;
58 static const StringSet<> DebugSections{
"ILDB",
"ILDN",
"HASH",
"PDBI",
59 "SRCI",
"STAT",
"RDAT",
"VERS"};
60 return !DebugSections.
contains(SectionName);
65 if (
const auto *
Data =
67 return Data->getRawDataValues();
73 for (
const GlobalVariable &GV :
M->globals()) {
74 StringRef
Name = GV.getSection();
79 if (shouldSkipSection(Name,
Data.size()))
87bool DXContainerPDB::runOnModule(
Module &M) {
90 StringRef DebugFileName;
92 for (
const GlobalVariable &GV :
M.globals()) {
94 assert(DebugFileName.
empty() &&
"Duplicate PDBNAME section");
104 if (DebugFileName.
empty())
113 if (
Error Err = Builder.initialize(512))
118 "First 5 streams should be empty in DirectX PDB file");
120 if (
auto Err = Builder.getMsfBuilder().addStream(0).takeError())
125 if (
auto Err = Builder.getMsfBuilder().addStream(0).takeError())
130 codeview::GUID PdbGuid;
132 "Module hash length must be match GUID length");
135 auto &InfoBuilder = Builder.getInfoBuilder();
136 InfoBuilder.setAge(1);
137 InfoBuilder.setGuid(PdbGuid);
138 InfoBuilder.setSignature(0);
139 InfoBuilder.setVersion(pdb::PdbRaw_ImplVer::PdbImplVC70);
142 raw_svector_ostream OS(*Builder.getDXContainerData());
143 write(OS,
M.getTargetTriple());
146 codeview::GUID IgnoredOutGuid;
147 if (
Error Err = Builder.commit(DebugFileName, &IgnoredOutGuid))
155char DXContainerPDB::ID = 0;
156INITIALIZE_PASS(DXContainerPDB,
"dxil-pdb",
"DirectX PDB Emitter",
false,
true)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static StringRef getGlobalData(const GlobalVariable &GV)
Module.h This file contains the declarations for the Module class.
Machine Check Debug Module
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
StringSet - A set-like wrapper for the StringMap.
void setPreservesAll()
Set by analyses that do not transform their input at all.
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
bool hasInitializer() const
Definitions have initializers, declarations don't.
virtual bool shouldSkipSection(StringRef SectionName, size_t SectionSize)
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
void push_back(const T &Elt)
Represent a constant reference to a string, i.e.
constexpr bool empty() const
Check if the string is empty.
bool contains(StringRef key) const
Check if the set contains the given key.
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.
std::array< uint32_t, 5 > ModuleHash
160 bits SHA1
LLVM_ABI void reportFatalInternalError(Error Err)
Report a fatal error that indicates a bug in LLVM.
static constexpr StringLiteral ModuleHashSectionName
Contains module hash.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
FunctionAddr VTableAddr uintptr_t uintptr_t Data
ArrayRef(const T &OneElt) -> ArrayRef< T >
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
LLVM_ABI Error write(DWPWriter &Out, ArrayRef< std::string > Inputs, OnCuIndexOverflow OverflowOptValue, Dwarf64StrOffsetsPromotion StrOffsetsOptValue, raw_pwrite_stream *OS=nullptr)
ModulePass * createDXContainerPDBPass()
Pass for emitting DirectX PDB files.
static constexpr StringLiteral PdbFileNameSectionName
Contains PDB output file name.
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.