bug-mes
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

porting efforts


From: Gabriel Wicki
Subject: porting efforts
Date: Wed, 8 Dec 2021 14:23:22 +0100

Hi there!

I did not actually intend to write such a huge email, but here we are.
Not all questions raised here have to be answered, i'm sure i can find
my way with the right pointers.  But i seem to lack a good bunch of
experience with x86 assembly and need some insight into MEScc design
decisions.

As you may or may not know i'm in the process of porting MEScc for
RISC-V as part of my bachelor thesis (yay).


My point of reference is module/mescc/i386/as.scm


Where/how exactly is the mapping between NYACC's output and the
procedures in as.scm happening?  I'm unable to find references to
xor-zf et al in the codebase (except in arch specific as.scm).


The `info' argument (to almost every procedure) is a piece of output from
NYACC -- right?


What are (e->x) and (e->l) used for (i do understand /what/ they do)?


Is (* 4 n) - which appears a bunch of times in as.scm  - used for word-
alignment?


Why is this very same s-expr negated (- 0 (* 4 n)) i.e. in local-add,
local->r, et al.?


Are i386:r-negate and i386:zf->r identical?  Is one of them obsolete?


What's the comparison with the magic number #x80 used for?  Is this some
kind of type-check?


What is 0x32 (in local-add and others)? Is it offset decimal 50?


What do the following mean/do (i wrote my guesses so you may just reply
with yes if they are correct):

 - r-mem-add, r-byte-mem-add, r-word-mem-add :: directly add to a value
   in memory?
 - local-ptr->r :: load pointer (from stack) to register?
 - label-r :: load label-address (from stack) to register?
 - movzbl :: zero-extend a byte to long?
 - byte-mem->r :: load a byte from memory to a register
 - byte-r, byte-signed-r, word-r, word-signed-r :: load byte/word into
   register?
 - byte-r0->r1-mem :: save the content in r0 to the address in r1?
 - local-add :: add immediate directly in memory? what are n and v?
 - local-mem-add :: add immediate to memory location at label?
 - swap-r0-r1 :: swap the contents of two registers? what is this used
   for?
 - r0*r1 :: simple multiplication?
 - r0/r1 :: simple division?



The RISC-V port might need to go a bit more in-depth than previous ones,
mostly due to the non-"standard" architecture (more registers, no
flags).  The question remains if i should just dedicate a register or
two for zero- and carry-flags or if the operations should just work
entirely differently -- instead of setting a zero flag somewhere in code
and then eventually do a jump-z the RISC-V way is to simply BEQZ (branch
if equal to zero).


Quarters, Eurocents or really tiny fractions of digital currencies for
your thoughts!

Gabriel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]