26 : Modules(&Modules), Modi(Modi), Filei(Filei) {
37 if (isEnd() && R.isEnd())
41 if (isEnd() != R.isEnd())
50 assert(Modules == R.Modules);
55 return (Filei == R.Filei);
68 return Filei < R.Filei;
77 if (isEnd() && R.isEnd())
89 Thisi = R.Modules->getSourceFileCount(RealModi);
93 return Thisi - R.Filei;
101 assert(Filei <= Modules->getSourceFileCount(Modi));
110 assert(!isUniversalEnd());
118void DbiModuleSourceFilesIterator::setValue() {
124 uint32_t Off = Modules->ModuleInitialFileIndex[Modi] + Filei;
126 if (!ExpectedValue) {
130 ThisValue = *ExpectedValue;
133bool DbiModuleSourceFilesIterator::isEnd()
const {
134 if (isUniversalEnd())
138 assert(Modi <= Modules->getModuleCount());
139 assert(Filei <= Modules->getSourceFileCount(Modi));
148bool DbiModuleSourceFilesIterator::isUniversalEnd()
const {
return !Modules; }
150bool DbiModuleSourceFilesIterator::isCompatible(
153 if (isUniversalEnd() ||
R.isUniversalEnd())
160 return Modi ==
R.Modi;
165 if (
auto EC = initializeModInfo(ModInfo))
167 if (
auto EC = initializeFileInfo(FileInfo))
174 ModInfoSubstream = ModInfo;
181 if (
auto EC = Reader.readArray(Descriptors, ModInfo.
getLength()))
188 FileInfoSubstream = FileInfo;
194 if (
auto EC = FISR.readObject(FileInfoHeader))
200 if (
auto EC = FISR.readArray(ModuleIndices, FileInfoHeader->
NumModules))
202 if (
auto EC = FISR.readArray(ModFileCountArray, FileInfoHeader->
NumModules))
210 for (
auto Count : ModFileCountArray)
211 NumSourceFiles += Count;
217 if (
auto EC = FISR.readArray(FileNameOffsets, NumSourceFiles))
220 if (
auto EC = FISR.readStreamRef(NamesBuffer))
223 auto DescriptorIter = Descriptors.begin();
225 ModuleInitialFileIndex.resize(FileInfoHeader->
NumModules);
226 ModuleDescriptorOffsets.resize(FileInfoHeader->
NumModules);
228 assert(DescriptorIter != Descriptors.end());
229 ModuleInitialFileIndex[
I] = NextFileIndex;
230 ModuleDescriptorOffsets[
I] = DescriptorIter.offset();
232 NextFileIndex += ModFileCountArray[
I];
236 assert(DescriptorIter == Descriptors.end());
237 assert(NextFileIndex == NumSourceFiles);
245 return FileInfoHeader ? FileInfoHeader->
NumModules : 0;
249 return FileNameOffsets.size();
253 return ModFileCountArray[Modi];
259 auto Iter = Descriptors.at(
Offset);
260 assert(Iter != Descriptors.end());
266 return make_range<DbiModuleSourceFilesIterator>(
280 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.