[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Data structure documentation & BUG?
Hi,
> If I were to add information to the GSA tree, such as register allocations, etc.
> how should that be done? What happens to references to external memory (such
> as arrays, records, etc)?
operands and results (Data.Opnd, Data.Result) have a 'location' field with
the (abstract) type Data.Location. Data.Location should be extended in the
backend for different types of 'locations': stack, register, heap etc...
The frontend itself extends Data.Location - see Data.SymLocation - and
fills the location field of the operands of exit/collect and the results
of enter/reclaim with records of the Data.SymLocation. The location
fields for all other operands/results should be NIL (note that i think
if you enable --gsa-assign some 'debug' info is stored in some other
'location' fields). The backend storage/register-allocater should fill in
most of the NIL 'location' fields with ptr's to the extended Location
types.
References to external memory are modeled with the GSA instructions access*
and update* (see Opcode.Mod).
All the above is just what I've been able to understand - I'm hoping
Michael will correct me.
I've been trying to figure out the fastest way of putting together a
quick-and-*dirty*, _simple_ backend, just to gain a better understanding
of compilers, GSA, the OOC frontend, the 386, linux and life in general. ;-)
This backend will not have a register allocator (i think all the
386 instructions I need can operate directly on memory), nor a
peephole-optimizer. It will output GAS assembler and will have the bare
minimum instruction scheduling (ie: calling TopologicalOrder.Order
(its in the optimizers directory), followed by a traversal of the
GSA converting guards and merges to cmps,branches etc.. btw: whats the status
of TopologicalOrder.Mod - is it supposed to be complete? it seems to be
unused in the current version of the compiler)
I'm starting with the storage allocator for procedures. What I had in mind is:
For a procedures local-variables:
foreach instruction in the procedure's region
if the instruction is Legal() then:
foreach result of the current instruction
if result.useList # NIL then
allocate a location (ie: an object of a type that extends
Data.Location, eg: StackLocation)
foreach element in the result's useList, set it's location field to
the newly allocated location that we assigned for the current result.
At the moment Legal() is anything BUT enter,exit,reclaim,collect,an opcode
of the classes: classGuard or classMerge, create-store, delete-store.
Michael, is it true to say that in addition, we dont need to allocate locations
for:
a. any instructions which have the flag instrIsDisabled
b. any instructions which have $store as a result.
For a procedures parameters:
use Data.EnterInstr to find the 'enter' instruction.
traverse the enter's results (which are the procedures parameters) allocating
their locations (eg: at positive stack offsets) and traversing their useList's
like before.
Any comments?
More questions:
How do I get a list of the module's global variables,
from the symbol-table, or from the gsa? if from the symbol-table,
what about variables that are not used and not exported, must I check
for this myself? if from the gsa, do i need to maintain a list of
access/updates that refer to global variables or ...?
For access-var-param instructions, the operand seems to refer to the variable
itself. How do I access the location of the _address_ of the parameter
(which is a result of the 'enter' instruction)
> BUG? I tried compiling the Matrix.Mod example program and got a bus error exception
> in PrintGSA.Argument. Anyone else have this occur? Note: I was compiling with
> the --gsa -s flags.
I'm having problems with almost all modules i try to compile using
the last revision of ooc (with --gsa).
On other issues:
Is it possible to expand the range of allowed parameters to HALT?
I'm not sure what the language specification reads about this, but
for compatibility with other Oberon implementations it should
be possible to specify negative numbers and 0 (actually, i just
remembered this would be needed for the proposed exception mechanism,
so i guess it was coming anyway)
I think there might be an error in line 146 of oo2c.Mod in the new release.
it seems to read: IF (a = x) & (a = y) ...
Has anyone tried to compile ooc with the free native-code linux GPO compiler?
I'm going to try, perhaps this will bring out bugs in ooc/o2c/gpo (gcc is
so very tedious to wait for)
Thanks,
Guy