CACAO
Macros | Functions
simplereg.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_NAME   "simplereg"
 
#define SIZE_OF_STACKSLOT   8
 
#define TOTAL_REG_CNT   (INT_REG_CNT + FLT_REG_CNT)
 
#define AVAIL_FRONT(cnt, limit)   (!opt_RegallocSpillAll && ((cnt) < (limit)))
 
#define AVAIL_BACK(cnt)   (!opt_RegallocSpillAll && ((cnt) > 0))
 
#define AVAIL_FRONT_INT(cnt, limit)   AVAIL_FRONT(cnt, limit)
 
#define AVAIL_BACK_INT(cnt)   AVAIL_BACK(cnt)
 
#define POP_FRONT(stk, cnt, reg)   do { reg = stk[cnt++]; } while (0)
 
#define POP_BACK(stk, cnt, reg)   do { reg = stk[--cnt]; } while (0)
 
#define PUSH_FRONT(stk, cnt, reg)   do { stk[--cnt] = (reg); } while (0)
 
#define PUSH_BACK(stk, cnt, reg)   do { stk[cnt++] = (reg); } while (0)
 
#define POP_FRONT_INT(stk, cnt, reg)   POP_FRONT(stk, cnt, reg)
 
#define POP_BACK_INT(stk, cnt, reg)   POP_BACK(stk, cnt, reg)
 
#define PUSH_BACK_INT(stk, cnt, reg)   PUSH_BACK(stk, cnt, reg)
 
#define AVAIL_ARG_FLT   AVAIL_FRONT(rd->argfltreguse, FLT_ARG_CNT)
 
#define AVAIL_TMP_FLT   AVAIL_BACK(rd->tmpfltreguse)
 
#define AVAIL_SAV_FLT   AVAIL_BACK(rd->savfltreguse)
 
#define AVAIL_ARG_ADR   AVAIL_FRONT(rd->argadrreguse, ADR_ARG_CNT)
 
#define AVAIL_TMP_ADR   AVAIL_BACK(rd->tmpadrreguse)
 
#define AVAIL_SAV_ADR   AVAIL_BACK(rd->savadrreguse)
 
#define AVAIL_ARG_INT   AVAIL_FRONT_INT(rd->argintreguse, INT_ARG_CNT)
 
#define AVAIL_TMP_INT   AVAIL_BACK_INT(rd->tmpintreguse)
 
#define AVAIL_SAV_INT   AVAIL_BACK_INT(rd->savintreguse)
 
#define AVAIL_FREE_ARG_FLT   AVAIL_BACK(rd->freeargflttop)
 
#define AVAIL_FREE_TMP_FLT   AVAIL_BACK(rd->freetmpflttop)
 
#define AVAIL_FREE_SAV_FLT   AVAIL_BACK(rd->freesavflttop)
 
#define AVAIL_FREE_ARG_ADR   AVAIL_BACK(rd->freeargadrtop)
 
#define AVAIL_FREE_TMP_ADR   AVAIL_BACK(rd->freetmpadrtop)
 
#define AVAIL_FREE_SAV_ADR   AVAIL_BACK(rd->freesavadrtop)
 
#define AVAIL_FREE_ARG_INT   AVAIL_BACK_INT(rd->freearginttop)
 
#define AVAIL_FREE_TMP_INT   AVAIL_BACK_INT(rd->freetmpinttop)
 
#define AVAIL_FREE_SAV_INT   AVAIL_BACK_INT(rd->freesavinttop)
 
#define TAKE_ARG_FLT(r)   POP_FRONT(abi_registers_float_argument, rd->argfltreguse, r)
 
#define TAKE_TMP_FLT(r)   POP_BACK(rd->tmpfltregs, rd->tmpfltreguse, r)
 
#define TAKE_SAV_FLT(r)   POP_BACK(rd->savfltregs, rd->savfltreguse, r)
 
#define TAKE_ARG_ADR(r)   POP_FRONT(rd->argadrregs, rd->argadrreguse, r)
 
#define TAKE_TMP_ADR(r)   POP_BACK(rd->tmpadrregs, rd->tmpadrreguse, r)
 
#define TAKE_SAV_ADR(r)   POP_BACK(rd->savadrregs, rd->savadrreguse, r)
 
#define TAKE_ARG_INT(r)   POP_FRONT_INT(abi_registers_integer_argument, rd->argintreguse, r)
 
