0

What would be the best way to store custom data with each LLVM instruction node? Say to pass information from one pass to another? It doesn't seem like the instruction class allows users to store arbitrary data?

4

1 回答 1

0

您可以使用元数据机制将任何数据与每条指令相关联;请参阅有关如何设置元数据的相关问题

但是,如果您的生产者和消费者都是通行证,则标准方法是让生产者通行证存储此数据,并让消费者通行证使用其方法直接询问生产者通行证。有关如何设置 pass 之间的依赖关系,请参阅此相关文档。

您可能还对我的另一个答案感兴趣,它对此进行了更多讨论,并提供了设置 metadata 的代码示例

于 2014-07-22T05:09:22.017 回答