[llvm-commits] patch: support instructions in MDNode

Nick Lewycky nicholas at mxc.ca
Sun Jun 7 13:05:03 PDT 2009


Duncan Sands wrote:
> Hi Nick,
> 
>> The attached patch adds support for Instructions in MDNodes to the .ll 
>> parser (the printer already supported it) and the .bc reader/writer.
> 
> can please remind me again why you want this?

:)

The idea is that we want some things like debug info to store 'side 
information' about the program which persists in the .bc files without 
actually affecting the unaware optimizations any.

I do mean any. An MDNode doesn't show up in the use_list of an 
Instruction, which means that all optimizations will carry on just as if 
they weren't there. Of course, that also means that you could sink 
instruction %X past the "call void @llvm.dbg.foo(metadata !{i32 %X}" 
that refers to it, which is deliberate. MDNodes don't have dominance 
rules, or if you insist, you can think of them as dominated by all 
instructions in the same function.

The immediate goal is to do a better job of preserving information and 
removing all the "if (isa<DbgInfoIntrinsic>(...))" special cases 
scattered around the codebase. Further, metadata should be more 
memory-efficient than our existing format.

I'm really pushing for the bitcode format to be finalized because I 
don't want to support a legacy metadata format just because I didn't get 
it finished in time for the 2.6 release. The first user of metadata will 
probably be the existing @llvm.annotation and @llvm.var.annotation 
instrincs but those really want MDString not MDNodes.

Nick




More information about the llvm-commits mailing list