[cfe-dev] A question on register allocation

Viswesh Narayanan via cfe-dev cfe-dev at lists.llvm.org
Sat Oct 3 23:44:55 PDT 2015


My use case is to store a global value permanently in a register (say
xmm15) using LLVM

The following piece of code works as expected in GCC while it is not
supported in LLVM. It complains with "fatal error: error in backend:
Invalid register name global variable".

Can any expert here provide me a solution to this in Clang/LLVM?

Code:
#include <stdio.h>
volatile register int A asm ("xmm15");
int main() {
    A = 100;
    return A;
}



More information about the cfe-dev mailing list