#define TAKE_TMP_INT(r)   POP_BACK_INT(rd->tmpintregs, rd->tmpintreguse, r)
 
#define TAKE_SAV_INT(r)   POP_BACK_INT(rd->savintregs, rd->savintreguse, r)
 
#define TAKE_FREE_ARG_FLT(r)   POP_BACK(rd->freeargfltregs, rd->freeargflttop, r)
 
#define TAKE_FREE_TMP_FLT(r)   POP_BACK(rd->freetmpfltregs, rd->freetmpflttop, r)
 
#define TAKE_FREE_SAV_FLT(r)   POP_BACK(rd->freesavfltregs, rd->freesavflttop, r)
 
#define TAKE_FREE_ARG_ADR(r)   POP_BACK(rd->freeargadrregs, rd->freeargadrtop, r)
 
#define TAKE_FREE_TMP_ADR(r)   POP_BACK(rd->freetmpadrregs, rd->freetmpadrtop, r)
 
#define TAKE_FREE_SAV_ADR(r)   POP_BACK(rd->freesavadrregs, rd->freesavadrtop, r)
 
#define TAKE_FREE_ARG_INT(r)   POP_BACK_INT(rd->freeargintregs, rd->freearginttop, r)
 
#define TAKE_FREE_TMP_INT(r)   POP_BACK_INT(rd->freetmpintregs, rd->freetmpinttop, r)
 
#define TAKE_FREE_SAV_INT(r)   POP_BACK_INT(rd->freesavintregs, rd->freesavinttop, r)
 
#define PUSH_FREE_ARG_FLT(r)   PUSH_BACK(rd->freeargfltregs, rd->freeargflttop, r)
 
#define PUSH_FREE_TMP_FLT(r)   PUSH_BACK(rd->freetmpfltregs, rd->freetmpflttop, r)
 
#define PUSH_FREE_SAV_FLT(r)   PUSH_BACK(rd->freesavfltregs, rd->freesavflttop, r)
 
#define PUSH_FREE_ARG_ADR(r)   PUSH_BACK(rd->freeargadrregs, rd->freeargadrtop, r)
 
#define PUSH_FREE_TMP_ADR(r)   PUSH_BACK(rd->freetmpadrregs, rd->freetmpadrtop, r)
 
#define PUSH_FREE_SAV_ADR(r)   PUSH_BACK(rd->freesavadrregs, rd->freesavadrtop, r)
 
#define PUSH_FREE_ARG_INT(r)   PUSH_BACK_INT(rd->freeargintregs, rd->freearginttop, r)
 
#define PUSH_FREE_TMP_INT(r)   PUSH_BACK_INT(rd->freetmpintregs, rd->freetmpinttop, r)
 
#define PUSH_FREE_SAV_INT(r)   PUSH_BACK_INT(rd->freesavintregs, rd->freesavinttop, r)
 
#define NEW_MEM_SLOT(r)
 
#define NEW_MEM_SLOT_INT_LNG(r)   NEW_MEM_SLOT(r)
 
#define NEW_MEM_SLOT_FLT_DBL(r)   NEW_MEM_SLOT(r)
 
#define NEW_MEM_SLOT_REUSE_PADDING(r)   NEW_MEM_SLOT(r)
 
#define NEW_TEMP_REG(index)
 
#define FREE_TEMP_REG(index)
 
#define REG_INDEX(regoff, type)   (IS_FLT_DBL_TYPE(type) ? (INT_REG_CNT + (regoff)) : (regoff))
 

Functions

static void simplereg_allocate_interfaces (jitdata *jd)
 
static void simplereg_allocate_locals (jitdata *jd)
 
static void simplereg_allocate_temporaries (jitdata *jd)
 
bool regalloc (jitdata *jd)
 
static void simplereg_allocate_locals_leafmethod (jitdata *jd)
 
static void simplereg_init (jitdata *jd, registerdata *rd)
 
static void simplereg_init_block (registerdata *rd)
 
static void simplereg_new_temp (jitdata *jd, s4 index)
 
static void simplereg_free (registerdata *rd, s4 flags, s4 regoff, s4 type)
 
static void simplereg_free_temp (jitdata *jd, s4 index)
 
static bool simplereg_alloc_dup (jitdata *jd, s4 srcindex, s4 dstindex)
 

Macro Definition Documentation

#define AVAIL_ARG_ADR   AVAIL_FRONT(rd->argadrreguse, ADR_ARG_CNT)

