9 years ago
9 years ago


(Reporter: graydon, Unassigned)





9 years ago
The current implementation of Trans involves a lot of knowledge of the Il. The Il is somewhat more low-level than LLVM's term language, to which we eventually wish to move. A step towards that end (along with probably merging layout and referent_type calculations, see bug 541561) would be making a richer Emitter interface -- say a record full of helper functions, or possibly an ocaml module -- that abstracts many of the concrete operations and types in the IL a bit, up a level to the LLVM style.

In particular: address calculations need to be hidden. The existing Il makes Trans far too aware of addressing modes, and requires a lot of referent_ty casting and explicit address calculation to work right. An abstract emitter interface with an operation more like LLVM's GetElementPtr to move from address to address would probably be much cleaner.

A similar requirement exists around encoding calls. Trans knows a lot about the stack layout of arguments flowing into and out of each call. It needs to be made less-aware of this.

This bug will involve a number of patches and will be hard to clearly mark as "done" until there's a working LLVM-based implementation of this hypothetical abstract-Emitter module/structure, but it's something we can address in steps. Make notes here as progress is made.

Comment 1

9 years ago
Basic GEP workalike landed in 72800ca7b3e2. Pleasingly tidy! So far only a single call site, still buckets of manual address arithmetic in trans.

Comment 2

9 years ago
GEP is now used extensively in trans, we have an LLVM backend (lltrans) in progress, and we've got a module for sharing code between the two. What abstraction there can be is arising naturally by moving trans code to transutil and parameterizing it as we go; closing this bug as too-vague to otherwise determine 'completion' of.
Last Resolved: 9 years ago
Resolution: --- → FIXED
Group: servo
You need to log in before you can comment on or make changes to this bug.