kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

arm32_emit_temp_pressure.c (821B)


      1 /* Keep many scalar values live while emitting three-operand arithmetic. ARM32
      2  * allocates the values in r4-r11; the native emitter must satisfy spill-heavy
      3  * operands from its explicit r0-r3 temp bank without borrowing IP/LR or
      4  * exposing those temporaries in MIR. */
      5 long arm32_emit_temp_pressure(long s) {
      6   long a = s + 1, b = s + 2, c = s + 3, d = s + 4;
      7   long e = s + 5, f = s + 6, g = s + 7, h = s + 8;
      8   long i = s + 9, j = s + 10, k = s + 11, l = s + 12;
      9   long m = s + 13, n = s + 14, o = s + 15, p = s + 16;
     10   long products = a * b + c * d + e * f + g * h + i * j + k * l + m * n + o * p;
     11   long differences =
     12       a - b + c - d + e - f + g - h + i - j + k - l + m - n + o - p;
     13   long bits = a ^ b ^ c ^ d ^ e ^ f ^ g ^ h ^ i ^ j ^ k ^ l ^ m ^ n ^ o ^ p;
     14   return products + differences + bits + a + p;
     15 }