@@ -55,13 +55,16 @@ enum LONGMASK = 0xFFFFFFFF;
5555enum LLONGMASK = 0xFFFFFFFFFFFFFFFFL ;
5656enum ZEROLL = 0L ;
5757
58- private __gshared
58+ struct CgElem
5959{
60+ Symbol* hdiff;
61+ tym_t global_tyf;
6062 bool again;
6163 bool topair;
62- tym_t global_tyf;
6364}
6465
66+ __gshared CgElem cgel;
67+
6568private bool cnst (const elem* e) { return e.Eoper == OPconst; }
6669
6770/* ****************************
976979 {
977980 e.E2 = el_selecte1(e2);
978981 e.Eoper = OPmin;
979- again = 1 ;
982+ cgel. again = true ;
980983 return e;
981984 }
982985 // Replace (-v + e) with (e + -v)
@@ -1022,7 +1025,7 @@ L1:
10221025 e.E1 .Ety = e1.Ety;
10231026 }
10241027 }
1025- again = 1 ;
1028+ cgel. again = true ;
10261029 return e;
10271030 }
10281031 // Replace (e + e) with (e * 2)
@@ -1032,7 +1035,7 @@ L1:
10321035 e.Eoper = OPmul;
10331036 el_free(e2);
10341037 e.E2 = el_long(e1.Ety,2 );
1035- again = 1 ;
1038+ cgel. again = true ;
10361039 return e;
10371040 }
10381041
@@ -1123,7 +1126,7 @@ private elem* elmul(elem* e, Goal goal)
11231126 e1.Eoper = OPmul;
11241127 e.E2 = el_bin(OPmul,tym,e1.E2 ,e2);
11251128 e1.E2 = el_copytree(e2);
1126- again = 1 ;
1129+ cgel. again = true ;
11271130 return e;
11281131 }
11291132
@@ -1132,7 +1135,7 @@ private elem* elmul(elem* e, Goal goal)
11321135 {
11331136 e2.Vullong *= cast (targ_ullong)1 << el_tolong(e1.E2 );
11341137 e1.E2 .Vullong = 0 ;
1135- again = 1 ;
1138+ cgel. again = true ;
11361139 return e;
11371140 }
11381141 }
@@ -1154,7 +1157,7 @@ private elem* elmul(elem* e, Goal goal)
11541157 e2.Ety = TYint;
11551158 e.Eoper = (e.Eoper == OPmul) /* convert to shift left */
11561159 ? OPshl : OPshlass;
1157- again = 1 ;
1160+ cgel. again = true ;
11581161 return e;
11591162 }
11601163 else if (el_allbits(e2,- 1 ) && (e.Eoper == OPmul || useNegass))
@@ -1172,7 +1175,7 @@ Lneg:
11721175 ? OPneg : OPnegass;
11731176 el_free(e.E2 );
11741177 e.E2 = null ;
1175- again = 1 ;
1178+ cgel. again = true ;
11761179 return e;
11771180}
11781181
@@ -1311,20 +1314,19 @@ private elem* elmin(elem* e, Goal goal)
13111314
13121315 if (I16 && tybasic(e2.Ety) == TYhptr && tybasic(e.E1 .Ety) == TYhptr)
13131316 { // Convert to _aNahdiff(e1,e2)
1314- __gshared Symbol* hdiff;
1315- if (! hdiff)
1317+ if (! cgel.hdiff)
13161318 {
13171319 Symbol* s = symbol_calloc(LARGECODE ? " _aFahdiff" : " _aNahdiff" );
13181320 s.Stype = tsclib;
13191321 s.Sclass = SC .extern_;
13201322 s.Sfl = FL .func;
13211323 s.Ssymnum = 0 ;
13221324 s.Sregsaved = mBX|mCX|mSI|mDI|mBP|mES;
1323- hdiff = s;
1325+ cgel. hdiff = s;
13241326 }
13251327 e.Eoper = OPcall;
13261328 e.E2 = el_bin(OPparam,TYint,e2,e.E1 );
1327- e.E1 = el_var(hdiff);
1329+ e.E1 = el_var(cgel. hdiff);
13281330 return e;
13291331 }
13301332
@@ -2570,7 +2572,7 @@ L2:
25702572 }
25712573 }
25722574Lret:
2573- again = changes != 0 ;
2575+ cgel. again = changes != 0 ;
25742576 return e;
25752577}
25762578
@@ -3357,13 +3359,13 @@ private elem* elind(elem* e, Goal goal)
33573359 e.Ety = tym;
33583360 e.E2 = el_una(OPind,tym,e.E2 );
33593361 e.E2 .ET = t;
3360- again = 1 ;
3362+ cgel. again = true ;
33613363 return e;
33623364
33633365 default :
33643366 break ;
33653367 }
3366- topair |= (config.fpxmmregs && tycomplex(tym));
3368+ cgel. topair |= (config.fpxmmregs && tycomplex(tym));
33673369 return e;
33683370}
33693371
@@ -3578,7 +3580,7 @@ elem* elstruct(elem* e, Goal goal)
35783580 tym_t tym = ~ 0 ;
35793581 tym_t ty = tybasic(t.Tty);
35803582
3581- uint sz = (e.Eoper == OPstrpar && type_zeroSize(t, global_tyf)) ? 0 : cast (uint )type_size(t);
3583+ uint sz = (e.Eoper == OPstrpar && type_zeroSize(t, cgel. global_tyf)) ? 0 : cast (uint )type_size(t);
35823584 // printf("\tsz = %d\n", cast(int)sz);
35833585
35843586 type* targ1 = null ;
@@ -3742,7 +3744,7 @@ elem* elstruct(elem* e, Goal goal)
37423744 {
37433745 e.Eoper = OPcomma;
37443746 e = optelem(e, Goal.value);
3745- again = 1 ;
3747+ cgel. again = true ;
37463748 }
37473749 else
37483750 goto Ldefault;
@@ -5057,7 +5059,7 @@ private elem* ellngsht(elem* e, Goal goal)
50575059 }
50585060 e1.Ety = ty;
50595061 e = el_selecte1(e);
5060- again = 1 ;
5062+ cgel. again = true ;
50615063 return e;
50625064 }
50635065 break ;
@@ -5948,10 +5950,10 @@ beg:
59485950 elem* e1 = e.E1 = optelem(e.E1 , leftgoal);
59495951
59505952 // Need argument to type_zeroSize()
5951- const tyf_save = global_tyf;
5952- global_tyf = tyf;
5953+ const tyf_save = cgel. global_tyf;
5954+ cgel. global_tyf = tyf;
59535955 elem* e2 = e.E2 = optelem(e.E2 , rightgoal);
5954- global_tyf = tyf_save;
5956+ cgel. global_tyf = tyf_save;
59555957
59565958 if (! e1)
59575959 {
@@ -6321,17 +6323,17 @@ elem* doptelem(elem* e, Goal goal)
63216323{
63226324 // printf("doptelem(e = %p, goal = x%x)\n", e, goal);
63236325 do
6324- { again = false ;
6325- topair = false ;
6326+ { cgel. again = false ;
6327+ cgel. topair = false ;
63266328 e = optelem(e,goal & (Goal.flags | Goal.value | Goal.none));
6327- } while (again && goal & Goal.again && e);
6329+ } while (cgel. again && goal & Goal.again && e);
63286330
63296331 /* If entire expression is a struct, and we can replace it with */
63306332 /* something simpler, do so. */
63316333 if (goal & Goal.struct_ && e && (tybasic(e.Ety) == TYstruct || tybasic(e.Ety) == TYarray))
63326334 e = elstruct(e, goal);
63336335
6334- if (topair && e)
6336+ if (cgel. topair && e)
63356337 e = elToPair(e);
63366338
63376339 return e;
0 commit comments