'Serialize the given object in the bitcode, and return it
as a pointer to a {i8* data, i32 length}, structure constant
(suitable for passing to unserialize()).'

def serialize_object(self, obj):

    try:
        gv = self.module.__serialized[obj]
    except KeyError:
        struct = self.serialize_uncached(obj)
        name = ('.const.picklebuf.%s' % (id(obj) if (config.DIFF_IR == 0) else 'DIFF_IR'))
        gv = self.context.insert_unique_const(self.module, name, struct)
        self.module.__serialized[obj] = gv
    return gv