Definition at line 163 of file simplereg.cpp.

#define AVAIL_ARG_FLT   AVAIL_FRONT(rd->argfltreguse, FLT_ARG_CNT)

Definition at line 159 of file simplereg.cpp.

#define AVAIL_ARG_INT   AVAIL_FRONT_INT(rd->argintreguse, INT_ARG_CNT)

Definition at line 167 of file simplereg.cpp.

#define AVAIL_BACK (   cnt)    (!opt_RegallocSpillAll && ((cnt) > 0))

Definition at line 92 of file simplereg.cpp.

#define AVAIL_BACK_INT (   cnt)    AVAIL_BACK(cnt)

Definition at line 108 of file simplereg.cpp.

#define AVAIL_FREE_ARG_ADR   AVAIL_BACK(rd->freeargadrtop)

Definition at line 175 of file simplereg.cpp.

#define AVAIL_FREE_ARG_FLT   AVAIL_BACK(rd->freeargflttop)

Definition at line 171 of file simplereg.cpp.

#define AVAIL_FREE_ARG_INT   AVAIL_BACK_INT(rd->freearginttop)

Definition at line 179 of file simplereg.cpp.

#define AVAIL_FREE_SAV_ADR   AVAIL_BACK(rd->freesavadrtop)

Definition at line 177 of file simplereg.cpp.

#define AVAIL_FREE_SAV_FLT   AVAIL_BACK(rd->freesavflttop)

Definition at line 173 of file simplereg.cpp.

#define AVAIL_FREE_SAV_INT   AVAIL_BACK_INT(rd->freesavinttop)

Definition at line 181 of file simplereg.cpp.

#define AVAIL_FREE_TMP_ADR   AVAIL_BACK(rd->freetmpadrtop)

Definition at line 176 of file simplereg.cpp.

#define AVAIL_FREE_TMP_FLT   AVAIL_BACK(rd->freetmpflttop)

Definition at line 172 of file simplereg.cpp.

#define AVAIL_FREE_TMP_INT   AVAIL_BACK_INT(rd->freetmpinttop)

Definition at line 180 of file simplereg.cpp.

#define AVAIL_FRONT (   cnt,
  limit 
)    (!opt_RegallocSpillAll && ((cnt) < (limit)))

Definition at line 91 of file simplereg.cpp.

#define AVAIL_FRONT_INT (   cnt,
  limit 
)    AVAIL_FRONT(cnt, limit)

Definition at line 107 of file simplereg.cpp.

#define AVAIL_SAV_ADR   AVAIL_BACK(rd->savadrreguse)

Definition at line 165 of file simplereg.cpp.

#define AVAIL_SAV_FLT   AVAIL_BACK(rd->savfltreguse)

Definition at line 161 of file simplereg.cpp.

#define AVAIL_SAV_INT   AVAIL_BACK_INT(rd->savintreguse)

Definition at line 169 of file simplereg.cpp.

#define AVAIL_TMP_ADR   AVAIL_BACK(rd->tmpadrreguse)

Definition at line 164 of file simplereg.cpp.

#define AVAIL_TMP_FLT   AVAIL_BACK(rd->tmpfltreguse)

Definition at line 160 of file simplereg.cpp.

#define AVAIL_TMP_INT   AVAIL_BACK_INT(rd->tmpintreguse)

Definition at line 168 of file simplereg.cpp.

#define DEBUG_NAME   "simplereg"

Definition at line 55 of file simplereg.cpp.

#define FREE_TEMP_REG (   index)
Value:
if (((index) > jd->localcount) \
&& (!(VAR(index)->flags & (PREALLOC)))) \
std::size_t index
static void simplereg_free_temp(jitdata *jd, s4 index)
Definition: simplereg.cpp:1014
#define VAR(i)
Definition: jit.hpp:252

Definition at line 241 of file simplereg.cpp.

#define NEW_MEM_SLOT (   r)
Value:
do { \
(r) = rd->memuse * SIZE_OF_STACKSLOT; \
rd->memuse += 1; \
} while (0)
#define SIZE_OF_STACKSLOT
Definition: simplereg.cpp:80

Definition at line 222 of file simplereg.cpp.

#define NEW_MEM_SLOT_FLT_DBL (   r)    NEW_MEM_SLOT(r)

Definition at line 229 of file simplereg.cpp.

#define NEW_MEM_SLOT_INT_LNG (   r)    NEW_MEM_SLOT(r)

