[cfe-dev] Named Registers Impl
Rafael EspĂndola
rafael.espindola at gmail.com
Wed May 7 09:33:48 PDT 2014
On 7 May 2014 10:02, Renato Golin <renato.golin at linaro.org> wrote:
> Folks,
>
> I started implementing the named registers in Clang and was presented
> with the nice fact that it's mostly there. At least, all the way to
> the AST is all good, but the IR emission, as expected, is still
> ignoring the register/asm part of the variable.
>
> So, the idea is to transform all reads from that variable to
> @llvm.read_register and all writes to @llvm.write_register. I can
> think of two ways of doing this:
>
> 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?
> 2. Down on CodeGenFunction::EmitDeclRefLValue(), using a previously
> set flag (isNamedReg), I replace the lowering of the variable (which
> was not initialised in CodeGenFunction::EmitAutoVarAlloca()) by
> EmitFunctionDeclLValue(intrinsic, etc). This will require no fiddling
> with the return values, but will pass down info until much later.
>
> Is there another way? If not, what is the preferred one?
>
> Thanks,
> --renato
More information about the cfe-dev
mailing list