LLVM Objects Serialization


* I don't know whether this is a correct medium to ask this or not.
So, sorry if this is not related.

I have many complicated structures of LLVM objects and I want to
serialize those information and eventually write it to a file or
transport it. To give you an idea I have many objects like
std::vectore<LLVM::BranchInst*> and many others. I am trying to figure
out what is the best approach to this problem. since I don't want to
change every class I am using in LLVM, I prefer a non-intrusive
method. The problem with Protobuf and approaches like that is I have
to write a structure file for every LLVM object I am using. I am okay
with that if I know for sure there is no better option.

Besides that, I was thinking about using LLVM objects bitcode
representation (if I can kind of like an array of byte for bitcode
representation). But I hadn't any luck so far. If I get the bitcode
representation of an object I can manage to serialize other stuff. I
don't know this is viable or not. Or whether I can get bitcode of an
object independently.

best wishes,