@@ -685,6 +685,28 @@ void emitter::emitGenIG(insGroup* ig)
685
685
emitCurIGfreeEndp = emitCurIGfreeBase + emitIGbuffSize;
686
686
}
687
687
688
+ /* ****************************************************************************
689
+ *
690
+ * Add a new IG to the current list, and get it ready to receive code.
691
+ */
692
+
693
+ void emitter::emitNewIG ()
694
+ {
695
+ insGroup* ig = emitAllocAndLinkIG ();
696
+
697
+ /* It's linked in. Now, set it up to accept code */
698
+
699
+ emitGenIG (ig);
700
+
701
+ #ifdef DEBUG
702
+ if (emitComp->verbose )
703
+ {
704
+ printf (" Created:\n " );
705
+ emitDispIG (ig, nullptr , /* displayInstructions */ false , /* displayLocation */ false );
706
+ }
707
+ #endif // DEBUG
708
+ }
709
+
688
710
/* ****************************************************************************
689
711
*
690
712
* Finish and save the current IG.
@@ -850,20 +872,17 @@ insGroup* emitter::emitSavIG(bool emitAdd)
850
872
#ifdef DEBUG
851
873
if (emitComp->opts .dspCode )
852
874
{
853
- printf (" \n %s:" , emitLabelString (ig));
854
875
if (emitComp->verbose )
855
876
{
856
- printf (" ; offs=%06XH, funclet=%02u, bbWeight=%s" , ig->igOffs , ig->igFuncIdx ,
857
- refCntWtd2str (ig->igWeight ));
858
- emitDispIGflags (ig->igFlags );
877
+ printf (" Saved:\n " );
878
+ emitDispIG (ig, nullptr , /* displayInstructions */ false , /* displayLocation */ false );
859
879
}
860
880
else
861
881
{
862
- printf (" ; funclet=%02u" , ig->igFuncIdx );
882
+ printf (" %s: ; funclet=%02u\n " , emitLabelString (ig) , ig->igFuncIdx );
863
883
}
864
- printf (" \n " );
865
884
}
866
- #endif
885
+ #endif // DEBUG
867
886
868
887
#if FEATURE_LOOP_ALIGN
869
888
// Did we have any align instructions in this group?
@@ -1580,6 +1599,8 @@ void* emitter::emitAllocAnyInstr(size_t sz, emitAttr opsz)
1580
1599
{
1581
1600
emitCurIG->igBlocks .push_back (emitComp->compCurBB );
1582
1601
emitCurIG->lastGeneratedBlock = emitComp->compCurBB ;
1602
+
1603
+ JITDUMP (" Mapped " FMT_BB " to %s\n " , emitComp->compCurBB ->bbNum , emitLabelString (emitCurIG));
1583
1604
}
1584
1605
#endif // DEBUG
1585
1606
@@ -1902,7 +1923,7 @@ void emitter::emitCreatePlaceholderIG(insGroupPlaceholderType igType,
1902
1923
if (emitComp->verbose )
1903
1924
{
1904
1925
printf (" *************** After placeholder IG creation\n " );
1905
- emitDispIGlist (false );
1926
+ emitDispIGlist (/* displayInstructions */ false );
1906
1927
}
1907
1928
#endif
1908
1929
}
@@ -2604,11 +2625,9 @@ void* emitter::emitAddLabel(VARSET_VALARG_TP GCvars,
2604
2625
#endif // defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
2605
2626
2606
2627
#ifdef DEBUG
2607
- JITDUMP (" Mapped " FMT_BB " to %s\n " , block->bbNum , emitLabelString (emitCurIG));
2608
-
2609
2628
if (EMIT_GC_VERBOSE)
2610
2629
{
2611
- printf (" Label: IG%02u , GCvars=%s " , emitCurIG-> igNum , VarSetOps::ToString (emitComp, GCvars));
2630
+ printf (" Label: %s , GCvars=%s " , emitLabelString ( emitCurIG) , VarSetOps::ToString (emitComp, GCvars));
2612
2631
dumpConvertedVarSet (emitComp, GCvars);
2613
2632
printf (" , gcrefRegs=" );
2614
2633
printRegMaskInt (gcrefRegs);
@@ -3589,7 +3608,7 @@ void emitter::emitDispIGflags(unsigned flags)
3589
3608
}
3590
3609
}
3591
3610
3592
- void emitter::emitDispIG (insGroup* ig, insGroup* igPrev, bool verbose )
3611
+ void emitter::emitDispIG (insGroup* ig, insGroup* igPrev, bool displayInstructions, bool displayLocation )
3593
3612
{
3594
3613
const int TEMP_BUFFER_LEN = 40 ;
3595
3614
char buff[TEMP_BUFFER_LEN];
@@ -3649,18 +3668,22 @@ void emitter::emitDispIG(insGroup* ig, insGroup* igPrev, bool verbose)
3649
3668
3650
3669
emitDispIGflags (igPh->igFlags );
3651
3670
3652
- if (ig == emitCurIG )
3671
+ if (displayLocation )
3653
3672
{
3654
- printf (" <-- Current IG" );
3655
- }
3656
- if (igPh == emitPlaceholderList)
3657
- {
3658
- printf (" <-- First placeholder" );
3659
- }
3660
- if (igPh == emitPlaceholderLast)
3661
- {
3662
- printf (" <-- Last placeholder" );
3673
+ if (ig == emitCurIG)
3674
+ {
3675
+ printf (" <-- Current IG" );
3676
+ }
3677
+ if (igPh == emitPlaceholderList)
3678
+ {
3679
+ printf (" <-- First placeholder" );
3680
+ }
3681
+ if (igPh == emitPlaceholderLast)
3682
+ {
3683
+ printf (" <-- Last placeholder" );
3684
+ }
3663
3685
}
3686
+
3664
3687
printf (" \n " );
3665
3688
3666
3689
printf (" %*s; PrevGCVars=%s " , strlen (buff), " " ,
@@ -3698,9 +3721,12 @@ void emitter::emitDispIG(insGroup* ig, insGroup* igPrev, bool verbose)
3698
3721
separator = " , " ;
3699
3722
}
3700
3723
3724
+ printf (" %sbbWeight=%s" , separator, refCntWtd2str (ig->igWeight ));
3725
+ separator = " , " ;
3726
+
3701
3727
if (emitComp->compCodeGenDone )
3702
3728
{
3703
- printf (" %sbbWeight=%s PerfScore %.2f" , separator, refCntWtd2str (ig-> igWeight ) , ig->igPerfScore );
3729
+ printf (" %sPerfScore %.2f" , separator, ig->igPerfScore );
3704
3730
separator = " , " ;
3705
3731
}
3706
3732
@@ -3746,17 +3772,21 @@ void emitter::emitDispIG(insGroup* ig, insGroup* igPrev, bool verbose)
3746
3772
3747
3773
emitDispIGflags (ig->igFlags );
3748
3774
3749
- if (ig == emitCurIG )
3775
+ if (displayLocation )
3750
3776
{
3751
- printf (" <-- Current IG" );
3752
- }
3753
- if (ig == emitPrologIG)
3754
- {
3755
- printf (" <-- Prolog IG" );
3777
+ if (ig == emitCurIG)
3778
+ {
3779
+ printf (" <-- Current IG" );
3780
+ }
3781
+ if (ig == emitPrologIG)
3782
+ {
3783
+ printf (" <-- Prolog IG" );
3784
+ }
3756
3785
}
3786
+
3757
3787
printf (" \n " );
3758
3788
3759
- if (verbose )
3789
+ if (displayInstructions )
3760
3790
{
3761
3791
instrDesc* id = emitFirstInstrDesc (ig->igData );
3762
3792
UNATIVE_OFFSET ofs = ig->igOffs ;
@@ -3791,14 +3821,14 @@ void emitter::emitDispIG(insGroup* ig, insGroup* igPrev, bool verbose)
3791
3821
}
3792
3822
}
3793
3823
3794
- void emitter::emitDispIGlist (bool verbose )
3824
+ void emitter::emitDispIGlist (bool displayInstructions )
3795
3825
{
3796
3826
insGroup* ig;
3797
3827
insGroup* igPrev;
3798
3828
3799
3829
for (igPrev = nullptr , ig = emitIGlist; ig; igPrev = ig, ig = ig->igNext )
3800
3830
{
3801
- emitDispIG (ig, igPrev, verbose );
3831
+ emitDispIG (ig, igPrev, displayInstructions );
3802
3832
}
3803
3833
}
3804
3834
@@ -4156,7 +4186,7 @@ void emitter::emitRemoveJumpToNextInst()
4156
4186
if (EMIT_INSTLIST_VERBOSE)
4157
4187
{
4158
4188
JITDUMP (" \n Instruction group list before unconditional jump to next instruction removal:\n\n " );
4159
- emitDispIGlist (true );
4189
+ emitDispIGlist (/* displayInstructions */ true );
4160
4190
}
4161
4191
if (EMITVERBOSE)
4162
4192
{
@@ -4216,9 +4246,9 @@ void emitter::emitRemoveJumpToNextInst()
4216
4246
printf (" id: %u: " , id->idDebugOnlyInfo ()->idNum );
4217
4247
emitDispIns (id, false , true , false , 0 , nullptr , 0 , jmpGroup);
4218
4248
printf (" jump group:\n " );
4219
- emitDispIG (jmpGroup, nullptr , true );
4249
+ emitDispIG (jmpGroup, nullptr , /* displayInstructions */ true );
4220
4250
printf (" target group:\n " );
4221
- emitDispIG (targetGroup, nullptr , false );
4251
+ emitDispIG (targetGroup, nullptr , /* displayInstructions */ false );
4222
4252
assert (jmp == id);
4223
4253
}
4224
4254
@@ -4311,7 +4341,7 @@ void emitter::emitRemoveJumpToNextInst()
4311
4341
if (EMIT_INSTLIST_VERBOSE)
4312
4342
{
4313
4343
printf (" \n Instruction group list after unconditional jump to next instruction removal:\n\n " );
4314
- emitDispIGlist (false );
4344
+ emitDispIGlist (/* displayInstructions */ false );
4315
4345
}
4316
4346
if (EMITVERBOSE)
4317
4347
{
@@ -4350,7 +4380,7 @@ void emitter::emitJumpDistBind()
4350
4380
if (EMIT_INSTLIST_VERBOSE)
4351
4381
{
4352
4382
printf (" \n Instruction list before jump distance binding:\n\n " );
4353
- emitDispIGlist (true );
4383
+ emitDispIGlist (/* displayInstructions */ true );
4354
4384
}
4355
4385
if (EMITVERBOSE)
4356
4386
{
@@ -5097,7 +5127,7 @@ void emitter::emitJumpDistBind()
5097
5127
if (EMIT_INSTLIST_VERBOSE)
5098
5128
{
5099
5129
printf (" \n Labels list after the jump dist binding:\n\n " );
5100
- emitDispIGlist (false );
5130
+ emitDispIGlist (/* displayInstructions */ false );
5101
5131
}
5102
5132
5103
5133
emitCheckIGoffsets ();
@@ -6208,7 +6238,7 @@ unsigned emitter::emitEndCodeGen(Compiler* comp,
6208
6238
if (EMIT_INSTLIST_VERBOSE)
6209
6239
{
6210
6240
printf (" \n Instruction list before instruction issue:\n\n " );
6211
- emitDispIGlist (true );
6241
+ emitDispIGlist (/* displayInstructions */ true );
6212
6242
}
6213
6243
6214
6244
emitCheckIGoffsets ();
@@ -7099,7 +7129,7 @@ unsigned emitter::emitEndCodeGen(Compiler* comp,
7099
7129
if (EMIT_INSTLIST_VERBOSE)
7100
7130
{
7101
7131
printf (" \n Labels list after the end of codegen:\n\n " );
7102
- emitDispIGlist (false );
7132
+ emitDispIGlist (/* displayInstructions */ false );
7103
7133
}
7104
7134
7105
7135
emitCheckIGoffsets ();
@@ -9004,7 +9034,7 @@ void emitter::emitInitIG(insGroup* ig)
9004
9034
#ifdef DEBUG
9005
9035
ig->lastGeneratedBlock = nullptr ;
9006
9036
// Explicitly call init, since IGs don't actually have a constructor.
9007
- ig->igBlocks .jitstd ::list<BasicBlock*>::init (emitComp->getAllocator (CMK_LoopOpt ));
9037
+ ig->igBlocks .jitstd ::list<BasicBlock*>::init (emitComp->getAllocator (CMK_DebugOnly ));
9008
9038
#endif
9009
9039
}
9010
9040
0 commit comments