From b3bddfd47a5f54d904249bcbe1aed6dca6c25ce6 Mon Sep 17 00:00:00 2001 From: Edd Barrett Date: Fri, 17 Nov 2023 12:08:36 +0000 Subject: [PATCH] Add comment to serialise() and mention a design decision. --- llvm/lib/YkIR/YkIRWriter.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/llvm/lib/YkIR/YkIRWriter.cpp b/llvm/lib/YkIR/YkIRWriter.cpp index 0ca88180405153..9444bb59aa2f4b 100644 --- a/llvm/lib/YkIR/YkIRWriter.cpp +++ b/llvm/lib/YkIR/YkIRWriter.cpp @@ -489,6 +489,14 @@ class YkIRWriter { YkIRWriter(Module &M, MCStreamer &OutStreamer) : M(M), OutStreamer(OutStreamer) {} + // Entry point for IR serialisation. + // + // The order of serialisation matters. + // + // - Serialising functions can introduce new types and constants. + // - Serialising constants can introduce new types. + // + // So we must serialise functions, then constants, then types. void serialise() { // header: OutStreamer.emitInt32(Magic);