1 //===---- PPCReduceCRLogicals.cpp - Reduce CR Bit Logical operations ------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===---------------------------------------------------------------------===// 9 // 10 // This pass aims to reduce the number of logical operations on bits in the CR 11 // register. These instructions have a fairly high latency and only a single 12 // pipeline at their disposal in modern PPC cores. Furthermore, they have a 13 // tendency to occur in fairly small blocks where there's little opportunity 14 // to hide the latency between the CR logical operation and its user. 15 // 16 //===---------------------------------------------------------------------===// 17 18 #include "PPCInstrInfo.h" 19 #include "PPC.h" 20 #include "PPCTargetMachine.h" 21 #include "llvm/CodeGen/MachineFunctionPass.h" 22 #include "llvm/CodeGen/MachineDominators.h" 23 #include "llvm/Support/Debug.h" 24 #include "llvm/ADT/Statistic.h" 25 26 using namespace llvm; 27 28 #define DEBUG_TYPE "ppc-reduce-cr-ops" 29 #include "PPCMachineBasicBlockUtils.h" 30 31 STATISTIC(NumContainedSingleUseBinOps, 32 "Number of single-use binary CR logical ops contained in a block"); 33 STATISTIC(NumToSplitBlocks, 34 "Number of binary CR logical ops that can be used to split blocks"); 35 STATISTIC(TotalCRLogicals, "Number of CR logical ops."); 36 STATISTIC(TotalNullaryCRLogicals, 37 "Number of nullary CR logical ops (CRSET/CRUNSET)."); 38 STATISTIC(TotalUnaryCRLogicals, "Number of unary CR logical ops."); 39 STATISTIC(TotalBinaryCRLogicals, "Number of CR logical ops."); 40 STATISTIC(NumBlocksSplitOnBinaryCROp, 41 "Number of blocks split on CR binary logical ops."); 42 STATISTIC(NumNotSplitIdenticalOperands, 43 "Number of blocks not split due to operands being identical."); 44 STATISTIC(NumNotSplitChainCopies, 45 "Number of blocks not split due to operands being chained copies."); 46 STATISTIC(NumNotSplitWrongOpcode, 47 "Number of blocks not split due to the wrong opcode."); 48 49 namespace llvm { 50 void initializePPCReduceCRLogicalsPass(PassRegistry&); 51 } 52 53 namespace { 54 55 static bool isBinary(MachineInstr &MI) { 56 return MI.getNumOperands() == 3; 57 } 58 59 static bool isNullary(MachineInstr &MI) { 60 return MI.getNumOperands() == 1; 61 } 62 63 /// Given a CR logical operation \p CROp, branch opcode \p BROp as well as 64 /// a flag to indicate if the first operand of \p CROp is used as the 65 /// SplitBefore operand, determines whether either of the branches are to be 66 /// inverted as well as whether the new target should be the original 67 /// fall-through block. 68 static void 69 computeBranchTargetAndInversion(unsigned CROp, unsigned BROp, bool UsingDef1, 70 bool &InvertNewBranch, bool &InvertOrigBranch, 71 bool &TargetIsFallThrough) { 72 // The conditions under which each of the output operands should be [un]set 73 // can certainly be written much more concisely with just 3 if statements or 74 // ternary expressions. However, this provides a much clearer overview to the 75 // reader as to what is set for each <CROp, BROp, OpUsed> combination. 76 if (BROp == PPC::BC || BROp == PPC::BCLR) { 77 // Regular branches. 78 switch (CROp) { 79 default: 80 llvm_unreachable("Don't know how to handle this CR logical."); 81 case PPC::CROR: 82 InvertNewBranch = false; 83 InvertOrigBranch = false; 84 TargetIsFallThrough = false; 85 return; 86 case PPC::CRAND: 87 InvertNewBranch = true; 88 InvertOrigBranch = false; 89 TargetIsFallThrough = true; 90 return; 91 case PPC::CRNAND: 92 InvertNewBranch = true; 93 InvertOrigBranch = true; 94 TargetIsFallThrough = false; 95 return; 96 case PPC::CRNOR: 97 InvertNewBranch = false; 98 InvertOrigBranch = true; 99 TargetIsFallThrough = true; 100 return; 101 case PPC::CRORC: 102 InvertNewBranch = UsingDef1; 103 InvertOrigBranch = !UsingDef1; 104 TargetIsFallThrough = false; 105 return; 106 case PPC::CRANDC: 107 InvertNewBranch = !UsingDef1; 108 InvertOrigBranch = !UsingDef1; 109 TargetIsFallThrough = true; 110 return; 111 } 112 } else if (BROp == PPC::BCn || BROp == PPC::BCLRn) { 113 // Negated branches. 114 switch (CROp) { 115 default: 116 llvm_unreachable("Don't know how to handle this CR logical."); 117 case PPC::CROR: 118 InvertNewBranch = true; 119 InvertOrigBranch = false; 120 TargetIsFallThrough = true; 121 return; 122 case PPC::CRAND: 123 InvertNewBranch = false; 124 InvertOrigBranch = false; 125 TargetIsFallThrough = false; 126 return; 127 case PPC::CRNAND: 128 InvertNewBranch = false; 129 InvertOrigBranch = true; 130 TargetIsFallThrough = true; 131 return; 132 case PPC::CRNOR: 133 InvertNewBranch = true; 134 InvertOrigBranch = true; 135 TargetIsFallThrough = false; 136 return; 137 case PPC::CRORC: 138 InvertNewBranch = !UsingDef1; 139 InvertOrigBranch = !UsingDef1; 140 TargetIsFallThrough = true; 141 return; 142 case PPC::CRANDC: 143 InvertNewBranch = UsingDef1; 144 InvertOrigBranch = !UsingDef1; 145 TargetIsFallThrough = false; 146 return; 147 } 148 } else 149 llvm_unreachable("Don't know how to handle this branch."); 150 } 151 152 class PPCReduceCRLogicals : public MachineFunctionPass { 153 154 public: 155 static char ID; 156 struct CRLogicalOpInfo { 157 MachineInstr *MI; 158 // FIXME: If chains of copies are to be handled, this should be a vector. 159 std::pair<MachineInstr*, MachineInstr*> CopyDefs; 160 std::pair<MachineInstr*, MachineInstr*> TrueDefs; 161 unsigned IsBinary : 1; 162 unsigned IsNullary : 1; 163 unsigned ContainedInBlock : 1; 164 unsigned FeedsISEL : 1; 165 unsigned FeedsBR : 1; 166 unsigned FeedsLogical : 1; 167 unsigned SingleUse : 1; 168 unsigned DefsSingleUse : 1; 169 unsigned SubregDef1; 170 unsigned SubregDef2; 171 CRLogicalOpInfo() : MI(nullptr), IsBinary(0), IsNullary(0), 172 ContainedInBlock(0), FeedsISEL(0), FeedsBR(0), 173 FeedsLogical(0), SingleUse(0), DefsSingleUse(1), 174 SubregDef1(0), SubregDef2(0) { } 175 void dump(); 176 }; 177 178 private: 179 const PPCInstrInfo *TII; 180 MachineFunction *MF; 181 MachineRegisterInfo *MRI; 182 const MachineBranchProbabilityInfo *MBPI; 183 184 // A vector to contain all the CR logical operations 185 std::vector<CRLogicalOpInfo> AllCRLogicalOps; 186 void initialize(MachineFunction &MFParm); 187 void collectCRLogicals(); 188 bool handleCROp(CRLogicalOpInfo &CRI); 189 bool splitBlockOnBinaryCROp(CRLogicalOpInfo &CRI); 190 static bool isCRLogical(MachineInstr &MI) { 191 unsigned Opc = MI.getOpcode(); 192 return Opc == PPC::CRAND || Opc == PPC::CRNAND || Opc == PPC::CROR || 193 Opc == PPC::CRXOR || Opc == PPC::CRNOR || Opc == PPC::CREQV || 194 Opc == PPC::CRANDC || Opc == PPC::CRORC || Opc == PPC::CRSET || 195 Opc == PPC::CRUNSET || Opc == PPC::CR6SET || Opc == PPC::CR6UNSET; 196 } 197 bool simplifyCode() { 198 bool Changed = false; 199 // Not using a range-based for loop here as the vector may grow while being 200 // operated on. 201 for (unsigned i = 0; i < AllCRLogicalOps.size(); i++) 202 Changed |= handleCROp(AllCRLogicalOps[i]); 203 return Changed; 204 } 205 206 public: 207 PPCReduceCRLogicals() : MachineFunctionPass(ID) { 208 initializePPCReduceCRLogicalsPass(*PassRegistry::getPassRegistry()); 209 } 210 211 MachineInstr *lookThroughCRCopy(unsigned Reg, unsigned &Subreg, 212 MachineInstr *&CpDef); 213 bool runOnMachineFunction(MachineFunction &MF) override { 214 if (skipFunction(*MF.getFunction())) 215 return false; 216 217 // If the subtarget doesn't use CR bits, there's nothing to do. 218 const PPCSubtarget &STI = MF.getSubtarget<PPCSubtarget>(); 219 if (!STI.useCRBits()) 220 return false; 221 222 initialize(MF); 223 collectCRLogicals(); 224 return simplifyCode(); 225 } 226 CRLogicalOpInfo createCRLogicalOpInfo(MachineInstr &MI); 227 void getAnalysisUsage(AnalysisUsage &AU) const override { 228 AU.addRequired<MachineBranchProbabilityInfo>(); 229 AU.addRequired<MachineDominatorTree>(); 230 MachineFunctionPass::getAnalysisUsage(AU); 231 } 232 }; 233 234 void PPCReduceCRLogicals::CRLogicalOpInfo::dump() { 235 dbgs() << "CRLogicalOpMI: "; 236 MI->dump(); 237 dbgs() << "IsBinary: " << IsBinary << ", FeedsISEL: " << FeedsISEL; 238 dbgs() << ", FeedsBR: " << FeedsBR << ", FeedsLogical: "; 239 dbgs() << FeedsLogical << ", SingleUse: " << SingleUse; 240 dbgs() << ", DefsSingleUse: " << DefsSingleUse; 241 dbgs() << ", SubregDef1: " << SubregDef1 << ", SubregDef2: "; 242 dbgs() << SubregDef2 << ", ContainedInBlock: " << ContainedInBlock; 243 if (!IsNullary) { 244 dbgs() << "\nDefs:\n"; 245 TrueDefs.first->dump(); 246 } 247 if (IsBinary) 248 TrueDefs.second->dump(); 249 dbgs() << "\n"; 250 if (CopyDefs.first) { 251 dbgs() << "CopyDef1: "; 252 CopyDefs.first->dump(); 253 } 254 if (CopyDefs.second) { 255 dbgs() << "CopyDef2: "; 256 CopyDefs.second->dump(); 257 } 258 } 259 260 PPCReduceCRLogicals::CRLogicalOpInfo 261 PPCReduceCRLogicals::createCRLogicalOpInfo(MachineInstr &MIParam) { 262 CRLogicalOpInfo Ret; 263 Ret.MI = &MIParam; 264 // Get the defs 265 if (isNullary(MIParam)) { 266 Ret.IsNullary = 1; 267 Ret.TrueDefs = std::make_pair(nullptr, nullptr); 268 Ret.CopyDefs = std::make_pair(nullptr, nullptr); 269 } else { 270 MachineInstr *Def1 = lookThroughCRCopy(MIParam.getOperand(1).getReg(), 271 Ret.SubregDef1, Ret.CopyDefs.first); 272 Ret.DefsSingleUse &= 273 MRI->hasOneNonDBGUse(Def1->getOperand(0).getReg()); 274 Ret.DefsSingleUse &= 275 MRI->hasOneNonDBGUse(Ret.CopyDefs.first->getOperand(0).getReg()); 276 assert(Def1 && "Must be able to find a definition of operand 1."); 277 if (isBinary(MIParam)) { 278 Ret.IsBinary = 1; 279 MachineInstr *Def2 = lookThroughCRCopy(MIParam.getOperand(2).getReg(), 280 Ret.SubregDef2, 281 Ret.CopyDefs.second); 282 Ret.DefsSingleUse &= 283 MRI->hasOneNonDBGUse(Def2->getOperand(0).getReg()); 284 Ret.DefsSingleUse &= 285 MRI->hasOneNonDBGUse(Ret.CopyDefs.second->getOperand(0).getReg()); 286 assert(Def2 && "Must be able to find a definition of operand 2."); 287 Ret.TrueDefs = std::make_pair(Def1, Def2); 288 } else { 289 Ret.TrueDefs = std::make_pair(Def1, nullptr); 290 Ret.CopyDefs.second = nullptr; 291 } 292 } 293 294 Ret.ContainedInBlock = 1; 295 // Get the uses 296 for (MachineInstr &UseMI : 297 MRI->use_nodbg_instructions(MIParam.getOperand(0).getReg())) { 298 unsigned Opc = UseMI.getOpcode(); 299 if (Opc == PPC::ISEL || Opc == PPC::ISEL8) 300 Ret.FeedsISEL = 1; 301 if (Opc == PPC::BC || Opc == PPC::BCn || Opc == PPC::BCLR || 302 Opc == PPC::BCLRn) 303 Ret.FeedsBR = 1; 304 Ret.FeedsLogical = isCRLogical(UseMI); 305 if (UseMI.getParent() != MIParam.getParent()) 306 Ret.ContainedInBlock = 0; 307 } 308 Ret.SingleUse = MRI->hasOneNonDBGUse(MIParam.getOperand(0).getReg()) ? 1 : 0; 309 310 // We now know whether all the uses of the CR logical are in the same block. 311 if (!Ret.IsNullary) { 312 Ret.ContainedInBlock &= 313 (MIParam.getParent() == Ret.TrueDefs.first->getParent()); 314 if (Ret.IsBinary) 315 Ret.ContainedInBlock &= 316 (MIParam.getParent() == Ret.TrueDefs.second->getParent()); 317 } 318 DEBUG(Ret.dump()); 319 if (Ret.IsBinary && Ret.ContainedInBlock && Ret.SingleUse) { 320 NumContainedSingleUseBinOps++; 321 if (Ret.FeedsBR && Ret.DefsSingleUse) 322 NumToSplitBlocks++; 323 } 324 return Ret; 325 } 326 327 /// Looks trhough a COPY instruction to the actual definition of the CR-bit 328 /// register and returns the instruction that defines it. 329 /// FIXME: This currently handles what is by-far the most common case: 330 /// an instruction that defines a CR field followed by a single copy of a bit 331 /// from that field into a virtual register. If chains of copies need to be 332 /// handled, this should have a loop until a non-copy instruction is found. 333 MachineInstr *PPCReduceCRLogicals::lookThroughCRCopy(unsigned Reg, 334 unsigned &Subreg, 335 MachineInstr *&CpDef) { 336 Subreg = -1; 337 if (!TargetRegisterInfo::isVirtualRegister(Reg)) 338 return nullptr; 339 MachineInstr *Copy = MRI->getVRegDef(Reg); 340 CpDef = Copy; 341 if (!Copy->isCopy()) 342 return Copy; 343 unsigned CopySrc = Copy->getOperand(1).getReg(); 344 Subreg = Copy->getOperand(1).getSubReg(); 345 if (!TargetRegisterInfo::isVirtualRegister(CopySrc)) { 346 const TargetRegisterInfo *TRI = &TII->getRegisterInfo(); 347 // Set the Subreg 348 if (CopySrc == PPC::CR0EQ || CopySrc == PPC::CR6EQ) 349 Subreg = PPC::sub_eq; 350 if (CopySrc == PPC::CR0LT || CopySrc == PPC::CR6LT) 351 Subreg = PPC::sub_lt; 352 if (CopySrc == PPC::CR0GT || CopySrc == PPC::CR6GT) 353 Subreg = PPC::sub_gt; 354 if (CopySrc == PPC::CR0UN || CopySrc == PPC::CR6UN) 355 Subreg = PPC::sub_un; 356 // Loop backwards and return the first MI that modifies the physical CR Reg. 357 MachineBasicBlock::iterator Me = Copy, B = Copy->getParent()->begin(); 358 while (Me != B) 359 if ((--Me)->modifiesRegister(CopySrc, TRI)) 360 return &*Me; 361 return nullptr; 362 } 363 return MRI->getVRegDef(CopySrc); 364 } 365 366 void PPCReduceCRLogicals::initialize(MachineFunction &MFParam) { 367 MF = &MFParam; 368 MRI = &MF->getRegInfo(); 369 TII = MF->getSubtarget<PPCSubtarget>().getInstrInfo(); 370 MBPI = &getAnalysis<MachineBranchProbabilityInfo>(); 371 372 AllCRLogicalOps.clear(); 373 } 374 375 /// Contains all the implemented transformations on CR logical operations. 376 /// For example, a binary CR logical can be used to split a block on its inputs, 377 /// a unary CR logical might be used to change the condition code on a 378 /// comparison feeding it. A nullary CR logical might simply be removable 379 /// if the user of the bit it [un]sets can be transformed. 380 bool PPCReduceCRLogicals::handleCROp(CRLogicalOpInfo &CRI) { 381 // We can definitely split a block on the inputs to a binary CR operation 382 // whose defs and (single) use are within the same block. 383 bool Changed = false; 384 if (CRI.IsBinary && CRI.ContainedInBlock && CRI.SingleUse && CRI.FeedsBR && 385 CRI.DefsSingleUse) { 386 Changed = splitBlockOnBinaryCROp(CRI); 387 if (Changed) 388 NumBlocksSplitOnBinaryCROp++; 389 } 390 return Changed; 391 } 392 393 /// Splits a block that contains a CR-logical operation that feeds a branch 394 /// and whose operands are produced within the block. 395 /// Example: 396 /// %vr5<def> = CMPDI %vr2, 0; CRRC:%vr5 G8RC:%vr2 397 /// %vr6<def> = COPY %vr5:sub_eq; CRBITRC:%vr6 CRRC:%vr5 398 /// %vr7<def> = CMPDI %vr3, 0; CRRC:%vr7 G8RC:%vr3 399 /// %vr8<def> = COPY %vr7:sub_eq; CRBITRC:%vr8 CRRC:%vr7 400 /// %vr9<def> = CROR %vr6<kill>, %vr8<kill>; CRBITRC:%vr9,%vr6,%vr8 401 /// BC %vr9<kill>, <BB#2>; CRBITRC:%vr9 402 /// Becomes: 403 /// %vr5<def> = CMPDI %vr2, 0; CRRC:%vr5 G8RC:%vr2 404 /// %vr6<def> = COPY %vr5:sub_eq; CRBITRC:%vr6 CRRC:%vr5 405 /// BC %vr6<kill>, <BB#2>; CRBITRC:%vr6 406 /// 407 /// %vr7<def> = CMPDI %vr3, 0; CRRC:%vr7 G8RC:%vr3 408 /// %vr8<def> = COPY %vr7:sub_eq; CRBITRC:%vr8 CRRC:%vr7 409 /// BC %vr9<kill>, <BB#2>; CRBITRC:%vr9 410 bool PPCReduceCRLogicals::splitBlockOnBinaryCROp(CRLogicalOpInfo &CRI) { 411 if (CRI.CopyDefs.first == CRI.CopyDefs.second) { 412 DEBUG(dbgs() << "Unable to split as the two operands are the same\n"); 413 NumNotSplitIdenticalOperands++; 414 return false; 415 } 416 if (CRI.TrueDefs.first->isCopy() || CRI.TrueDefs.second->isCopy() || 417 CRI.TrueDefs.first->isPHI() || CRI.TrueDefs.second->isPHI()) { 418 DEBUG(dbgs() << "Unable to split because one of the operands is a PHI or " 419 "chain of copies.\n"); 420 NumNotSplitChainCopies++; 421 return false; 422 } 423 // Note: keep in sync with computeBranchTargetAndInversion(). 424 if (CRI.MI->getOpcode() != PPC::CROR && 425 CRI.MI->getOpcode() != PPC::CRAND && 426 CRI.MI->getOpcode() != PPC::CRNOR && 427 CRI.MI->getOpcode() != PPC::CRNAND && 428 CRI.MI->getOpcode() != PPC::CRORC && 429 CRI.MI->getOpcode() != PPC::CRANDC) { 430 DEBUG(dbgs() << "Unable to split blocks on this opcode.\n"); 431 NumNotSplitWrongOpcode++; 432 return false; 433 } 434 DEBUG(dbgs() << "Splitting the following CR op:\n"; CRI.dump()); 435 MachineBasicBlock::iterator Def1It = CRI.TrueDefs.first; 436 MachineBasicBlock::iterator Def2It = CRI.TrueDefs.second; 437 438 bool UsingDef1 = false; 439 MachineInstr *SplitBefore = &*Def2It; 440 for (auto E = CRI.MI->getParent()->end(); Def2It != E; ++Def2It) { 441 if (Def1It == Def2It) { // Def2 comes before Def1. 442 SplitBefore = &*Def1It; 443 UsingDef1 = true; 444 break; 445 } 446 } 447 448 DEBUG(dbgs() << "We will split the following block:\n";); 449 DEBUG(CRI.MI->getParent()->dump()); 450 DEBUG(dbgs() << "Before instruction:\n"; SplitBefore->dump()); 451 452 // Get the branch instruction. 453 MachineInstr *Branch = 454 MRI->use_nodbg_begin(CRI.MI->getOperand(0).getReg())->getParent(); 455 456 // We want the new block to have no code in it other than the definition 457 // of the input to the CR logical and the CR logical itself. So we move 458 // those to the bottom of the block (just before the branch). Then we 459 // will split before the CR logical. 460 MachineBasicBlock *MBB = SplitBefore->getParent(); 461 auto FirstTerminator = MBB->getFirstTerminator(); 462 MachineBasicBlock::iterator FirstInstrToMove = 463 UsingDef1 ? CRI.TrueDefs.first : CRI.TrueDefs.second; 464 MachineBasicBlock::iterator SecondInstrToMove = 465 UsingDef1 ? CRI.CopyDefs.first : CRI.CopyDefs.second; 466 467 // The instructions that need to be moved are not guaranteed to be 468 // contiguous. Move them individually. 469 // FIXME: If one of the operands is a chain of (single use) copies, they 470 // can all be moved and we can still split. 471 MBB->splice(FirstTerminator, MBB, FirstInstrToMove); 472 if (FirstInstrToMove != SecondInstrToMove) 473 MBB->splice(FirstTerminator, MBB, SecondInstrToMove); 474 MBB->splice(FirstTerminator, MBB, CRI.MI); 475 476 unsigned Opc = CRI.MI->getOpcode(); 477 bool InvertOrigBranch, InvertNewBranch, TargetIsFallThrough; 478 computeBranchTargetAndInversion(Opc, Branch->getOpcode(), UsingDef1, 479 InvertNewBranch, InvertOrigBranch, 480 TargetIsFallThrough); 481 MachineInstr *SplitCond = 482 UsingDef1 ? CRI.CopyDefs.second : CRI.CopyDefs.first; 483 DEBUG(dbgs() << "We will " << (InvertNewBranch ? "invert" : "copy")); 484 DEBUG(dbgs() << " the original branch and the target is the " << 485 (TargetIsFallThrough ? "fallthrough block\n" : "orig. target block\n")); 486 DEBUG(dbgs() << "Original branch instruction: "; Branch->dump()); 487 BlockSplitInfo BSI { Branch, SplitBefore, SplitCond, InvertNewBranch, 488 InvertOrigBranch, TargetIsFallThrough, MBPI, CRI.MI, 489 UsingDef1 ? CRI.CopyDefs.first : CRI.CopyDefs.second }; 490 bool Changed = splitMBB(BSI); 491 // If we've split on a CR logical that is fed by a CR logical, 492 // recompute the source CR logical as it may be usable for splitting. 493 if (Changed) { 494 bool Input1CRlogical = 495 CRI.TrueDefs.first && isCRLogical(*CRI.TrueDefs.first); 496 bool Input2CRlogical = 497 CRI.TrueDefs.second && isCRLogical(*CRI.TrueDefs.second); 498 if (Input1CRlogical) 499 AllCRLogicalOps.push_back(createCRLogicalOpInfo(*CRI.TrueDefs.first)); 500 if (Input2CRlogical) 501 AllCRLogicalOps.push_back(createCRLogicalOpInfo(*CRI.TrueDefs.second)); 502 } 503 return Changed; 504 } 505 506 void PPCReduceCRLogicals::collectCRLogicals() { 507 for (MachineBasicBlock &MBB : *MF) { 508 for (MachineInstr &MI : MBB) { 509 if (isCRLogical(MI)) { 510 AllCRLogicalOps.push_back(createCRLogicalOpInfo(MI)); 511 TotalCRLogicals++; 512 if (AllCRLogicalOps.back().IsNullary) 513 TotalNullaryCRLogicals++; 514 else if (AllCRLogicalOps.back().IsBinary) 515 TotalBinaryCRLogicals++; 516 else 517 TotalUnaryCRLogicals++; 518 } 519 } 520 } 521 } 522 523 } // end annonymous namespace 524 525 INITIALIZE_PASS_BEGIN(PPCReduceCRLogicals, DEBUG_TYPE, 526 "PowerPC Reduce CR logical Operation", false, false) 527 INITIALIZE_PASS_DEPENDENCY(MachineDominatorTree) 528 INITIALIZE_PASS_END(PPCReduceCRLogicals, DEBUG_TYPE, 529 "PowerPC Reduce CR logical Operation", false, false) 530 531 char PPCReduceCRLogicals::ID = 0; 532 FunctionPass* 533 llvm::createPPCReduceCRLogicalsPass() { return new PPCReduceCRLogicals(); } 534