Definition at line 228 of file simplereg.cpp.

#define NEW_MEM_SLOT_REUSE_PADDING (   r)    NEW_MEM_SLOT(r)

Definition at line 230 of file simplereg.cpp.

#define NEW_TEMP_REG (   index)
Value:
if ( ((index) >= jd->localcount) \
&& (!(VAR(index)->flags & (INOUT | PREALLOC))) ) \
static void simplereg_new_temp(jitdata *jd, s4 index)
Definition: simplereg.cpp:816
std::size_t index
Definition: stack.hpp:46
#define VAR(i)
Definition: jit.hpp:252

Definition at line 235 of file simplereg.cpp.

#define POP_BACK (   stk,
  cnt,
  reg 
)    do { reg = stk[--cnt]; } while (0)

Definition at line 112 of file simplereg.cpp.

#define POP_BACK_INT (   stk,
  cnt,
  reg 
)    POP_BACK(stk, cnt, reg)

Definition at line 141 of file simplereg.cpp.

#define POP_FRONT (   stk,
  cnt,
  reg 
)    do { reg = stk[cnt++]; } while (0)

Definition at line 111 of file simplereg.cpp.

#define POP_FRONT_INT (   stk,
  cnt,
  reg 
)    POP_FRONT(stk, cnt, reg)

Definition at line 127 of file simplereg.cpp.

#define PUSH_BACK (   stk,
  cnt,
  reg 
)    do { stk[cnt++] = (reg); } while (0)

Definition at line 114 of file simplereg.cpp.

#define PUSH_BACK_INT (   stk,
  cnt,
  reg 
)    PUSH_BACK(stk, cnt, reg)

Definition at line 156 of file simplereg.cpp.

#define PUSH_FREE_ARG_ADR (   r)    PUSH_BACK(rd->freeargadrregs, rd->freeargadrtop, r)

Definition at line 211 of file simplereg.cpp.

#define PUSH_FREE_ARG_FLT (   r)    PUSH_BACK(rd->freeargfltregs, rd->freeargflttop, r)

Definition at line 207 of file simplereg.cpp.

#define PUSH_FREE_ARG_INT (   r)    PUSH_BACK_INT(rd->freeargintregs, rd->freearginttop, r)

Definition at line 215 of file simplereg.cpp.

#define PUSH_FREE_SAV_ADR (   r)    PUSH_BACK(rd->freesavadrregs, rd->freesavadrtop, r)

Definition at line 213 of file simplereg.cpp.

#define PUSH_FREE_SAV_FLT (   r)    PUSH_BACK(rd->freesavfltregs, rd->freesavflttop, r)

Definition at line 209 of file simplereg.cpp.

#define PUSH_FREE_SAV_INT (   r)    PUSH_BACK_INT(rd->freesavintregs, rd->freesavinttop, r)

Definition at line 217 of file simplereg.cpp.

#define PUSH_FREE_TMP_ADR (   r)    PUSH_BACK(rd->freetmpadrregs, rd->freetmpadrtop, r)

Definition at line 212 of file simplereg.cpp.

#define PUSH_FREE_TMP_FLT (   r)    PUSH_BACK(rd->freetmpfltregs, rd->freetmpflttop, r)

Definition at line 208 of file simplereg.cpp.

#define PUSH_FREE_TMP_INT (   r)    PUSH_BACK_INT(rd->freetmpintregs, rd->freetmpinttop, r)

Definition at line 216 of file simplereg.cpp.

#define PUSH_FRONT (   stk,
  cnt,
  reg 
)    do { stk[--cnt] = (reg); } while (0)

Definition at line 113 of file simplereg.cpp.

#define REG_INDEX (   regoff,
  type 
)    (IS_FLT_DBL_TYPE(type) ? (INT_REG_CNT + (regoff)) : (regoff))

Definition at line 252 of file simplereg.cpp.

#define SIZE_OF_STACKSLOT   8

Definition at line 80 of file simplereg.cpp.

#define TAKE_ARG_ADR (   r)    POP_FRONT(rd->argadrregs, rd->argadrreguse, r)

Definition at line 187 of file simplereg.cpp.

#define TAKE_ARG_FLT (   r)    POP_FRONT(abi_registers_float_argument, rd->argfltreguse, r)

Definition at line 183 of file simplereg.cpp.

#define TAKE_ARG_INT (   r)    POP_FRONT_INT(abi_registers_integer_argument, rd->argintreguse, r)

