Non-allocatable Global Named Register
This patch implements global named registers in Clang, lowering to the just
created intrinsics in LLVM (@llvm.read/write_register). A new type of LValue
had to be created (Register), which just adds support to carry the metadata
node containing the name of the register. Two new methods to emit loads and
stores interoperate with another to emit the named metadata node.
No guarantees are being made and only non-allocatable global variable named
registers are being supported. Local named register support is unchanged.
This fixes "error: reference to local variable 'current_stack_pointer' declared in enclosing context", right?
I think there's more to sort out here. The Doxygen comments here clearly say that this function only works on variables with function scope, but clearly somebody is calling it on variables without checking if it has function scope. We also have a check for isFileVarDecl() above, further supporting this. Probably the right fix is to return false early if (!isLocalVarDecl()).