X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fdocs%2Fcomm%2Fthe-beast%2Fncg.html;h=2b2d2fce7d2dc422789ab80beb97d8fea77379ba;hb=773fe27f9c8873a8ea51c04b380088acb6f8fe02;hp=cfef91975b185db6f6139e2d4402762891410d00;hpb=a8a87fbe0980850234563e62ef751a0f5e8b36d5;p=ghc-hetmet.git diff --git a/ghc/docs/comm/the-beast/ncg.html b/ghc/docs/comm/the-beast/ncg.html index cfef919..2b2d2fc 100644 --- a/ghc/docs/comm/the-beast/ncg.html +++ b/ghc/docs/comm/the-beast/ncg.html @@ -96,6 +96,29 @@ implement on all targets, and their meaning is intended to be unambiguous, and the same on all targets, regardless of word size or endianness. +

+ A note on MagicIds. + Those which are assigned to + registers on the current target are left unmodified. Those + which are not are stored in memory as offsets from + BaseReg (which is assumed to permanently have the + value (&MainCapability.r)), so the constant folder + calculates the offsets and inserts suitable loads/stores. One + complication is that not all archs have BaseReg + itself in a register, so for those (sparc), we instead + generate the address as an offset from the static symbol + MainCapability, since the register table lives in + there. +

+ Finally, BaseReg does occasionally itself get + mentioned in Stix expression trees, and in this case what is + denoted is precisely (&MainCapability.r), not, as + in all other cases, the value of memory at some offset from + the start of the register table. Since what it denotes is an + r-value and not an l-value, assigning BaseReg is + meaningless, so the machinery checks to ensure this never + happens. All these details are taken into account by the + constant folder.

  • Instruction selection. This is the only majorly target-specific phase. It turns Stix statements and