hey Herbert, I generally start with looking at the primops.cmm file for examples https://github.com/ghc/ghc/blob/master/rts/PrimOps.cmm#L572-L588
otoh, the comments in cmmparse.y indicate that's not quite "kosher"? or maybe the comments are a lie? https://github.com/ghc/ghc/blob/master/compiler/cmm/CmmParse.y#L24-L28 On Sat, Jan 4, 2014 at 6:26 PM, Herbert Valerio Riedel <[email protected]> wrote: > Hello, > > According to Note [Syntax of .cmm files], > > | There are two ways to write .cmm code: > | > | (1) High-level Cmm code delegates the stack handling to GHC, and > | never explicitly mentions Sp or registers. > | > | (2) Low-level Cmm manages the stack itself, and must know about > | calling conventions. > | > | Whether you want high-level or low-level Cmm is indicated by the > | presence of an argument list on a procedure. > > However, while working on integer-gmp I've been noticing in > integer-gmp/cbits/gmp-wrappers.cmm that even though all Cmm procedures > have been converted to high-level Cmm, they still reference the 'Sp' > register, e.g. > > > #define GMP_TAKE1_RET1(name,mp_fun) \ > name (W_ ws1, P_ d1) \ > { \ > W_ mp_tmp1; \ > W_ mp_result1; \ > \ > again: \ > STK_CHK_GEN_N (2 * SIZEOF_MP_INT); \ > MAYBE_GC(again); \ > \ > mp_tmp1 = Sp - 1 * SIZEOF_MP_INT; \ > mp_result1 = Sp - 2 * SIZEOF_MP_INT; \ > ... \ > > > So is this valid high-level Cmm code? What's the proper way to allocate > Stack (and/or Heap) memory from high-level Cmm code? > > Cheers, > hvr > _______________________________________________ > ghc-devs mailing list > [email protected] > http://www.haskell.org/mailman/listinfo/ghc-devs >
_______________________________________________ ghc-devs mailing list [email protected] http://www.haskell.org/mailman/listinfo/ghc-devs
