Skip to content

Commit

Permalink
unix: Add asm statements needed to read registers with clang. Code ge…
Browse files Browse the repository at this point in the history
…nerated by gcc 4.9.0 is unchanged (same statements, different order).

Both are inefficient, saving unmodified registers on the stack.
  • Loading branch information
Anton-2 committed May 12, 2014
1 parent 1b901c3 commit ceac71f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions unix/gccollect.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,17 @@ typedef machine_uint_t regs_t[6];

void gc_helper_get_regs(regs_t arr) {
register long rbx asm ("rbx");
asm("" : "=r"(rbx));
register long rbp asm ("rbp");
asm("" : "=r"(rbp));
register long r12 asm ("r12");
asm("" : "=r"(r12));
register long r13 asm ("r13");
asm("" : "=r"(r13));
register long r14 asm ("r14");
asm("" : "=r"(r14));
register long r15 asm ("r15");
asm("" : "=r"(r15));
arr[0] = rbx;
arr[1] = rbp;
arr[2] = r12;
Expand Down

0 comments on commit ceac71f

Please sign in to comment.