25 : Modules(&Modules), Modi(Modi), Filei(Filei) {
36 if (isEnd() && R.isEnd())
40 if (isEnd() != R.isEnd())
49 assert(Modules == R.Modules);
54 return (Filei == R.Filei);
67 return Filei < R.Filei;
76 if (isEnd() && R.isEnd())
88 Thisi = R.Modules->getSourceFileCount(RealModi);
92 return Thisi - R.Filei;
100 assert(Filei <= Modules->getSourceFileCount(Modi));
109 assert(!isUniversalEnd());
117void DbiModuleSourceFilesIterator::setValue() {
123 uint32_t Off = Modules->ModuleInitialFileIndex[Modi] + Filei;
125 if (!ExpectedValue) {
129 ThisValue = *ExpectedValue;
132bool DbiModuleSourceFilesIterator::isEnd()
const {
133 if (isUniversalEnd())
137 assert(Modi <= Modules->getModuleCount());
138 assert(Filei <= Modules->getSourceFileCount(Modi));
147bool DbiModuleSourceFilesIterator::isUniversalEnd()
const {
return !Modules; }
149bool DbiModuleSourceFilesIterator::isCompatible(
152 if (isUniversalEnd() ||
R.isUniversalEnd())
159 return Modi ==
R.Modi;
164 if (
auto EC = initializeModInfo(ModInfo))
166 if (
auto EC = initializeFileInfo(FileInfo))
173 ModInfoSubstream = ModInfo;
180 if (
auto EC = Reader.readArray(Descriptors, ModInfo.
getLength()))
187 FileInfoSubstream = FileInfo;
193 if (
auto EC = FISR.readObject(FileInfoHeader))
199 if (
auto EC = FISR.readArray(ModuleIndices, FileInfoHeader->
NumModules))
201 if (
auto EC = FISR.readArray(ModFileCountArray, FileInfoHeader->
NumModules))
209 for (
auto Count : ModFileCountArray)
210 NumSourceFiles += Count;
216 if (
auto EC = FISR.readArray(FileNameOffsets, NumSourceFiles))
219 if (
auto EC = FISR.readStreamRef(NamesBuffer))
222 auto DescriptorIter = Descriptors.begin();
224 ModuleInitialFileIndex.resize(FileInfoHeader->
NumModules);
225 ModuleDescriptorOffsets.resize(FileInfoHeader->
NumModules);
227 assert(DescriptorIter != Descriptors.end());
228 ModuleInitialFileIndex[
I] = NextFileIndex;
229 ModuleDescriptorOffsets[
I] = DescriptorIter.offset();
231 NextFileIndex += ModFileCountArray[
I];
235 assert(DescriptorIter == Descriptors.end());
236 assert(NextFileIndex == NumSourceFiles);
244 return FileInfoHeader ? FileInfoHeader->
NumModules : 0;
248 return FileNameOffsets.size();
252 return ModFileCountArray[Modi];
258 auto Iter = Descriptors.at(
Offset);
259 assert(Iter != Descriptors.end());
265 return make_range<DbiModuleSourceFilesIterator>(
275 uint32_t FileOffset = FileNameOffsets[Index];
279 return std::move(EC);
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Provides read only access to a subclass of BinaryStream.
Error readCString(StringRef &Dest)
Read a null terminated string from Dest.
void setOffset(uint64_t Off)
uint64_t getLength() const
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
FixedStreamArray is similar to VarStreamArray, except with each record having a fixed-length.
StringRef - Represent a constant reference to a string, i.e.
A range adaptor for a pair of iterators.
DbiModuleDescriptor getModuleDescriptor(uint32_t Modi) const
uint32_t getModuleCount() const
Error initialize(BinaryStreamRef ModInfo, BinaryStreamRef FileInfo)
uint32_t getSourceFileCount() const
iterator_range< DbiModuleSourceFilesIterator > source_files(uint32_t Modi) const
Expected< StringRef > getFileName(uint32_t Index) const
DbiModuleSourceFilesIterator()=default
DbiModuleSourceFilesIterator & operator-=(std::ptrdiff_t N)
std::ptrdiff_t operator-(const DbiModuleSourceFilesIterator &R) const
bool operator==(const DbiModuleSourceFilesIterator &R) const
DbiModuleSourceFilesIterator & operator+=(std::ptrdiff_t N)
bool operator<(const DbiModuleSourceFilesIterator &RHS) const
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
This is an optimization pass for GlobalISel generic memory operations.
void consumeError(Error Err)
Consume a Error without doing anything.