I'm getting my register stomped on in the following code:

  .sub _bogus
          set $P1, $P0[0]
          find_lex $P2, "x"
          newsub $P3, .Sub, _bogus
          .pcc_begin prototyped
          .arg $P1
          .pcc_call $P3
  after_call:
          .pcc_end
  .end

This get converted to:

  _bogus:
          set P16, P16[0] 
          find_lex P16, "x" 
          newsub P17, 35, _bogus 
  #pcc_sub_call_5:
          set P5, P16 
          set P0, P17 
          set I0, 1 
          set I1, 0 
          set I2, 1 
          set I3, 0 
          savetop  
          invokecc  
  after_call:
          restoretop  

Notice that both $P1 and $P2 get equated with P16. I unfortunately
haven't figured out how to understand imcc's debugging output well
enough to know what's going on. Perhaps it could be related to the
fact that $P2 is never used? But $P1 is, and so I'd rather it didn't
get overwritten.

If I change 'find_lex $P2, "x"' to 'set $P2, "x"', then the problem
goes away.

>From the .ops files:

  op find_lex(out PMC, in STR) {
  inline op set(in PMC, in STR) {

so maybe that change does more than I was thinking. Lemme go look for
another out param... ah, here we go:

  inline op getstdin(out PMC) {

okay, so if I change it to 'getstdin $P2' then the problem doesn't
happen.

Color me confused,
Steve

Reply via email to