<html><head></head><body><div class="yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div dir="ltr" data-setdir="false"><font face="verdana, helvetica, sans-serif" size="2">Hello all,</font></div><div dir="ltr" data-setdir="false"><font face="verdana, helvetica, sans-serif" size="2"><br></font></div><div dir="ltr" data-setdir="false"><font face="verdana, helvetica, sans-serif" size="2">Is it possible to assign specific physical register(s) to a 'special' global variable at the time of code generation phase in LLVM?</font></div><div dir="ltr" data-setdir="false"><font face="verdana, helvetica, sans-serif" size="2"><br></font></div><div dir="ltr" data-setdir="false"><font face="verdana, helvetica, sans-serif" size="2">Details: I have a Mips-like target and following Cpu0 tutorial, I added my custom backend to LLVM. I have a global variable that I want to use in many places in the program. I define a global variable in the program like, 'test.cpp' - 'int special;'</font></div><div dir="ltr" data-setdir="false"><font face="verdana, helvetica, sans-serif" size="2">I want to assign / allocate a specific physical register in my backend to this special global variable.</font></div><div dir="ltr" data-setdir="false"><font face="verdana, helvetica, sans-serif" size="2"><br></font></div><div dir="ltr" data-setdir="false"><font face="verdana, helvetica, sans-serif" size="2">Current status: Using 'llc -debug', I see that during the register allocation (greedy), the address of 'special' variable goes to a general purpose register and then it loads in a random general purpose register. </font></div><div dir="ltr" data-setdir="false"><font face="verdana, helvetica, sans-serif" size="2"><br></font></div><div dir="ltr" data-setdir="false"><font face="verdana, helvetica, sans-serif" size="2">I don't know if it is possible what I am trying to do? At which compilation stage should I try?</font></div><div dir="ltr" data-setdir="false"><font face="verdana, helvetica, sans-serif" size="2">I read somewhere that using 'register' keyword is not good idea.</font></div><div dir="ltr" data-setdir="false"><font face="verdana, helvetica, sans-serif" size="2"><br></font></div><div dir="ltr" data-setdir="false"><font face="verdana, helvetica, sans-serif" size="2">Thank you very much.</font></div><div dir="ltr" data-setdir="false"><font face="verdana, helvetica, sans-serif" size="2">Excuse my English.</font></div><div dir="ltr" data-setdir="false"><font face="verdana, helvetica, sans-serif" size="2">Please help!</font></div><div dir="ltr" data-setdir="false"><font face="verdana, helvetica, sans-serif" size="2"><br></font></div><div dir="ltr" data-setdir="false"><br></div></div></body></html>