diff options
author | Chris Lattner <sabre@nondot.org> | 2008-01-07 01:56:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-01-07 01:56:04 +0000 |
commit | 69244300b8a0112efb44b6273ecea4ca6264b8cf (patch) | |
tree | b5a0565e968d692bfa45952fe63009ff1b2be001 /lib/CodeGen/IfConversion.cpp | |
parent | 6425f8be7263e625c2d7484eb2fb8f6643824f49 (diff) | |
download | external_llvm-69244300b8a0112efb44b6273ecea4ca6264b8cf.zip external_llvm-69244300b8a0112efb44b6273ecea4ca6264b8cf.tar.gz external_llvm-69244300b8a0112efb44b6273ecea4ca6264b8cf.tar.bz2 |
Rename MachineInstr::getInstrDescriptor -> getDesc(), which reflects
that it is cheap and efficient to get.
Move a variety of predicates from TargetInstrInfo into
TargetInstrDescriptor, which makes it much easier to query a predicate
when you don't have TII around. Now you can use MI->getDesc()->isBranch()
instead of going through TII, and this is much more efficient anyway. Not
all of the predicates have been moved over yet.
Update old code that used MI->getInstrDescriptor()->Flags to use the
new predicates in many places.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45674 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/IfConversion.cpp')
-rw-r--r-- | lib/CodeGen/IfConversion.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp index 54069c6..19ed70d 100644 --- a/lib/CodeGen/IfConversion.cpp +++ b/lib/CodeGen/IfConversion.cpp @@ -462,8 +462,7 @@ MachineBasicBlock::iterator firstNonBranchInst(MachineBasicBlock *BB, MachineBasicBlock::iterator I = BB->end(); while (I != BB->begin()) { --I; - const TargetInstrDescriptor *TID = I->getInstrDescriptor(); - if ((TID->Flags & M_BRANCH_FLAG) == 0) + if (!I->getDesc()->isBranch()) break; } return I; @@ -522,7 +521,7 @@ bool IfConverter::ValidDiamond(BBInfo &TrueBBI, BBInfo &FalseBBI, /// ScanInstructions - Scan all the instructions in the block to determine if /// the block is predicable. In most cases, that means all the instructions -/// in the block has M_PREDICABLE flag. Also checks if the block contains any +/// in the block are isPredicable(). Also checks if the block contains any /// instruction which can clobber a predicate (e.g. condition code register). /// If so, the block is not predicable unless it's the last instruction. void IfConverter::ScanInstructions(BBInfo &BBI) { @@ -551,13 +550,12 @@ void IfConverter::ScanInstructions(BBInfo &BBI) { bool SeenCondBr = false; for (MachineBasicBlock::iterator I = BBI.BB->begin(), E = BBI.BB->end(); I != E; ++I) { - const TargetInstrDescriptor *TID = I->getInstrDescriptor(); - if ((TID->Flags & M_NOT_DUPLICABLE) != 0) + const TargetInstrDescriptor *TID = I->getDesc(); + if (TID->isNotDuplicable()) BBI.CannotBeCopied = true; bool isPredicated = TII->isPredicated(I); - bool isCondBr = BBI.IsBrAnalyzable && - (TID->Flags & M_BRANCH_FLAG) != 0 && (TID->Flags & M_BARRIER_FLAG) == 0; + bool isCondBr = BBI.IsBrAnalyzable && TID->isBranch() && !TID->isBarrier(); if (!isCondBr) { if (!isPredicated) @@ -594,7 +592,7 @@ void IfConverter::ScanInstructions(BBInfo &BBI) { if (TII->DefinesPredicate(I, PredDefs)) BBI.ClobbersPred = true; - if ((TID->Flags & M_PREDICABLE) == 0) { + if (!TID->isPredicable()) { BBI.IsUnpredicable = true; return; } @@ -1136,10 +1134,10 @@ void IfConverter::CopyAndPredicateBlock(BBInfo &ToBBI, BBInfo &FromBBI, bool IgnoreBr) { for (MachineBasicBlock::iterator I = FromBBI.BB->begin(), E = FromBBI.BB->end(); I != E; ++I) { - const TargetInstrDescriptor *TID = I->getInstrDescriptor(); + const TargetInstrDescriptor *TID = I->getDesc(); bool isPredicated = TII->isPredicated(I); // Do not copy the end of the block branches. - if (IgnoreBr && !isPredicated && (TID->Flags & M_BRANCH_FLAG) != 0) + if (IgnoreBr && !isPredicated && TID->isBranch()) break; MachineInstr *MI = I->clone(); |