<div dir="ltr">Please don't make VarDecl ~4 bytes bigger just to support a rarely used gnu extension.<div><br></div><div>I think it might be better to model the asm blob as an initializer, which would save space and fix your tentative definition problems.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 9, 2014 at 4:29 AM, Renato Golin <span dir="ltr"><<a href="mailto:renato.golin@linaro.org" target="_blank">renato.golin@linaro.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Rafael,<br>
<br>
I'm going down the route of marking the variable declaration as "named<br>
register" in SemaDecl (ActOnVariableDeclarator) and then adding the<br>
intrinsic at the initialization time.<br>
<br>
Since it has no explicit initializer, it ends up in the<br>
TentativeDefinitions array, which gets initialized in<br>
ActOnEndOfTranslationUnit. But that's not what I want, since this<br>
"variable" doesn't exist, per se, but I still need to keep it around<br>
for replacing all reads/writes by an intrinsic.<br>
<br>
Also, while parsing statements that contain a reference to this<br>
variable, the diagnostics on the use of the global variable detect an<br>
"undeclared local variable":<br>
<br>
named_reg_global.c:4:10: error: reference to local variable<br>
'current_stack_pointer' declared in enclosing context<br>
  return current_stack_pointer;<br>
named_reg_global.c:1:24: note: 'current_stack_pointer' declared here<br>
register unsigned long current_stack_pointer asm("sp");<br>
<br>
This looks like I'm not setting the right flags beforehand, so that<br>
ParseStatement recognizes it's not a local variable, or just that I<br>
still haven't found the right place to do the substitution.<br>
<br>
ParseStatementOrDeclarationAfterAttributes has a switch with<br>
"identifier" in it, but that doesn't seem a specific enough place to<br>
add this logic. Any pointers?<br>
<br>
The changes I made to stop marking the declaration invalid and to mark<br>
it as "named register" is attached. Not that this would be the final<br>
patch, but it's helping me understand the code.<br>
<br>
cheers,<br>
--renato<br>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>