1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-16 13:18:12 +01:00

(rotate_gr): Take advantage of "cfm" cache.

(rotate_fr): Ditto.
(pr_ltop): Ditto.
(pr_ptol): Ditto.

(Logical change 1.42)
This commit is contained in:
mostang.com!davidm 2003-01-23 18:47:51 +00:00
parent 0fe74701c5
commit 8bff7ccc92

View file

@ -7,16 +7,11 @@ static inline int
rotate_gr (struct cursor *c, int reg) rotate_gr (struct cursor *c, int reg)
{ {
unsigned int rrb_gr, sor, sof; unsigned int rrb_gr, sor, sof;
unw_word_t cfm; int preg;
int preg, ret;
ret = ia64_get (c, c->cfm_loc, &cfm); sof = (c->cfm & 0x7f);
if (ret < 0) sor = 8 * ((c->cfm >> 14) & 0xf);
return ret; rrb_gr = (c->cfm >> 18) & 0x7f;
sof = (cfm & 0x7f);
sor = 8 * ((cfm >> 14) & 0xf);
rrb_gr = (cfm >> 18) & 0x7f;
if ((unsigned) (reg - 32) > sof) if ((unsigned) (reg - 32) > sof)
return -1; /* not a valid stacked register number */ return -1; /* not a valid stacked register number */
@ -28,8 +23,8 @@ rotate_gr (struct cursor *c, int reg)
if (preg > 32 + sor) if (preg > 32 + sor)
preg -= sor; /* wrap around */ preg -= sor; /* wrap around */
} }
debug (100, "%s: sor=%u rrb.gr=%u, r%d -> r%d\n", __FUNCTION__, sor, rrb_gr, debug (100, "%s: sor=%u rrb.gr=%u, r%d -> r%d\n",
reg, preg); __FUNCTION__, sor, rrb_gr, reg, preg);
return preg; return preg;
} }
@ -40,14 +35,9 @@ static inline int
rotate_fr (struct cursor *c, int reg) rotate_fr (struct cursor *c, int reg)
{ {
unsigned int rrb_fr; unsigned int rrb_fr;
unw_word_t cfm; int preg;
int preg, ret;
ret = ia64_get (c, c->cfm_loc, &cfm); rrb_fr = (c->cfm >> 25) & 0x7f;
if (ret < 0)
return ret;
rrb_fr = (cfm >> 25) & 0x7f;
if (reg < 32) if (reg < 32)
preg = reg; /* register not part of the rotating partition */ preg = reg; /* register not part of the rotating partition */
else else
@ -65,14 +55,9 @@ rotate_fr (struct cursor *c, int reg)
static inline unw_word_t static inline unw_word_t
pr_ltop (struct cursor *c, unw_word_t pr) pr_ltop (struct cursor *c, unw_word_t pr)
{ {
unw_word_t rrb_pr, mask, rot, cfm; unw_word_t rrb_pr, mask, rot;
int ret;
ret = ia64_get (c, c->cfm_loc, &cfm); rrb_pr = (c->cfm >> 32) & 0x3f;
if (ret < 0)
return ret;
rrb_pr = (cfm >> 32) & 0x3f;
rot = pr >> 16; rot = pr >> 16;
mask = ((unw_word_t) 1 << rrb_pr) - 1; mask = ((unw_word_t) 1 << rrb_pr) - 1;
rot = ((pr & mask) << (48 - rrb_pr)) | ((pr >> rrb_pr) & mask); rot = ((pr & mask) << (48 - rrb_pr)) | ((pr >> rrb_pr) & mask);
@ -84,14 +69,9 @@ pr_ltop (struct cursor *c, unw_word_t pr)
static inline unw_word_t static inline unw_word_t
pr_ptol (struct cursor *c, unw_word_t pr) pr_ptol (struct cursor *c, unw_word_t pr)
{ {
unw_word_t rrb_pr, mask, rot, cfm; unw_word_t rrb_pr, mask, rot;
int ret;
ret = ia64_get (c, c->cfm_loc, &cfm); rrb_pr = 48 - ((c->cfm >> 32) & 0x3f);
if (ret < 0)
return ret;
rrb_pr = 48 - ((cfm >> 32) & 0x3f);
rot = pr >> 16; rot = pr >> 16;
mask = ((unw_word_t) 1 << rrb_pr) - 1; mask = ((unw_word_t) 1 << rrb_pr) - 1;
rot = ((pr & mask) << (48 - rrb_pr)) | ((pr >> rrb_pr) & mask); rot = ((pr & mask) << (48 - rrb_pr)) | ((pr >> rrb_pr) & mask);