// OptimizePICCall methods. bool OptimizePICCall::runOnMachineFunction(MachineFunction &F) { if (static_cast<const MipsSubtarget &>(F.getSubtarget()).inMips16Mode()) return false; // Do a pre-order traversal of the dominator tree. MachineDominatorTree *MDT = &getAnalysis<MachineDominatorTree>(); bool Changed = false; SmallVector<MBBInfo, 8> WorkList(1, MBBInfo(MDT->getRootNode())); while (!WorkList.empty()) { MBBInfo &MBBI = WorkList.back(); // If this MBB has already been visited, destroy the scope for the MBB and // pop it from the work list. if (MBBI.isVisited()) { MBBI.postVisit(); WorkList.pop_back(); continue; } // Visit the MBB and add its children to the work list. MBBI.preVisit(ScopedHT); Changed |= visitNode(MBBI); const MachineDomTreeNode *Node = MBBI.getNode(); const std::vector<MachineDomTreeNode *> &Children = Node->getChildren(); WorkList.append(Children.begin(), Children.end()); } return Changed; }
bool SystemZLDCleanup::runOnMachineFunction(MachineFunction &F) { if (skipFunction(*F.getFunction())) return false; TII = static_cast<const SystemZInstrInfo *>(F.getSubtarget().getInstrInfo()); MF = &F; SystemZMachineFunctionInfo* MFI = F.getInfo<SystemZMachineFunctionInfo>(); if (MFI->getNumLocalDynamicTLSAccesses() < 2) { // No point folding accesses if there isn't at least two. return false; } MachineDominatorTree *DT = &getAnalysis<MachineDominatorTree>(); return VisitNode(DT->getRootNode(), 0); }