[LLVMdev] Named struct metadata

Patrick Walton pwalton at mozilla.com
Sun Sep 4 17:26:00 PDT 2011

Hi everyone,

It'd be useful for our purposes if we could attach metadata to named 
structs. In particular, in Rust we're looking to use this information to 
communicate information about our discriminated unions to the garbage 
collector. (We could, and are at the moment, using the metadata argument 
to the gcroot intrinsic, but this seems to inhibit optimizations and 
adds a fair amount of noise to the generated IR, so we'd like to 
transition to an addrspace-based GC solution at some point.)

It seems to me that attaching metadata to named structs could generally 
be useful as a way to communicate additional ad-hoc type information to 
optimizers, codegen, etc., in much the same way as GCC and Clang use 
__attribute__ on structs.

Does anyone have opinions as to whether this is a good idea?


More information about the llvm-dev mailing list