mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
[ARMv8] Prevent generation of deprecated IT blocks on ARMv8 in Thumb mode.
IT blocks can only be one instruction lonf, and can only contain a subset of the 16 instructions. Patch by Artyom Skrobov! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190309 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -666,32 +666,29 @@ void IfConverter::ScanInstructions(BBInfo &BBI) {
|
||||
bool isPredicated = TII->isPredicated(I);
|
||||
bool isCondBr = BBI.IsBrAnalyzable && I->isConditionalBranch();
|
||||
|
||||
if (!isCondBr) {
|
||||
if (!isPredicated) {
|
||||
BBI.NonPredSize++;
|
||||
unsigned ExtraPredCost = 0;
|
||||
unsigned NumCycles = TII->getInstrLatency(InstrItins, &*I,
|
||||
&ExtraPredCost);
|
||||
if (NumCycles > 1)
|
||||
BBI.ExtraCost += NumCycles-1;
|
||||
BBI.ExtraCost2 += ExtraPredCost;
|
||||
} else if (!AlreadyPredicated) {
|
||||
// FIXME: This instruction is already predicated before the
|
||||
// if-conversion pass. It's probably something like a conditional move.
|
||||
// Mark this block unpredicable for now.
|
||||
BBI.IsUnpredicable = true;
|
||||
return;
|
||||
}
|
||||
// A conditional branch is not predicable, but it may be eliminated.
|
||||
if (isCondBr)
|
||||
continue;
|
||||
|
||||
if (!isPredicated) {
|
||||
BBI.NonPredSize++;
|
||||
unsigned ExtraPredCost = 0;
|
||||
unsigned NumCycles = TII->getInstrLatency(InstrItins, &*I,
|
||||
&ExtraPredCost);
|
||||
if (NumCycles > 1)
|
||||
BBI.ExtraCost += NumCycles-1;
|
||||
BBI.ExtraCost2 += ExtraPredCost;
|
||||
} else if (!AlreadyPredicated) {
|
||||
// FIXME: This instruction is already predicated before the
|
||||
// if-conversion pass. It's probably something like a conditional move.
|
||||
// Mark this block unpredicable for now.
|
||||
BBI.IsUnpredicable = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (BBI.ClobbersPred && !isPredicated) {
|
||||
// Predicate modification instruction should end the block (except for
|
||||
// already predicated instructions and end of block branches).
|
||||
if (isCondBr) {
|
||||
// A conditional branch is not predicable, but it may be eliminated.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Predicate may have been modified, the subsequent (currently)
|
||||
// unpredicated instructions cannot be correctly predicated.
|
||||
BBI.IsUnpredicable = true;
|
||||
|
Reference in New Issue
Block a user