From b8da34bd8650ad73e5587133d61edfdaef85a276 Mon Sep 17 00:00:00 2001 From: Edd Barrett Date: Fri, 17 Nov 2023 12:03:14 +0000 Subject: [PATCH 1/2] Make a load of functions private. --- llvm/lib/YkIR/YkIRWriter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/lib/YkIR/YkIRWriter.cpp b/llvm/lib/YkIR/YkIRWriter.cpp index 9c9b4b96d279a0..0ca88180405153 100644 --- a/llvm/lib/YkIR/YkIRWriter.cpp +++ b/llvm/lib/YkIR/YkIRWriter.cpp @@ -169,10 +169,6 @@ class YkIRWriter { return getIndex(&M, F); } -public: - YkIRWriter(Module &M, MCStreamer &OutStreamer) - : M(M), OutStreamer(OutStreamer) {} - // Serialises a null-terminated string. void serialiseString(StringRef S) { OutStreamer.emitBinaryData(S); @@ -489,6 +485,10 @@ class YkIRWriter { } } +public: + YkIRWriter(Module &M, MCStreamer &OutStreamer) + : M(M), OutStreamer(OutStreamer) {} + void serialise() { // header: OutStreamer.emitInt32(Magic); From b3bddfd47a5f54d904249bcbe1aed6dca6c25ce6 Mon Sep 17 00:00:00 2001 From: Edd Barrett Date: Fri, 17 Nov 2023 12:08:36 +0000 Subject: [PATCH 2/2] 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);