2011/3/5 Ian Lance Taylor <iant@xxxxxxxxxx>: > Xiaofeng <dolphin.feng@xxxxxxx> writes: > >> Does this mean we cannot obtain the scope information using the current framwork of gcc? > > You can get some sorts of scope information, but there is no clean > mapping to the instruction stream. The instructions for different > scopes are not properly nested. > >> Can we obtain this information from RTL? > > No, but you can look at the debug info. > > Ian > Because our exsiting assembler requires this scope information in the assembler code. For example (I mentioned this yesterday): source code: 1:void main() 2:{ 3: int i=1; 4: if (i>1) 5: { 6: i=2; 7: if(i == 2) 8: { 9: i=i+1; 10: i=3; 11: } 12: i=i-1; 13: } 14: i=i+1; 15:} -----> assemeber code for statement 6, 7, and 9: scope 2 ------------------------ we want to add this "scope" information line 6 -- .LM3: | MOV A,2 | MOV Y+1,A |- for statement 6 MOV A,2 | MOV Y+1,A -- line 7 -- .LM4: |- for statement 7 .... -- scope 3 ---------------------- we want to add this "scope" information line 9 -- .LM5: | INC Y+1 |- for statement 9 SZ [0AH].2 | INC Y+1 -- Can you give us any suggestions on how to implement this, since gcc has not this information ready. Thank you very much Stephen