> I did mean the LangRef, but probably not there, and not to that degree.For documentation I think being explicit is much better than being implicit.> It's a fairly minor point, perhaps warranting a sentence where unnamed > values are generally discussed and the basic-block case is mentioned > (under the "Identifiers" section).I took a look at the "Identifiers" section [1]. There isn't any mention of the basic-block case there. In any case I don't think this is the appropriate place. Perhaps I've given you the wrong impression about what I want to document. What I want to documented is the fact that in a function definition, arguments can be unnamed and that unnamed arguments are assigned to temporary registers using the function's counter. The logical place to discuss that is [2] (if I was a new user of LLVM and I wanted to know about function arguments I wouldn't go looking at the identifiers section). The entry block being assigned "%0" is discussed here too so I could correct that as well. On a separate note whilst looking at the Language reference I did observe think a few things were odd - We seem to mix the terms argument and parameter. Functions seem to have arguments, but those arguments have "parameter attributes" - We sort of use backus naur form to show the IR syntax but we don't define things like "argument list" (what I'm trying to document), "ret attrs", "fn Attrs". For "ret attrs" and "fn Attrs" we define what the attributes are but we don't define the form of the list (i.e. space separated). [1] http://llvm.org/docs/LangRef.html#identifiers [2] http://llvm.org/docs/LangRef.html#functions
Tim Northover
2014-Aug-15 10:01 UTC
[LLVMdev] Functions with unnamed parameters in LLVM IR
On 15 August 2014 10:53, Dan Liew <dan at su-root.co.uk> wrote:>> I did mean the LangRef, but probably not there, and not to that degree. > > For documentation I think being explicit is much better than being implicit.Sure, but the entire section on functions is 61 lines. Adding 20 to cover this bit of trivia is *way* out of balance, and I don't think it actually improves the usability of the documentation for most readers.> I took a look at the "Identifiers" section [1]. There isn't any > mention of the basic-block case there."Unnamed temporaries are numbered sequentially (using a per-function incrementing counter, starting with 0). Note that basic blocks are included in this numbering. For example, if the entry basic block is not given a label name, then it will get number 0." Cheers. Tim.
On 15 August 2014 11:01, Tim Northover <t.p.northover at gmail.com> wrote:> On 15 August 2014 10:53, Dan Liew <dan at su-root.co.uk> wrote: >>> I did mean the LangRef, but probably not there, and not to that degree. >> >> For documentation I think being explicit is much better than being implicit. > > Sure, but the entire section on functions is 61 lines. Adding 20 to > cover this bit of trivia is *way* out of balance, and I don't think it > actually improves the usability of the documentation for most readers.You're probably right there. I could cut it down a bit. I still think having +The argument list is a comma seperated sequence of arguments where each argument is of the following form + +Syntax:: + + <type> [parameter Attrs] [name] + in the Function section is useful and it also documents that name is optional.>> I took a look at the "Identifiers" section [1]. There isn't any >> mention of the basic-block case there. > > "Unnamed temporaries are numbered sequentially (using a per-function > incrementing counter, starting with 0). Note that basic blocks are > included in this numbering. For example, if the entry basic block is > not given a label name, then it will get number 0."Oops, you're right I missed that.