[M3devel] backend interface vs. types vs. forward references?
Jay K
jay.krell at cornell.edu
Sun Oct 3 14:47:41 CEST 2010
It appears that due to e.g.
TYPE Pointer = REF Record;
TYPE Record = RECORD
Next: Pointer;
END;
it is possible for the backend to get type declarations "out of order".
There being no "correct" order, no order without forward references.
It says declare_indirect(Pointer) before declare_record(Record).
I'm not sure of this exact example, but it does occur.
Currently fields are implicitly within the "current" record.
I think in order to break these cycles, declare_field should contain the uid of their record.
And then we should forward declare all records.
Then indirects to them.
Then their fields.
I'm not sure that solves the general case or not though.
More generally we might want to use this pattern also for objects and proctypes.
It's also likely I can solve this in the backend alone, by running more passes
until everything is resolved.
I keep thinking to myself that I might have to build up in memory
a very faithful rendition of the m3cg calls and iterate over it,
before making the gcc trees.
?
- Jay
More information about the M3devel
mailing list