Lines Matching full:chain

106 class Chain;
137 bool colorChainSet(std::vector<Chain*> GV, MachineBasicBlock &MBB,
139 bool colorChain(Chain *G, Color C, MachineBasicBlock &MBB);
140 int scavengeRegister(Chain *G, Color C, MachineBasicBlock &MBB);
142 std::map<unsigned, Chain*> &Active,
143 std::vector<std::unique_ptr<Chain>> &AllChains);
145 std::map<unsigned, Chain*> &RegChains);
147 Chain *getAndEraseNext(Color PreferredColor, std::vector<Chain*> &L);
159 /// A Chain is a sequence of instructions that are linked together by
167 /// do not belong to the chain. These other instructions must not use
168 /// the "chain" register at any point.
170 /// We currently only support chains where the "chain" operand is killed
171 /// at each link in the chain for simplicity.
172 /// A chain has three important instructions - Start, Last and Kill.
173 /// * The start instruction is the first instruction in the chain.
174 /// * Last is the final instruction in the chain.
184 class Chain {
191 /// All instructions in the chain.
197 /// The "color" of LastInst. This will be the preferred chain color,
202 Chain(MachineInstr *MI, unsigned Idx, Color C)
209 /// Add a new instruction into the chain. The instruction's dest operand
216 "Chain: broken invariant. A Chain can only be killed after its last "
222 /// Return true if MI is a member of the chain.
225 /// Return the number of instructions in the chain.
230 /// Inform the chain that its last active register (the dest register of
237 "Chain: broken invariant. A Chain can only be killed after its last "
241 /// Return the first instruction in the chain.
243 /// Return the last instruction in the chain.
248 /// of the chain. This is the maximum of KillInst (if set) and LastInst.
257 /// Return the preferred color of this chain.
264 /// Return true if this chain (StartInst..KillInst) overlaps with Other.
265 bool rangeOverlapsWith(const Chain &Other) const {
273 /// Return true if this chain starts before Other.
274 bool startsBefore(const Chain *Other) const {
283 /// Return a simple string representation of the chain.
338 // "link" register between each inst in the chain.
339 std::map<unsigned, Chain*> ActiveChains;
340 std::vector<std::unique_ptr<Chain>> AllChains;
355 EquivalenceClasses<Chain*> EC;
369 std::vector<std::vector<Chain*> > V;
371 std::vector<Chain*> Cs(EC.member_begin(I), EC.member_end());
379 [](const std::vector<Chain *> &A, const std::vector<Chain *> &B) {
402 Chain *AArch64A57FPLoadBalancing::getAndEraseNext(Color PreferredColor,
403 std::vector<Chain*> &L) {
410 // but if we can't find a chain of the maximum length with the preferred color,
412 // returning a chain that must be recolored.
420 Chain *Ch = *--I;
426 Chain *Ch = *I;
433 Chain *Ch = L.front();
438 bool AArch64A57FPLoadBalancing::colorChainSet(std::vector<Chain*> GV,
453 llvm::sort(GV, [](const Chain *G1, const Chain *G2) {
465 while (Chain *G = getAndEraseNext(PreferredColor, GV)) {
469 // But if we really don't care, use the chain's preferred color.
495 int AArch64A57FPLoadBalancing::scavengeRegister(Chain *G, Color C,
498 // of the chain? Simulate liveness backwards until the end of the chain.
508 // Check which register units are alive throughout the chain.
510 assert(ChainBegin != ChainEnd && "Chain should contain instructions");
529 bool AArch64A57FPLoadBalancing::colorChain(Chain *G, Color C,
600 MachineInstr *MI, unsigned Idx, std::map<unsigned, Chain *> &ActiveChains,
601 std::vector<std::unique_ptr<Chain>> &AllChains) {
611 // Create a new chain. Multiplies don't require forwarding so can go on any
615 LLVM_DEBUG(dbgs() << "New chain started for register "
618 auto G = std::make_unique<Chain>(MI, Idx, getColor(DestReg));
635 LLVM_DEBUG(dbgs() << "Chain found for accumulator register "
638 // For simplicity we only chain together sequences of MULs/MLAs where the
644 // Add to chain.
645 LLVM_DEBUG(dbgs() << "Instruction was successfully added to chain.\n");
656 dbgs() << "Cannot add to chain because accumulator operand wasn't "
661 LLVM_DEBUG(dbgs() << "Creating new chain for dest register "
663 auto G = std::make_unique<Chain>(MI, Idx, getColor(DestReg));
669 // Non-MUL or MLA instruction. Invalidate any chain in the uses or defs
681 std::map<unsigned, Chain*> &ActiveChains) {
683 // determine if a chain should be ended and remove from ActiveChains.
688 // If this is a KILL of a current chain, record it.
690 LLVM_DEBUG(dbgs() << "Kill seen for chain " << printReg(MO.getReg(), TRI)
701 LLVM_DEBUG(dbgs() << "Kill (regmask) seen for chain "