[M3devel] typenames vs. lexical scope vs. backend?
Rodney M. Bates
rodney_bates at lcwb.coop
Sun Oct 24 02:50:04 CEST 2010
No different from names of variables, formals, constants, or procedures.
I can't think why the backend would need them for code generation/optimization.
They do belong in debug info, however. This happens now for type names in
stabs+ debug output, although the encoding is a mess, and quite different
from variables, etc. m3gdb recognizes them in debug commands and applies
the usual scope rules in doing so. They can be used, e.g. in LOOPHOLE.
In a few cases, m3gdb will give you a bit of structural description of
a type, but often just fully qualifies the type name and repeats that.
When there are multiple names for the same (structurally) type, it is you may
get a synonym type name.
I suspect there is some internal backend tracing that would also benefit from
type names, as with variables, etc.
Jay K wrote:
> Um.. the same name can be different types, in different scopes.
>
>
> <*NOWARN*>PROCEDURE F1() =
> TYPE T1 = INTEGER;
> BEGIN
> END F1;
>
> <*NOWARN*>PROCEDURE F2() =
> TYPE T1 = LONGINT;
> BEGIN
> END F2;
>
> =>
>
> (16) declare_procedure name:Main__F1 n_params:0 return_type:void lev:0 exported:false
> (17) declare_typename my_id:0x195C2A74 name:T1
>
> (18) declare_procedure name:Main__F2 n_params:0 return_type:void lev:0 exported:false
> (19) declare_typename my_id:0x5562176 name:T1
> (20) comment comment:F1
> (21) set_source_line 6
>
> (22) begin_procedure procedure:Main__F1
> (23) set_source_line 7
> (24) set_source_line 9
> (25) exit_proc type:void
> (26) end_procedure procedure:Main__F1
>
> (27) comment comment:F2
> (28) set_source_line 0xB(11)
> (29) begin_procedure procedure:Main__F2
> (30) set_source_line 0xC(12)
> (31) set_source_line 0xE(14)
> (32) exit_proc type:void
> (33) end_procedure procedure:Main__F2
>
>
> Is the backend to record the types within some scope, and then observe
> the scopes coming back?
>
>
> Or, then again, are typenames worth much to the backend?
> Well, maybe.
> They aren't needed for display the values of variables,
> but they might be nice in expressions that include casts?
>
> I'm thinking maybe the right thing is to ignore them in the backend.
> ??
>
> - Jay
>
More information about the M3devel
mailing list