Artifact 0f9b030c3ef302294eeacc4833cb1f5a3eae0c34:


0000: 43 61 6c 6c 2d 75 73 65 64 20 67 65 6e 65 72 61  Call-used genera
0010: 6c 2d 70 75 72 70 6f 73 65 2f 69 6e 74 65 67 65  l-purpose/intege
0020: 72 20 72 65 67 69 73 74 65 72 73 2c 20 6e 6f 74  r registers, not
0030: 20 69 6e 74 65 72 66 65 72 69 6e 67 20 77 69 74   interfering wit
0040: 68 20 61 72 67 20 72 65 67 69 73 74 65 72 73 3a  h arg registers:
0050: 0a 0a 67 72 65 70 20 43 41 4c 4c 5f 55 53 45 44  ..grep CALL_USED
0060: 20 69 6e 20 74 68 65 20 6d 61 63 68 69 6e 65 20   in the machine 
0070: 64 65 73 63 72 69 70 74 69 6f 6e 2e 0a 0a 43 6f  description...Co
0080: 6d 70 69 6c 65 20 74 68 65 20 73 6d 61 6c 6c 20  mpile the small 
0090: 70 72 6f 67 72 61 6d 3a 0a 65 78 74 65 72 6e 20  program:.extern 
00a0: 76 6f 69 64 2a 20 76 6f 6c 61 74 69 6c 65 20 78  void* volatile x
00b0: 3b 0a 65 78 74 65 72 6e 20 76 6f 69 64 2a 20 76  ;.extern void* v
00c0: 6f 6c 61 74 69 6c 65 20 79 3b 0a 69 6e 74 20 66  olatile y;.int f
00d0: 6f 6f 20 28 69 6e 74 20 61 30 2c 20 69 6e 74 20  oo (int a0, int 
00e0: 61 31 2c 20 69 6e 74 20 61 32 2c 20 69 6e 74 20  a1, int a2, int 
00f0: 61 33 2c 20 69 6e 74 20 61 34 2c 20 69 6e 74 20  a3, int a4, int 
0100: 61 35 2c 20 69 6e 74 20 61 36 2c 20 69 6e 74 20  a5, int a6, int 
0110: 61 37 29 0a 7b 20 76 6f 69 64 2a 20 61 20 3d 20  a7).{ void* a = 
0120: 78 3b 20 76 6f 69 64 2a 20 62 20 3d 20 79 3b 20  x; void* b = y; 
0130: 79 20 3d 20 61 3b 20 78 20 3d 20 62 3b 0a 20 20  y = a; x = b;.  
0140: 72 65 74 75 72 6e 20 61 30 2b 61 31 2b 61 32 2b  return a0+a1+a2+
0150: 61 33 2b 61 34 2b 61 35 2b 61 36 2b 61 37 3b 0a  a3+a4+a5+a6+a7;.
0160: 7d 0a 0a 41 6d 6f 6e 67 20 74 68 65 73 65 2c 20  }..Among these, 
0170: 77 65 20 63 61 6e 20 75 73 65 20 74 68 65 20 6c  we can use the l
0180: 65 78 69 63 61 6c 20 63 6c 6f 73 75 72 65 20 72  exical closure r
0190: 65 67 2c 20 62 65 63 61 75 73 65 20 5f 5f 76 61  eg, because __va
01a0: 63 61 6c 6c 5f 72 20 68 61 73 20 6e 6f 0a 6c 65  call_r has no.le
01b0: 78 69 63 61 6c 20 63 6c 6f 73 75 72 65 20 28 6d  xical closure (m
01c0: 6f 72 65 20 70 72 65 63 69 73 65 6c 79 2c 20 77  ore precisely, w
01d0: 65 20 61 72 65 20 62 75 69 6c 64 69 6e 67 20 61  e are building a
01e0: 20 6c 65 78 69 63 61 6c 20 63 6c 6f 73 75 72 65   lexical closure
01f0: 20 66 6f 72 20 69 74 29 2e 0a 0a 67 72 65 70 20   for it)...grep 
0200: 53 54 41 54 49 43 5f 43 48 41 49 4e 5f 52 45 47  STATIC_CHAIN_REG
0210: 4e 55 4d 20 61 6e 64 20 54 52 41 4d 50 4f 4c 49  NUM and TRAMPOLI
0220: 4e 45 5f 54 45 4d 50 4c 41 54 45 20 69 6e 20 74  NE_TEMPLATE in t
0230: 68 65 20 6d 61 63 68 69 6e 65 20 64 65 73 63 72  he machine descr
0240: 69 70 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 20 20  iption...       
0250: 20 20 20 20 20 4d 61 63 68 69 6e 65 20 64 65 73       Machine des
0260: 63 72 69 70 74 69 6f 6e 20 20 20 20 20 20 20 20  cription        
0270: 20 66 69 72 73 74 20 74 77 6f 20 28 61 2c 62 29   first two (a,b)
0280: 20 20 20 20 20 4c 65 78 69 63 61 6c 20 63 6c 6f       Lexical clo
0290: 73 75 72 65 20 72 65 67 0a 69 33 38 36 20 20 20  sure reg.i386   
02a0: 20 20 20 20 20 65 61 78 2c 65 64 78 2c 65 63 78       eax,edx,ecx
02b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
02c0: 20 65 61 78 2c 65 64 78 20 20 20 20 20 20 20 20   eax,edx        
02d0: 20 20 20 20 20 20 20 20 20 65 63 78 0a 6d 36 38           ecx.m68
02e0: 6b 20 20 20 20 20 20 20 20 64 30 2c 64 31 2c 61  k        d0,d1,a
02f0: 30 2c 61 31 20 20 20 20 20 20 20 20 20 20 20 20  0,a1            
0300: 20 20 20 20 20 64 30 2c 64 31 20 20 20 20 20 20       d0,d1      
0310: 20 20 20 20 20 20 20 20 20 20 20 20 20 61 30 0a               a0.
0320: 6d 69 70 73 20 20 20 20 20 20 20 20 72 32 2d 72  mips        r2-r
0330: 31 35 20 20 20 20 20 20 20 20 20 20 20 20 20 20  15              
0340: 20 20 20 20 20 20 20 20 24 32 3d 76 30 2c 24 33          $2=v0,$3
0350: 3d 76 31 2c 24 38 3d 74 30 20 20 20 20 20 20 20  =v1,$8=t0       
0360: 24 32 0a 73 70 61 72 63 20 20 20 20 20 20 20 67  $2.sparc       g
0370: 31 2d 67 34 20 20 20 20 20 20 20 20 20 20 20 20  1-g4            
0380: 20 20 20 20 20 20 20 20 20 20 20 67 31 2d 67 33             g1-g3
0390: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
03a0: 20 20 20 67 32 0a 73 70 61 72 63 36 34 20 20 20     g2.sparc64   
03b0: 20 20 67 31 2d 67 35 20 20 20 20 20 20 20 20 20    g1-g5         
03c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 67 31                g1
03d0: 2d 67 33 20 20 20 20 20 20 20 20 20 20 20 20 20  -g3             
03e0: 20 20 20 20 20 20 67 35 0a 61 6c 70 68 61 20 20        g5.alpha  
03f0: 20 20 20 20 20 24 30 2d 24 38 2c 24 32 32 2d 24       $0-$8,$22-$
0400: 32 35 2c 24 32 38 20 20 20 20 20 20 20 20 20 20  25,$28          
0410: 20 24 32 2c 24 31 20 20 20 20 20 20 20 20 20 20   $2,$1          
0420: 20 20 20 20 20 20 20 20 20 24 31 0a 68 70 70 61           $1.hppa
0430: 20 20 20 20 20 20 20 20 32 30 2d 32 32 2c 32 38          20-22,28
0440: 2d 32 39 20 20 20 20 20 20 20 20 20 20 20 20 20  -29             
0450: 20 20 20 20 72 31 39 2c 72 32 30 2c 72 32 31 2c      r19,r20,r21,
0460: 72 32 32 20 20 20 20 20 20 20 20 20 72 32 39 0a  r22         r29.
0470: 61 72 6d 20 20 20 20 20 20 20 20 20 72 31 32 3d  arm         r12=
0480: 69 70 20 20 20 20 20 20 20 20 20 20 20 20 20 20  ip              
0490: 20 20 20 20 20 20 20 20 72 30 2c 72 31 2c 72 33          r0,r1,r3
04a0: 2c 72 32 20 20 20 20 20 20 20 20 20 20 20 20 20  ,r2             
04b0: 72 31 32 20 28 21 29 0a 72 73 36 30 30 30 20 20  r12 (!).rs6000  
04c0: 20 20 20 20 30 2c 33 2d 31 32 20 20 20 20 20 20      0,3-12      
04d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
04e0: 30 2c 31 31 2c 31 32 20 20 20 20 20 20 20 20 20  0,11,12         
04f0: 20 20 20 20 20 20 20 20 31 31 0a 6d 38 38 6b 20          11.m88k 
0500: 20 20 20 20 20 20 20 31 30 2c 31 33 2c 31 31 28         10,13,11(
0510: 3f 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20  ?)              
0520: 20 20 20 72 31 30 2c 72 31 33 2c 72 31 31 2c 72     r10,r13,r11,r
0530: 31 32 20 20 20 20 20 20 20 20 20 72 31 31 0a 63  12         r11.c
0540: 6f 6e 76 65 78 20 20 20 20 20 20 73 30 2d 73 37  onvex      s0-s7
0550: 2c 61 31 2d 61 35 20 20 20 20 20 20 20 20 20 20  ,a1-a5          
0560: 20 20 20 20 20 20 20 73 31 2c 73 32 20 20 20 20         s1,s2    
0570: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73                 s
0580: 30 0a 69 61 36 34 20 20 20 20 20 20 20 20 72 31  0.ia64        r1
0590: 34 2d 72 33 31 2c 72 38 2d 72 31 31 20 20 20 20  4-r31,r8-r11    
05a0: 20 20 20 20 20 20 20 20 20 20 72 38 2c 72 31 34            r8,r14
05b0: 2c 72 31 35 2e 2e 2e 72 31 39 20 20 20 20 20 20  ,r15...r19      
05c0: 20 20 72 31 35 0a 78 38 36 5f 36 34 20 20 20 20    r15.x86_64    
05d0: 20 20 72 61 78 2c 72 64 78 2c 72 63 78 2c 72 73    rax,rdx,rcx,rs
05e0: 69 2c 72 64 69 2c 72 38 2d 72 31 35 20 20 72 61  i,rdi,r8-r15  ra
05f0: 78 2c 72 31 30 20 20 20 20 20 20 20 20 20 20 20  x,r10           
0600: 20 20 20 20 20 20 72 31 30 0a                          r10.