Lines Matching +full:branches +full:- +full:ignore
1 //===-- PPCBranchSelector.cpp - Emit long conditional branches ------------===//
8 //===----------------------------------------------------------------------===//
11 // conditional branches need more than 16 bits of displacement to reach their
16 //===----------------------------------------------------------------------===//
29 #define DEBUG_TYPE "ppc-branch-select"
31 STATISTIC(NumExpanded, "Number of branches expanded to long format");
44 /// BlockSizes - The sizes of the basic blocks in the function.
61 INITIALIZE_PASS(PPCBSel, "ppc-branch-select", "PowerPC Branch Selector",
64 /// createPPCBranchSelectionPass - returns an instance of the Branch Selection
74 // Give the blocks of the function a dense, in-order, numbering. in runOnMachineFunction()
79 [TII](MachineBasicBlock &MBB, unsigned Offset) -> unsigned { in runOnMachineFunction()
85 unsigned ParentAlign = MBB.getParent()->getAlignment(); in runOnMachineFunction()
103 if (MBB->getNumber() > 0) { in runOnMachineFunction()
105 BlockSizes[MBB->getNumber()-1] += AlignExtra; in runOnMachineFunction()
111 BlockSize += TII->GetInstSizeInBytes(MI); in runOnMachineFunction()
113 BlockSizes[MBB->getNumber()] = BlockSize; in runOnMachineFunction()
118 // we know we don't need to shrink any branches in this function. This is a in runOnMachineFunction()
137 // Iteratively expand branches until we reach a fixed point. in runOnMachineFunction()
147 if (I->getOpcode() == PPC::BCC && !I->getOperand(2).isImm()) in runOnMachineFunction()
148 Dest = I->getOperand(2).getMBB(); in runOnMachineFunction()
149 else if ((I->getOpcode() == PPC::BC || I->getOpcode() == PPC::BCn) && in runOnMachineFunction()
150 !I->getOperand(1).isImm()) in runOnMachineFunction()
151 Dest = I->getOperand(1).getMBB(); in runOnMachineFunction()
152 else if ((I->getOpcode() == PPC::BDNZ8 || I->getOpcode() == PPC::BDNZ || in runOnMachineFunction()
153 I->getOpcode() == PPC::BDZ8 || I->getOpcode() == PPC::BDZ) && in runOnMachineFunction()
154 !I->getOperand(0).isImm()) in runOnMachineFunction()
155 Dest = I->getOperand(0).getMBB(); in runOnMachineFunction()
158 MBBStartOffset += TII->GetInstSizeInBytes(*I); in runOnMachineFunction()
165 if (Dest->getNumber() <= MBB.getNumber()) { in runOnMachineFunction()
171 for (unsigned i = Dest->getNumber(), e = MBB.getNumber(); i != e; ++i) in runOnMachineFunction()
176 BranchSize = -MBBStartOffset; in runOnMachineFunction()
178 for (unsigned i = MBB.getNumber(), e = Dest->getNumber(); i != e; ++i) in runOnMachineFunction()
182 // If this branch is in range, ignore it. in runOnMachineFunction()
190 DebugLoc dl = OldBranch->getDebugLoc(); in runOnMachineFunction()
192 if (I->getOpcode() == PPC::BCC) { in runOnMachineFunction()
197 PPC::Predicate Pred = (PPC::Predicate)I->getOperand(0).getImm(); in runOnMachineFunction()
198 unsigned CRReg = I->getOperand(1).getReg(); in runOnMachineFunction()
201 BuildMI(MBB, I, dl, TII->get(PPC::BCC)) in runOnMachineFunction()
203 } else if (I->getOpcode() == PPC::BC) { in runOnMachineFunction()
204 unsigned CRBit = I->getOperand(0).getReg(); in runOnMachineFunction()
205 BuildMI(MBB, I, dl, TII->get(PPC::BCn)).addReg(CRBit).addImm(2); in runOnMachineFunction()
206 } else if (I->getOpcode() == PPC::BCn) { in runOnMachineFunction()
207 unsigned CRBit = I->getOperand(0).getReg(); in runOnMachineFunction()
208 BuildMI(MBB, I, dl, TII->get(PPC::BC)).addReg(CRBit).addImm(2); in runOnMachineFunction()
209 } else if (I->getOpcode() == PPC::BDNZ) { in runOnMachineFunction()
210 BuildMI(MBB, I, dl, TII->get(PPC::BDZ)).addImm(2); in runOnMachineFunction()
211 } else if (I->getOpcode() == PPC::BDNZ8) { in runOnMachineFunction()
212 BuildMI(MBB, I, dl, TII->get(PPC::BDZ8)).addImm(2); in runOnMachineFunction()
213 } else if (I->getOpcode() == PPC::BDZ) { in runOnMachineFunction()
214 BuildMI(MBB, I, dl, TII->get(PPC::BDNZ)).addImm(2); in runOnMachineFunction()
215 } else if (I->getOpcode() == PPC::BDZ8) { in runOnMachineFunction()
216 BuildMI(MBB, I, dl, TII->get(PPC::BDNZ8)).addImm(2); in runOnMachineFunction()
222 I = BuildMI(MBB, I, dl, TII->get(PPC::B)).addMBB(Dest); in runOnMachineFunction()
225 OldBranch->eraseFromParent(); in runOnMachineFunction()
227 // Remember that this instruction is 8-bytes, increase the size of the in runOnMachineFunction()