Changeset 631
- Timestamp:
- 08/27/10 06:25:56 (14 years ago)
- Files:
-
- branches/dmd-1.x/src/s2ir.c (modified) (1 diff)
- trunk/src/s2ir.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dmd-1.x/src/s2ir.c
r618 r631 89 89 * Convert label to block. 90 90 */ 91 91 92 92 block *labelToBlock(Loc loc, Blockx *blx, LabelDsymbol *label, int flag = 0) 93 93 { 94 94 if (!label->statement) 95 95 { 96 96 error(loc, "undefined label %s", label->toChars()); 97 97 return NULL; 98 98 } 99 99 LabelStatement *s = label->statement; 100 100 if (!s->lblock) 101 101 { s->lblock = block_calloc(blx); 102 102 s->lblock->Btry = NULL; // fill this in later 103 103 104 104 if (flag) 105 105 { 106 106 // Keep track of the forward reference to this block, so we can check it later 107 107 if (!s->fwdrefs) 108 108 s->fwdrefs = new Array(); 109 s->fwdrefs->push( s->lblock);109 s->fwdrefs->push(blx->curblock); 110 110 } 111 111 } 112 112 return s->lblock; 113 113 } 114 114 115 115 /************************************** 116 116 * Add in code to increment usage count for linnum. 117 117 */ 118 118 119 119 void incUsage(IRState *irs, Loc loc) 120 120 { 121 121 122 122 if (global.params.cov && loc.linnum) 123 123 { 124 124 block_appendexp(irs->blx->curblock, incUsageElem(irs, loc)); 125 125 } 126 126 } 127 127 128 128 /**************************************** 129 129 * This should be overridden by each statement class. trunk/src/s2ir.c
r618 r631 87 87 * Convert label to block. 88 88 */ 89 89 90 90 block *labelToBlock(Loc loc, Blockx *blx, LabelDsymbol *label, int flag = 0) 91 91 { 92 92 if (!label->statement) 93 93 { 94 94 error(loc, "undefined label %s", label->toChars()); 95 95 return NULL; 96 96 } 97 97 LabelStatement *s = label->statement; 98 98 if (!s->lblock) 99 99 { s->lblock = block_calloc(blx); 100 100 s->lblock->Btry = NULL; // fill this in later 101 101 102 102 if (flag) 103 103 { 104 104 // Keep track of the forward reference to this block, so we can check it later 105 105 if (!s->fwdrefs) 106 106 s->fwdrefs = new Array(); 107 s->fwdrefs->push( s->lblock);107 s->fwdrefs->push(blx->curblock); 108 108 } 109 109 } 110 110 return s->lblock; 111 111 } 112 112 113 113 /************************************** 114 114 * Add in code to increment usage count for linnum. 115 115 */ 116 116 117 117 void incUsage(IRState *irs, Loc loc) 118 118 { 119 119 120 120 if (global.params.cov && loc.linnum) 121 121 { 122 122 block_appendexp(irs->blx->curblock, incUsageElem(irs, loc)); 123 123 } 124 124 } 125 125 126 126 /**************************************** 127 127 * This should be overridden by each statement class.
