[RISCV] Refactor predicates for rvv intrinsic patterns.
[llvm-project.git] / llvm / lib / DebugInfo / PDB / Native / DbiModuleDescriptor.cpp
blob9755f2ca3bdce785835c818653e40751019e6360
1 //===- DbiModuleDescriptor.cpp - PDB module information -------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
10 #include "llvm/DebugInfo/PDB/Native/RawTypes.h"
11 #include "llvm/Support/BinaryStreamReader.h"
12 #include "llvm/Support/Endian.h"
13 #include "llvm/Support/Error.h"
14 #include "llvm/Support/MathExtras.h"
15 #include <cstdint>
17 using namespace llvm;
18 using namespace llvm::pdb;
19 using namespace llvm::support;
21 Error DbiModuleDescriptor::initialize(BinaryStreamRef Stream,
22 DbiModuleDescriptor &Info) {
23 BinaryStreamReader Reader(Stream);
24 if (auto EC = Reader.readObject(Info.Layout))
25 return EC;
27 if (auto EC = Reader.readCString(Info.ModuleName))
28 return EC;
30 if (auto EC = Reader.readCString(Info.ObjFileName))
31 return EC;
32 return Error::success();
35 bool DbiModuleDescriptor::hasECInfo() const {
36 return (Layout->Flags & ModInfoFlags::HasECFlagMask) != 0;
39 uint16_t DbiModuleDescriptor::getTypeServerIndex() const {
40 return (Layout->Flags & ModInfoFlags::TypeServerIndexMask) >>
41 ModInfoFlags::TypeServerIndexShift;
44 const SectionContrib &DbiModuleDescriptor::getSectionContrib() const {
45 return Layout->SC;
48 uint16_t DbiModuleDescriptor::getModuleStreamIndex() const {
49 return Layout->ModDiStream;
52 uint32_t DbiModuleDescriptor::getSymbolDebugInfoByteSize() const {
53 return Layout->SymBytes;
56 uint32_t DbiModuleDescriptor::getC11LineInfoByteSize() const {
57 return Layout->C11Bytes;
60 uint32_t DbiModuleDescriptor::getC13LineInfoByteSize() const {
61 return Layout->C13Bytes;
64 uint32_t DbiModuleDescriptor::getNumberOfFiles() const {
65 return Layout->NumFiles;
68 uint32_t DbiModuleDescriptor::getSourceFileNameIndex() const {
69 return Layout->SrcFileNameNI;
72 uint32_t DbiModuleDescriptor::getPdbFilePathNameIndex() const {
73 return Layout->PdbFilePathNI;
76 StringRef DbiModuleDescriptor::getModuleName() const { return ModuleName; }
78 StringRef DbiModuleDescriptor::getObjFileName() const { return ObjFileName; }
80 uint32_t DbiModuleDescriptor::getRecordLength() const {
81 uint32_t M = ModuleName.str().size() + 1;
82 uint32_t O = ObjFileName.str().size() + 1;
83 uint32_t Size = sizeof(ModuleInfoHeader) + M + O;
84 Size = alignTo(Size, 4);
85 return Size;