[LLVMdev] Proposal : Function Notes
dpatel at apple.com
Mon Aug 25 11:06:25 PDT 2008
On Aug 23, 2008, at 6:58 AM, Matthijs Kooijman wrote:
> Hi Devang,
>> All supported notes must be documented in LLVM language reference.
> Does this also mean that undocumented / unsupported notes are invalid?
Yes. This is not a replacement for existing annotation instructions.
> particular, when I have a custom frontend and backend, using custom
> could be a great way to communicate between those, if the LLVM IR
> would allow
> unknown notes.
> Other than that, this seems like a decent approach. As Andrew
> pointed out, I
> do think that perhaps calling conventions and function attributes
> could be
> included as notes, though I think most (if not all) of them are
> different (but perhaps a few could be moved?).
The goal here is to provide optimizer and code generator hints about
choices made by the user on the command line. Typically, these choices
are specific and the optimizer and code generation passes are
"advised" to act on these notes if possible, for example, optimize for
size. It is not a good idea to encode, optimization level 3 in notes.
The linkage information is not an advise that the respective pass can
ignore without causing disaster. So is true for calling convention.
One good example to clarify role played by notes is : Notes are not
designed to specify target architecture or target machine, however it
may be used to restrict/enable use of certain instruction subset per
function by a code generation pass.
The notes themselves do not influence selection of a pass. The notes
guide pass when there are alternative choices a pass can made, which
are typically exposed by a command line argument.
More information about the llvm-dev