The Assignment Tracking debug-info feature is outlined in this RFC. This first series of patches adds documentation, the changes necessary to start emitting and using the new metadata, and updates clang with an option to enable the feature. Working with the new metadata in the middle and back end will come later. There are still a few rough edges but I'm putting these patches up now hoping to get feedback on the design and implementation from the upstream community.
Add the llvm.dbg.assign intrinsic boilerplate. This updates the textual-bitcode roundtrip test to also check that round-tripping with the intrinsic works.
The intrinsic marks the position of a source level assignment.
The llvm.dbg.assign interface looks like this (each parameter is wrapped in MetadataAsValue, and Value * type parameters are
first wrapped in ValueAsMetadata):
void @llvm.dbg.assign(Value *Value, DIExpression *ValueExpression, DILocalVariable *Variable, DIAssignID *ID, Value *Address, DIExpression *AddressExpression)
The first three parameters look and behave like an llvm.dbg.value. ID is a reference to a store. The intrinsic is "linked to" instructions in the same function that use the same ID as an attachment. That is mostly conceptual at this point; the two-way link infrastructure will come in another patch. Address is the destination address of the store and it is modified by AddressExpression. llvm currently encodes variable fragment information in DIExpressions, so as an implementation quirk the FragmentInfo for Variable is contained within ValueExpression only.
This wants three slashes rather than two; I get the feeling the comment is a bit too verbose, in that it's writing a bit too much about one intrinsic in a generic class. IMO, better to focus on "this abstracts where that information is stored".