LLVM  14.0.0git
DbiModuleDescriptor.cpp
Go to the documentation of this file.
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 //===----------------------------------------------------------------------===//
8 
12 #include "llvm/Support/Endian.h"
13 #include "llvm/Support/Error.h"
15 #include <cstdint>
16 
17 using namespace llvm;
18 using namespace llvm::pdb;
19 using namespace llvm::support;
20 
23  BinaryStreamReader Reader(Stream);
24  if (auto EC = Reader.readObject(Info.Layout))
25  return EC;
26 
27  if (auto EC = Reader.readCString(Info.ModuleName))
28  return EC;
29 
30  if (auto EC = Reader.readCString(Info.ObjFileName))
31  return EC;
32  return Error::success();
33 }
34 
36  return (Layout->Flags & ModInfoFlags::HasECFlagMask) != 0;
37 }
38 
40  return (Layout->Flags & ModInfoFlags::TypeServerIndexMask) >>
42 }
43 
45  return Layout->SC;
46 }
47 
49  return Layout->ModDiStream;
50 }
51 
53  return Layout->SymBytes;
54 }
55 
57  return Layout->C11Bytes;
58 }
59 
61  return Layout->C13Bytes;
62 }
63 
65  return Layout->NumFiles;
66 }
67 
69  return Layout->SrcFileNameNI;
70 }
71 
73  return Layout->PdbFilePathNI;
74 }
75 
76 StringRef DbiModuleDescriptor::getModuleName() const { return ModuleName; }
77 
78 StringRef DbiModuleDescriptor::getObjFileName() const { return ObjFileName; }
79 
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;
86 }
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::alignTo
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition: Alignment.h:148
BinaryStreamReader.h
MathExtras.h
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::pdb::SectionContrib
Definition: RawTypes.h:46
RawTypes.h
llvm::pdb::ModInfoFlags::TypeServerIndexMask
static const uint16_t TypeServerIndexMask
Definition: RawTypes.h:206
DbiModuleDescriptor.h
llvm::pdb::DbiModuleDescriptor::getSourceFileNameIndex
uint32_t getSourceFileNameIndex() const
Definition: DbiModuleDescriptor.cpp:68
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:331
Error.h
llvm::pdb::DbiModuleDescriptor::hasECInfo
bool hasECInfo() const
Definition: DbiModuleDescriptor.cpp:35
llvm::pdb::ModInfoFlags::HasECFlagMask
static const uint16_t HasECFlagMask
uint16_t fWritten : 1; // True if DbiModuleDescriptor is dirty uint16_t fECEnabled : 1; // Is EC symb...
Definition: RawTypes.h:204
llvm::pdb::ModuleInfoHeader
The header preceding each entry in the Module Info substream of the DBI stream.
Definition: RawTypes.h:212
llvm::pdb::DbiModuleDescriptor::getTypeServerIndex
uint16_t getTypeServerIndex() const
Definition: DbiModuleDescriptor.cpp:39
llvm::pdb::DbiModuleDescriptor::getRecordLength
uint32_t getRecordLength() const
Definition: DbiModuleDescriptor.cpp:80
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
llvm::pdb
Definition: ConcreteSymbolEnumerator.h:20
llvm::BinaryStreamReader
Provides read only access to a subclass of BinaryStream.
Definition: BinaryStreamReader.h:31
llvm::pdb::DbiModuleDescriptor::getPdbFilePathNameIndex
uint32_t getPdbFilePathNameIndex() const
Definition: DbiModuleDescriptor.cpp:72
llvm::pdb::DbiModuleDescriptor::getNumberOfFiles
uint32_t getNumberOfFiles() const
Definition: DbiModuleDescriptor.cpp:64
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:197
llvm::pdb::DbiModuleDescriptor::getSymbolDebugInfoByteSize
uint32_t getSymbolDebugInfoByteSize() const
Definition: DbiModuleDescriptor.cpp:52
llvm::pdb::ModInfoFlags::TypeServerIndexShift
static const uint16_t TypeServerIndexShift
Definition: RawTypes.h:207
llvm::BinaryStreamReader::readCString
Error readCString(StringRef &Dest)
Read a null terminated string from Dest.
Definition: BinaryStreamReader.cpp:74
llvm::pdb::DbiModuleDescriptor::getC11LineInfoByteSize
uint32_t getC11LineInfoByteSize() const
Definition: DbiModuleDescriptor.cpp:56
llvm::pdb::DbiModuleDescriptor::initialize
static Error initialize(BinaryStreamRef Stream, DbiModuleDescriptor &Info)
Definition: DbiModuleDescriptor.cpp:21
llvm::BinaryStreamReader::readObject
Error readObject(const T *&Dest)
Get a pointer to an object of type T from the underlying stream, as if by memcpy, and store the resul...
Definition: BinaryStreamReader.h:169
llvm::pdb::DbiModuleDescriptor::getSectionContrib
const SectionContrib & getSectionContrib() const
Definition: DbiModuleDescriptor.cpp:44
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
uint32_t
uint16_t
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::support
Definition: Endian.h:25
llvm::pdb::DbiModuleDescriptor::getModuleStreamIndex
uint16_t getModuleStreamIndex() const
Definition: DbiModuleDescriptor.cpp:48
llvm::pdb::DbiModuleDescriptor::getC13LineInfoByteSize
uint32_t getC13LineInfoByteSize() const
Definition: DbiModuleDescriptor.cpp:60
llvm::pdb::DbiModuleDescriptor::getObjFileName
StringRef getObjFileName() const
Definition: DbiModuleDescriptor.cpp:78
llvm::pdb::DbiModuleDescriptor::getModuleName
StringRef getModuleName() const
Definition: DbiModuleDescriptor.cpp:76
llvm::pdb::DbiModuleDescriptor
Definition: DbiModuleDescriptor.h:23
Endian.h
llvm::BinaryStreamRef
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
Definition: BinaryStreamRef.h:156