Changeset 522 for Deliverables/D4.1

Feb 15, 2011, 4:42:15 PM (10 years ago)

completed changes to discussion on labels and pseudoinstructions

1 edited


  • Deliverables/D4.1/ITP-Paper/itp-2011.tex

    r521 r522  
    291 % Compare to SDCC assembly
    292 % Need labels for separate compilation, should we implement it at a later date
    293 % Discuss Move instruction more, and labels for the GLOBALS
    295 As part of the CerCo project, a prototype compiler was being developed in parallel with the emulator.
    296 Easing the design of the compiler was a key objective in implementing the emulator.
    297 For this reason, we introduced notion of \emph{pseudoinstruction} and \emph{label}.
    299 The MCS-51's instruction set has numerous instructions for unconditional and conditional jumps to memory locations, calling procedures and moving data between memory spaces.
     291Aside from implementing the core MCS-51 instruction set, we also implemented \emph{pseudoinstructions} and \emph{labels}.
     292Introducing pseudoinstructions had the effect of simplifying a C compiler---another component of the CerCo project---that was being implemented in parallel with our implementation.
     293To understand why this is so, consider the fact that the MCS-51's instruction set has numerous instructions for unconditional and conditional jumps to memory locations.
    300294For instance, the instructions \texttt{AJMP}, \texttt{JMP} and \texttt{LJMP} all perform unconditional jumps.
    301295However, these instructions differ in how large the maximum size of the offset of the jump to be performed can be.
    302 Further, all jump instructions require a concrete memory address, to jump to, to be specified.
     296Further, all jump instructions require a concrete memory address---to jump to---to be specified.
    303297Requiring the compiler to compute these offsets, and select appropriate jump instructions, was seen as needleslly burdensome.
    305 Instead, we introduced generic \texttt{Jump}, \texttt{Call} and \texttt{Move} instructions.
    306 These are expanded into MCS-51 assembly instructions with an assembly phase, prior to program execution.
    307 Further, we introduced a notion of label (represented by strings), and introduced pseudoinstructions that allow conditional jumps to jump to labels.
    308 These are also removed during the assembly phase, and replaced by concrete memory addresses and offsets.
     299Introducing labels also had a simplifying effect on the design of the compiler.
     300Instead of jumping to a concrete address, the compiler could `just' jump to a label.
     301In this vein, we introduced pseudoinstructions for both unconditional and conditional jumps to a label.
     303Further, we also introduced labels for storing global data in a preamble before the program.
     304A pseudoinstruction \texttt{Mov} moves (16-bit) data stored at a label into the (16-bit) register \texttt{DPTR}.
     305We believe this facility, of storing global data in a preamble referenced by a label, will also make any future extension considering separate compilation much simpler.
     307Our pseudoinstructions and labels induce an assembly language similar to that of SDCC.
     308All pseudoinstructions and labels are `assembled away', prior to program execution, using a preprocessing stage.
     309Jumps are computed in two stages.
     310The first stage builds a map associating memory addresses to labels, with the second stage removing pseudojumps with concrete jumps to the correct address.
    333335One peculiarity is the packing of the 24 combined SFRs into fixed length vectors.
    334336This was due to a bug in Matita when we were constructing the emulator, since fixed, where the time needed to typecheck a record grew exponentially with the number of fields.
    494 % Cost labels
     494The CerCo approach to inducing a cost model necessitates the introduction of \emph{cost labels}.
Note: See TracChangeset for help on using the changeset viewer.