@@ -452,8 +452,6 @@ void X86FoldTablesEmitter::addEntryWithFlags(FoldTable &Table,
452
452
" Override entry unexpectedly" );
453
453
X86FoldTableEntry Result = X86FoldTableEntry (RegInst, MemInst);
454
454
Record *RegRec = RegInst->TheDef ;
455
- Record *MemRec = MemInst->TheDef ;
456
-
457
455
Result.NoReverse = S & TB_NO_REVERSE;
458
456
Result.NoForward = S & TB_NO_FORWARD;
459
457
Result.FoldLoad = S & TB_FOLDED_LOAD;
@@ -464,21 +462,6 @@ void X86FoldTablesEmitter::addEntryWithFlags(FoldTable &Table,
464
462
return ;
465
463
}
466
464
467
- // Only table0 entries should explicitly specify a load or store flag.
468
- if (&Table == &Table0) {
469
- unsigned MemInOpsNum = MemRec->getValueAsDag (" InOperandList" )->getNumArgs ();
470
- unsigned RegInOpsNum = RegRec->getValueAsDag (" InOperandList" )->getNumArgs ();
471
- // If the instruction writes to the folded operand, it will appear as an
472
- // output in the register form instruction and as an input in the memory
473
- // form instruction.
474
- // If the instruction reads from the folded operand, it well appear as in
475
- // input in both forms.
476
- if (MemInOpsNum == RegInOpsNum)
477
- Result.FoldLoad = true ;
478
- else
479
- Result.FoldStore = true ;
480
- }
481
-
482
465
Record *RegOpRec = RegInst->Operands [FoldedIdx].Rec ;
483
466
Record *MemOpRec = MemInst->Operands [FoldedIdx].Rec ;
484
467
@@ -575,6 +558,11 @@ void X86FoldTablesEmitter::updateTables(const CodeGenInstruction *RegInst,
575
558
return ;
576
559
}
577
560
561
+ // Only table0 entries should explicitly specify a load or store flag.
562
+ // If the instruction writes to the folded operand, it will appear as
563
+ // an output in the register form instruction and as an input in the
564
+ // memory form instruction. If the instruction reads from the folded
565
+ // operand, it will appear as in input in both forms.
578
566
if (MemInSize == RegInSize && MemOutSize == RegOutSize) {
579
567
// Load-Folding cases.
580
568
// If the i'th register form operand is a register and the i'th memory form
@@ -590,7 +578,8 @@ void X86FoldTablesEmitter::updateTables(const CodeGenInstruction *RegInst,
590
578
switch (I) {
591
579
case 0 :
592
580
assert (!IsBroadcast && " BroadcastTable0 needs to be added" );
593
- addEntryWithFlags (Table0, RegInst, MemInst, S, 0 , IsManual);
581
+ addEntryWithFlags (Table0, RegInst, MemInst, S | TB_FOLDED_LOAD, 0 ,
582
+ IsManual);
594
583
return ;
595
584
case 1 :
596
585
IsBroadcast
@@ -628,7 +617,8 @@ void X86FoldTablesEmitter::updateTables(const CodeGenInstruction *RegInst,
628
617
if (isRegisterOperand (RegOpRec) && isMemoryOperand (MemOpRec) &&
629
618
getRegOperandSize (RegOpRec) == getMemOperandSize (MemOpRec)) {
630
619
assert (!IsBroadcast && " Store can not be broadcast" );
631
- addEntryWithFlags (Table0, RegInst, MemInst, S, 0 , IsManual);
620
+ addEntryWithFlags (Table0, RegInst, MemInst, S | TB_FOLDED_STORE, 0 ,
621
+ IsManual);
632
622
}
633
623
}
634
624
}
0 commit comments