LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 /* | 5 /* |
6 * portable half of code generator. | 6 * portable half of code generator. |
7 * mainly statements and control flow. | 7 * mainly statements and control flow. |
8 */ | 8 */ |
9 | 9 |
10 #include <u.h> | 10 #include <u.h> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 case ONAME: | 48 case ONAME: |
49 if(n == nodfp) | 49 if(n == nodfp) |
50 break; | 50 break; |
51 | 51 |
52 // if this is a tmpname (PAUTO), it was tagged by tmpname as not
escaping. | 52 // if this is a tmpname (PAUTO), it was tagged by tmpname as not
escaping. |
53 // on PPARAM it means something different. | 53 // on PPARAM it means something different. |
54 if(n->class == PAUTO && n->esc == EscNever) | 54 if(n->class == PAUTO && n->esc == EscNever) |
55 break; | 55 break; |
56 | 56 |
57 » » if(debug['s'] && n->esc != EscUnknown) | 57 » » if(debug['N'] && n->esc != EscUnknown) |
58 fatal("without escape analysis, only PAUTO's should have
esc: %N", n); | 58 fatal("without escape analysis, only PAUTO's should have
esc: %N", n); |
59 | 59 |
60 switch(n->class) { | 60 switch(n->class) { |
61 case PPARAMREF: | 61 case PPARAMREF: |
62 addrescapes(n->defn); | 62 addrescapes(n->defn); |
63 break; | 63 break; |
64 case PPARAM: | 64 case PPARAM: |
65 case PPARAMOUT: | 65 case PPARAMOUT: |
66 // if func param, need separate temporary | 66 // if func param, need separate temporary |
67 // to hold heap pointer. | 67 // to hold heap pointer. |
(...skipping 16 matching lines...) Expand all Loading... |
84 n->ullman = 2; | 84 n->ullman = 2; |
85 n->xoffset = 0; | 85 n->xoffset = 0; |
86 | 86 |
87 // create stack variable to hold pointer to heap | 87 // create stack variable to hold pointer to heap |
88 oldfn = curfn; | 88 oldfn = curfn; |
89 curfn = n->curfn; | 89 curfn = n->curfn; |
90 n->heapaddr = temp(ptrto(n->type)); | 90 n->heapaddr = temp(ptrto(n->type)); |
91 snprint(buf, sizeof buf, "&%S", n->sym); | 91 snprint(buf, sizeof buf, "&%S", n->sym); |
92 n->heapaddr->sym = lookup(buf); | 92 n->heapaddr->sym = lookup(buf); |
93 n->heapaddr->orig->sym = n->heapaddr->sym; | 93 n->heapaddr->orig->sym = n->heapaddr->sym; |
94 » » » if(!debug['s']) | 94 » » » if(!debug['N']) |
95 n->esc = EscHeap; | 95 n->esc = EscHeap; |
96 if(debug['m']) | 96 if(debug['m']) |
97 print("%L: moved to heap: %N\n", n->lineno, n); | 97 print("%L: moved to heap: %N\n", n->lineno, n); |
98 curfn = oldfn; | 98 curfn = oldfn; |
99 break; | 99 break; |
100 } | 100 } |
101 break; | 101 break; |
102 | 102 |
103 case OIND: | 103 case OIND: |
104 case ODOTPTR: | 104 case ODOTPTR: |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 | 821 |
822 Node* | 822 Node* |
823 temp(Type *t) | 823 temp(Type *t) |
824 { | 824 { |
825 Node *n; | 825 Node *n; |
826 ········ | 826 ········ |
827 n = nod(OXXX, N, N); | 827 n = nod(OXXX, N, N); |
828 tempname(n, t); | 828 tempname(n, t); |
829 return n; | 829 return n; |
830 } | 830 } |
LEFT | RIGHT |