Suppressing metadata emission

(Carl Peto) #1

Hi all,

As part of my ongoing Quixotic attempts to get AVR/16 bit support improvements in Swift, I'd like to find a way to suppress the emission of metadata. @Joe_Groff has suggested this might be useful sometimes, so I'd like to suggest a hidden compiler option.

  1. Can anyone give me some pointers where I might start looking for the code nodes to be able to suppress metadata emission.

  2. Does anyone have an opinion on using an esoteric command line switch like this vs maybe something even more hidden like a "secret" environment variable that makes the compiler stop emission?


(Slava Pestov) #2

Metadata emission happens in the IRGen phase, in lib/IRGen/GenMeta.cpp.

I think a frontend flag is much preferred to a hidden environment variable.

(Jordan Rose) #3

I second this. A minor design principle of Swift's driver (that I should write down somewhere besides here) is that environment variables shouldn't affect frontend invocations that the driver generates. That helps a lot with reproducibility.

This doesn't mean that the frontend can't listen to environment variables, and indeed it inherits all the ones Clang checks. But in general if it does check an environment variable, there should also be a way to specify it explicitly with a flag. The driver can then check that variable ahead of time and pass the flag.

In your case, though, that's probably all overkill, since a flag would be sufficient in the first place.

(Carl Peto) #4

Got it. I'll start work on that once I've got my PR finished for 16 bit support. Unlike Swift, I am most definitely single threaded. :slight_smile: