boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

003-two-params.scm (584B)


      1 ;; tests/cc-cg/03-two-params.scm — Phase 1 milestone shape:
      2 ;; int main(int argc, char **argv) { return argc; }
      3 ;; Both params spill, but only argc is loaded for return.
      4 
      5 (let* ((cg     (cg-init))
      6        (cpp    (%ctype 'ptr 8 8 (%ctype 'ptr 8 8 %t-i8)))
      7        (params (cg-fn-begin cg "main"
      8                             (list (cons "argc" %t-i32)
      9                                   (cons "argv" cpp))
     10                             %t-i32))
     11        (argc*  (cdr (car params))))
     12   (cg-push-sym cg argc*)
     13   (cg-load cg)
     14   (cg-return cg)
     15   (cg-fn-end cg)
     16   (write-bv-fd 1 (cg-finish cg)))