[LLVMdev] Named Register Implementation

Renato Golin renato.golin at linaro.org
Sat Mar 29 05:14:56 PDT 2014


On 29 March 2014 01:16, Jeremy Lakeman <Jeremy.Lakeman at gmail.com> wrote:
> Should that be something like;
>
> declare void @llvm.write_register.sp(i32 val)
> declare i32 @llvm.read_register.sp()

There are two problems with that:

1. Front-ends have to know all registers that are supported by all
LLVM back-ends for that functionality. If the overloading is
target-independent but language-dependent, it makes sense. But
especially in this case, where we'll implement the feature in multiple
steps, it'll be very complicated to coordinate all parts.

2. I'd have to create one multiclass for the intrinsic TableGen
pattern for each supported architecture. Given that Intrinsics.td is
largely (if not completely) target independent, I'd hate to start a
pattern that should be done in the first place.

Your argument against adding a global string variable or a metadata
node is valid, this is why my first proposal is to use the string
directly from the asm() construct.

However, if your argument is to use register.sp as "the stack
pointer", that would make front-ends understand which register is the
stack pointer on each backend, which is something I don't think they
should do.

cheers,
--renato



More information about the llvm-dev mailing list