summaryrefslogtreecommitdiff
path: root/source/slang/slang-serialize-ir.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-09-30 13:28:56 -0400
committerGitHub <noreply@github.com>2020-09-30 13:28:56 -0400
commit274c20a5eb133779a9d890ca79120815fb92b04e (patch)
tree50f8074917a102b25a7f34adeacffaf185d59242 /source/slang/slang-serialize-ir.cpp
parent94d3f2bd9c5557658751f73bc5fc443b41230d2c (diff)
Generalizing Serialization (#1563)
* First pass at generalizing serializer. * Split out ReflectClassInfo * Use the general ReflectClassInfo * Fix some typos in debug generalized serialization. * Add calculation of classIds. Make distinct addCopy/add on SerialClasses. * Write up of more generalized serialization * WIP to transition from ASTSerialReader/Writer etc to generalized SerialReader/Writer and associated types. * Improvements to SerialExtraObjects. Keep RefObjects in scope in factory * Compiles with Serial refactor - doesn't quite work yet. * First pass serialization appears to work with refector. * Split out type info for general slang types. * Split out slang-serialize-misc-type-info.h * DebugSerialData -> SerialSourecLocData DebugSerialReader -> SerialSourceLocReader DebugSerialWriter -> SerialSourceLocWriter * Remove unused template that only compiles on VS. * Fix warning around unused function on non-VS.
Diffstat (limited to 'source/slang/slang-serialize-ir.cpp')
-rw-r--r--source/slang/slang-serialize-ir.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/source/slang/slang-serialize-ir.cpp b/source/slang/slang-serialize-ir.cpp
index ac8085d51..d923577f4 100644
--- a/source/slang/slang-serialize-ir.cpp
+++ b/source/slang/slang-serialize-ir.cpp
@@ -34,7 +34,7 @@ void IRSerialWriter::_addInstruction(IRInst* inst)
m_insts.add(inst);
}
-Result IRSerialWriter::_calcDebugInfo(DebugSerialWriter* debugWriter)
+Result IRSerialWriter::_calcDebugInfo(SerialSourceLocWriter* sourceLocWriter)
{
// We need to find the unique source Locs
// We are not going to store SourceLocs directly, because there may be multiple views mapping down to
@@ -93,7 +93,7 @@ Result IRSerialWriter::_calcDebugInfo(DebugSerialWriter* debugWriter)
IRSerialData::SourceLocRun sourceLocRun;
sourceLocRun.m_numInst = curInstIndex - startInstLoc->instIndex;;
sourceLocRun.m_startInstIndex = IRSerialData::InstIndex(startInstLoc->instIndex);
- sourceLocRun.m_sourceLoc = debugWriter->addSourceLoc(SourceLoc::fromRaw(startSourceLoc));
+ sourceLocRun.m_sourceLoc = sourceLocWriter->addSourceLoc(SourceLoc::fromRaw(startSourceLoc));
m_serialData->m_debugSourceLocRuns.add(sourceLocRun);
@@ -104,7 +104,7 @@ Result IRSerialWriter::_calcDebugInfo(DebugSerialWriter* debugWriter)
return SLANG_OK;
}
-Result IRSerialWriter::write(IRModule* module, DebugSerialWriter* debugWriter, SerialOptionFlags options, IRSerialData* serialData)
+Result IRSerialWriter::write(IRModule* module, SerialSourceLocWriter* sourceLocWriter, SerialOptionFlags options, IRSerialData* serialData)
{
typedef Ser::Inst::PayloadType PayloadType;
@@ -307,9 +307,9 @@ Result IRSerialWriter::write(IRModule* module, DebugSerialWriter* debugWriter, S
}
}
- if ((options & SerialOptionFlag::DebugInfo) && debugWriter)
+ if ((options & SerialOptionFlag::DebugInfo) && sourceLocWriter)
{
- _calcDebugInfo(debugWriter);
+ _calcDebugInfo(sourceLocWriter);
}
m_serialData = nullptr;
@@ -669,7 +669,7 @@ static Result _readInstArrayChunk(SerialCompressionType containerCompressionType
return SLANG_OK;
}
-Result IRSerialReader::read(const IRSerialData& data, Session* session, DebugSerialReader* debugReader, RefPtr<IRModule>& outModule)
+Result IRSerialReader::read(const IRSerialData& data, Session* session, SerialSourceLocReader* sourceLocReader, RefPtr<IRModule>& outModule)
{
typedef Ser::Inst::PayloadType PayloadType;
@@ -866,14 +866,14 @@ Result IRSerialReader::read(const IRSerialData& data, Session* session, DebugSer
}
// We now need to apply the runs
- if (debugReader && m_serialData->m_debugSourceLocRuns.getCount())
+ if (sourceLocReader && m_serialData->m_debugSourceLocRuns.getCount())
{
List<IRSerialData::SourceLocRun> sourceRuns(m_serialData->m_debugSourceLocRuns);
// They are now in source location order
sourceRuns.sort();
// Just guess initially 0 for the source file that contains the initial run
- DebugSerialData::SourceRange range = DebugSerialData::SourceRange::getInvalid();
+ SerialSourceLocData::SourceRange range = SerialSourceLocData::SourceRange::getInvalid();
int fix = 0;
const Index numRuns = sourceRuns.getCount();
@@ -887,9 +887,9 @@ Result IRSerialReader::read(const IRSerialData& data, Session* session, DebugSer
{
if (!range.contains(run.m_sourceLoc))
{
- fix = debugReader->calcFixSourceLoc(run.m_sourceLoc, range);
+ fix = sourceLocReader->calcFixSourceLoc(run.m_sourceLoc, range);
}
- sourceLoc = debugReader->calcFixedLoc(run.m_sourceLoc, fix, range);
+ sourceLoc = sourceLocReader->calcFixedLoc(run.m_sourceLoc, fix, range);
}
// Write to all the instructions