[PATCH] [DOC] LangRef: Clarify when index of temporaries begin at 0

Mikael Lyngvig mikael at lyngvig.org
Tue Nov 26 19:01:33 PST 2013

You're absolutely right (from the LR, I just searched):

  For example, if a function entry block does not have an explicit label,
it will be assigned label “%0”, then the first unnamed temporary in that
block will be “%1”, etc.

This is under Functions.  I guess anybody should get that far, but I
personally feel that the clarification I've submitted doesn't harm.

-- Mikael

2013/11/27 Sean Silva <silvas at purdue.edu>

> It is correct as written. Unnamed BB's are "unnamed temporaries" from a
> counting perspective. If the first BB is unlabeled, then it becomes %0. The
> first instruction then becomes %1, etc.
> I swear we mention that somewhere in LangRef (I seem to recall reviewing a
> patch mentioning that), but if not, a patch mentioning that would be fine.
> -- Sean Silva
> On Tue, Nov 26, 2013 at 8:50 PM, Mikael Lyngvig <mikael at lyngvig.org>wrote:
>> This patch adds the following sentence to the LR after it states that
>> temporaries begin at index 0:
>>    If you do not specify a label for the entry block, the temporaries
>> start at index 1 as index
>>    0 is then used for an implicit label generated by LLVM.
>> This because LLC complains when you use %0 as a temporary and there is no
>> entry point label in the function.  Then you get an error message, which
>> can be quite difficult to figure out why.
>> If this patch is rejected, somebody should probably phrase the above
>> appropriately and submit a new patch.
>> -- Mikael
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131127/b559988c/attachment.html>

More information about the llvm-commits mailing list