@@ -1105,13 +1105,13 @@ float emitter::insEvaluateExecutionCost(instrDesc* id)
1105
1105
assert (throughput > 0.0 );
1106
1106
assert (latency >= 0.0 );
1107
1107
1108
- if (( memAccessKind == PERFSCORE_MEMORY_WRITE) && (latency <= PERFSCORE_LATENCY_WR_GENERAL) )
1108
+ if (memAccessKind == PERFSCORE_MEMORY_WRITE)
1109
1109
{
1110
- // We assume that we won't read back from memory for any writes
1111
- // Thus we don 't pay latency costs for writes.
1112
- latency = 0.0 ;
1110
+ // We assume that we won't read back from memory for the next WR_GENERAL (3) cycles
1111
+ // Thus we normally won 't pay latency costs for writes.
1112
+ latency = max ( 0 . 0f , latency - PERFSCORE_LATENCY_WR_GENERAL) ;
1113
1113
}
1114
- if (latency >= 1.0 )
1114
+ else if (latency >= 1.0 ) // Otherwise, If we aren't performing a memory write
1115
1115
{
1116
1116
// We assume that the processor's speculation will typically eliminate one cycle of latency
1117
1117
//
@@ -2376,7 +2376,8 @@ void* emitter::emitAddLabel(VARSET_VALARG_TP GCvars, regMaskTP gcrefRegs, regMas
2376
2376
#if defined(DEBUG) || defined(LATE_DISASM)
2377
2377
else
2378
2378
{
2379
- emitCurIG->igWeight = getCurrentBlockWeight ();
2379
+ emitCurIG->igWeight = getCurrentBlockWeight ();
2380
+ emitCurIG->igPerfScore = 0.0 ;
2380
2381
}
2381
2382
#endif
2382
2383
@@ -3289,7 +3290,12 @@ void emitter::emitDispIG(insGroup* ig, insGroup* igPrev, bool verbose)
3289
3290
}
3290
3291
else
3291
3292
{
3292
- printf (" offs=%06XH, size=%04XH, bbWeight=%s" , ig->igOffs , ig->igSize , refCntWtd2str (ig->igWeight ));
3293
+ printf (" offs=%06XH, size=%04XH" , ig->igOffs , ig->igSize );
3294
+
3295
+ if (emitComp->compCodeGenDone )
3296
+ {
3297
+ printf (" , bbWeight=%s PerfScore %.2f" , refCntWtd2str (ig->igWeight ), ig->igPerfScore );
3298
+ }
3293
3299
3294
3300
if (ig->igFlags & IGF_GC_VARS)
3295
3301
{
@@ -3415,7 +3421,9 @@ size_t emitter::emitIssue1Instr(insGroup* ig, instrDesc* id, BYTE** dp)
3415
3421
#if defined(DEBUG) || defined(LATE_DISASM)
3416
3422
float insExeCost = insEvaluateExecutionCost (id);
3417
3423
// All compPerfScore calculations must be performed using doubles
3418
- emitComp->info .compPerfScore += (double )(ig->igWeight / (double )BB_UNITY_WEIGHT) * insExeCost;
3424
+ double insPerfScore = (double )(ig->igWeight / (double )BB_UNITY_WEIGHT) * insExeCost;
3425
+ emitComp->info .compPerfScore += insPerfScore;
3426
+ ig->igPerfScore += insPerfScore;
3419
3427
#endif // defined(DEBUG) || defined(LATE_DISASM)
3420
3428
3421
3429
// printf("[S=%02u]\n", emitCurStackLvl);
@@ -4841,7 +4849,6 @@ unsigned emitter::emitEndCodeGen(Compiler* comp,
4841
4849
instrDesc* id = (instrDesc*)ig->igData ;
4842
4850
4843
4851
#ifdef DEBUG
4844
-
4845
4852
/* Print the IG label, but only if it is a branch label */
4846
4853
4847
4854
if (emitComp->opts .disAsm || emitComp->opts .dspEmit || emitComp->verbose )
@@ -4853,17 +4860,9 @@ unsigned emitter::emitEndCodeGen(Compiler* comp,
4853
4860
}
4854
4861
else
4855
4862
{
4856
- printf (" \n G_M%03u_IG%02u:" , Compiler::s_compMethodsCount, ig->igNum );
4857
-
4858
- // Display the block weight, but only when it isn't the standard BB_UNITY_WEIGHT
4859
- if (ig->igWeight != BB_UNITY_WEIGHT)
4860
- {
4861
- printf (" \t\t ;; bbWeight=%s" , refCntWtd2str (ig->igWeight ));
4862
- }
4863
- printf (" \n " );
4863
+ printf (" \n G_M%03u_IG%02u:\n " , Compiler::s_compMethodsCount, ig->igNum );
4864
4864
}
4865
4865
}
4866
-
4867
4866
#endif // DEBUG
4868
4867
4869
4868
BYTE* bp = cp;
@@ -4952,6 +4951,13 @@ unsigned emitter::emitEndCodeGen(Compiler* comp,
4952
4951
castto (id, BYTE*) += emitIssue1Instr (ig, id, &cp);
4953
4952
}
4954
4953
4954
+ #ifdef DEBUG
4955
+ if (emitComp->opts .disAsm || emitComp->opts .dspEmit || emitComp->verbose )
4956
+ {
4957
+ printf (" \t\t\t\t\t\t ;; bbWeight=%s PerfScore %.2f" , refCntWtd2str (ig->igWeight ), ig->igPerfScore );
4958
+ }
4959
+ #endif // DEBUG
4960
+
4955
4961
emitCurIG = nullptr ;
4956
4962
4957
4963
assert (ig->igSize >= cp - bp);
@@ -6846,7 +6852,8 @@ insGroup* emitter::emitAllocIG()
6846
6852
#endif
6847
6853
6848
6854
#if defined(DEBUG) || defined(LATE_DISASM)
6849
- ig->igWeight = getCurrentBlockWeight ();
6855
+ ig->igWeight = getCurrentBlockWeight ();
6856
+ ig->igPerfScore = 0.0 ;
6850
6857
#endif
6851
6858
6852
6859
#if EMITTER_STATS
0 commit comments