Definition at line 191 of file simplereg.cpp.

#define TAKE_FREE_ARG_ADR (   r)    POP_BACK(rd->freeargadrregs, rd->freeargadrtop, r)

Definition at line 199 of file simplereg.cpp.

#define TAKE_FREE_ARG_FLT (   r)    POP_BACK(rd->freeargfltregs, rd->freeargflttop, r)

Definition at line 195 of file simplereg.cpp.

#define TAKE_FREE_ARG_INT (   r)    POP_BACK_INT(rd->freeargintregs, rd->freearginttop, r)

Definition at line 203 of file simplereg.cpp.

#define TAKE_FREE_SAV_ADR (   r)    POP_BACK(rd->freesavadrregs, rd->freesavadrtop, r)

Definition at line 201 of file simplereg.cpp.

#define TAKE_FREE_SAV_FLT (   r)    POP_BACK(rd->freesavfltregs, rd->freesavflttop, r)

Definition at line 197 of file simplereg.cpp.

#define TAKE_FREE_SAV_INT (   r)    POP_BACK_INT(rd->freesavintregs, rd->freesavinttop, r)

Definition at line 205 of file simplereg.cpp.

#define TAKE_FREE_TMP_ADR (   r)    POP_BACK(rd->freetmpadrregs, rd->freetmpadrtop, r)

Definition at line 200 of file simplereg.cpp.

#define TAKE_FREE_TMP_FLT (   r)    POP_BACK(rd->freetmpfltregs, rd->freetmpflttop, r)

Definition at line 196 of file simplereg.cpp.

#define TAKE_FREE_TMP_INT (   r)    POP_BACK_INT(rd->freetmpintregs, rd->freetmpinttop, r)

Definition at line 204 of file simplereg.cpp.

#define TAKE_SAV_ADR (   r)    POP_BACK(rd->savadrregs, rd->savadrreguse, r)

Definition at line 189 of file simplereg.cpp.

#define TAKE_SAV_FLT (   r)    POP_BACK(rd->savfltregs, rd->savfltreguse, r)

Definition at line 185 of file simplereg.cpp.

#define TAKE_SAV_INT (   r)    POP_BACK_INT(rd->savintregs, rd->savintreguse, r)

Definition at line 193 of file simplereg.cpp.

#define TAKE_TMP_ADR (   r)    POP_BACK(rd->tmpadrregs, rd->tmpadrreguse, r)

Definition at line 188 of file simplereg.cpp.

#define TAKE_TMP_FLT (   r)    POP_BACK(rd->tmpfltregs, rd->tmpfltreguse, r)

Definition at line 184 of file simplereg.cpp.

#define TAKE_TMP_INT (   r)    POP_BACK_INT(rd->tmpintregs, rd->tmpintreguse, r)

Definition at line 192 of file simplereg.cpp.

#define TOTAL_REG_CNT   (INT_REG_CNT + FLT_REG_CNT)

Definition at line 85 of file simplereg.cpp.

Function Documentation

bool regalloc ( jitdata jd)

Definition at line 262 of file simplereg.cpp.

static bool simplereg_alloc_dup ( jitdata jd,
s4  srcindex,
s4  dstindex 
)
static

Definition at line 1024 of file simplereg.cpp.

static void simplereg_allocate_interfaces ( jitdata jd)
static

Definition at line 288 of file simplereg.cpp.

static void simplereg_allocate_locals ( jitdata jd)
static

Definition at line 643 of file simplereg.cpp.

static void simplereg_allocate_locals_leafmethod ( jitdata jd)
static

Definition at line 495 of file simplereg.cpp.

static void simplereg_allocate_temporaries ( jitdata jd)
static

Definition at line 1069 of file simplereg.cpp.

static void simplereg_free ( registerdata rd,
s4  flags,
s4  regoff,
s4  type 
)
static

Definition at line 937 of file simplereg.cpp.

static void simplereg_free_temp ( jitdata jd,
s4  index 
)
inlinestatic

Definition at line 1014 of file simplereg.cpp.

static void simplereg_init ( jitdata jd,
registerdata rd 
)
static

Definition at line 736 of file simplereg.cpp.

static void simplereg_init_block ( registerdata rd)
static

Definition at line 782 of file simplereg.cpp.

static void simplereg_new_temp ( jitdata jd,
s4  index 
)
static

Definition at line 816 of file simplereg.cpp.