[PATCH] D36092: [MIR] Print target specific constant pools
Alex Lorenz via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 31 09:22:37 PDT 2017
arphaman added a comment.
It might not be worth doing full blown target-specific serialization for this, but it might be nice to add `IsTargetSpecific` optional field to the constant pool value YAML representation. This way the parser will at least know that it can't parse this kind of constant pool value when somebody tries to feed the printed MIR into llc.
The last time I thought about the target-specific serialization I had something like this in mind:
I think for target specific serialization it might make sense to inject a set of values into the YAML mapping. The parser would have to call into a target hook that could create a target-specific `ConstantPoolValue`s from the YAML mapping (ARM has multiple subclasses, so you'd have to somehow store that information as well which might be an issue, although you could probably figure out the subclass just by looking at the keys in the YAML mapping). But again, I'm not sure it's worth it though, since ARM would have to provide YAML mappings for each individual `enum` that's used in constant pool values and the subclasses of `ConstantPoolValue`. Another problem is the MachineBasicBlock/Global value references, which are parsed after YAML is deserialized. ARM's parser might have to manually parse these (call into the `parseMBBReference` function`) which could be annoying. I think that could be partially solved using new types instead of raw strings the YAML traits. These types should expose only a function that can produce a real value (like MBB*), and not the raw string.
Another way to handle this would be to just print the value (as you did here) and provide a target-specific parsing hook and then the targets can just parse the printed value if they want to parse MIR with their target-specific values. But I think that's a bit crude and doesn't integrate with the rest of the MIR that well.
https://reviews.llvm.org/D36092
More information about the llvm-commits
mailing list