[cfe-dev] Named Registers Impl

Renato Golin renato.golin at linaro.org
Wed May 7 10:08:37 PDT 2014


On 7 May 2014 17:33, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
>> 1. On Sema::ActOnVariableDeclarator(), on the switch detecting named
>> register variables, I set the initialization to a call to the
>> intrinsic. That's pretty high level, but it's where we diagnose bad
>> register names and where we have most of the information we need. Some
>> fiddling with the return value will be necessary.
>
> This will call the intrinsic only once, which is incorrect, no?

Hum, I hadn't thought that through, you're right. We'll need two
intrinsics, one for reads, other for writes, plus we need it on every
read/write, not just on initialization.

The second option did look better. Though, I need to make sure that
it'll work on any read/write, and the code was a bit confusing at
start (I'm getting the hang of it now, I think).

AFAICS, EmitDeclRefLValue() will emit the declaration for setting an
LValue (so writes TO the register), but not reading it, which is
spread around many places (like EmitReturnDecl, Expressions and so
on). We need to make sure sub-expressions that contain a register
variable don't get touched before the variables are lowered to the
intrinsic call.

--renato

cheers,
--renato




More information about the cfe-dev mailing list