boot2

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

011-global-var.scm (357B)


      1 ;; tests/cc-cg/11-global-var.scm — emit a global int with no initializer (.bss),
      2 ;; then a function that reads it.
      3 
      4 (let* ((cg  (cg-init))
      5        (g   (%sym "g" 'var 'static %t-i32 #f)))
      6   (cg-emit-global cg g #f)
      7   (cg-fn-begin cg "main" '() %t-i32)
      8   (cg-push-sym cg g)
      9   (cg-load cg)
     10   (cg-return cg)
     11   (cg-fn-end cg)
     12   (write-bv-fd 1 (cg-finish cg)))