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 { class
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) in Chain() function in __anondfbe7f5c0211::Chain
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 " in add()
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 " in setKill()
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 { in rangeOverlapsWith()
273 /// Return true if this chain starts before Other.
274 bool startsBefore(const Chain *Other) const { in startsBefore()
283 /// Return a simple string representation of the chain.
338 // "link" register between each inst in the chain. in runOnBasicBlock()
339 std::map<unsigned, Chain*> ActiveChains; in runOnBasicBlock()
340 std::vector<std::unique_ptr<Chain>> AllChains; in runOnBasicBlock()
355 EquivalenceClasses<Chain*> EC; in runOnBasicBlock()
369 std::vector<std::vector<Chain*> > V; in runOnBasicBlock()
371 std::vector<Chain*> Cs(EC.member_begin(I), EC.member_end()); in runOnBasicBlock()
379 [](const std::vector<Chain *> &A, const std::vector<Chain *> &B) { in runOnBasicBlock()
402 Chain *AArch64A57FPLoadBalancing::getAndEraseNext(Color PreferredColor, in getAndEraseNext()
403 std::vector<Chain*> &L) { in getAndEraseNext()
410 // but if we can't find a chain of the maximum length with the preferred color, in getAndEraseNext()
412 // returning a chain that must be recolored. in getAndEraseNext()
420 Chain *Ch = *--I; in getAndEraseNext()
426 Chain *Ch = *I; in getAndEraseNext()
433 Chain *Ch = L.front(); in getAndEraseNext()
438 bool AArch64A57FPLoadBalancing::colorChainSet(std::vector<Chain*> GV, in colorChainSet()
453 llvm::sort(GV, [](const Chain *G1, const Chain *G2) { in colorChainSet()
465 while (Chain *G = getAndEraseNext(PreferredColor, GV)) { in colorChainSet()
469 // But if we really don't care, use the chain's preferred color. in colorChainSet()
495 int AArch64A57FPLoadBalancing::scavengeRegister(Chain *G, Color C, in scavengeRegister()
498 // of the chain? Simulate liveness backwards until the end of the chain. in scavengeRegister()
508 // Check which register units are alive throughout the chain. in scavengeRegister()
510 assert(ChainBegin != ChainEnd && "Chain should contain instructions"); in scavengeRegister()
529 bool AArch64A57FPLoadBalancing::colorChain(Chain *G, Color C, in colorChain()
600 MachineInstr *MI, unsigned Idx, std::map<unsigned, Chain *> &ActiveChains, in scanInstruction()
601 std::vector<std::unique_ptr<Chain>> &AllChains) { in scanInstruction()
611 // Create a new chain. Multiplies don't require forwarding so can go on any in scanInstruction()
615 LLVM_DEBUG(dbgs() << "New chain started for register " in scanInstruction()
618 auto G = std::make_unique<Chain>(MI, Idx, getColor(DestReg)); in scanInstruction()
635 LLVM_DEBUG(dbgs() << "Chain found for accumulator register " in scanInstruction()
638 // For simplicity we only chain together sequences of MULs/MLAs where the in scanInstruction()
644 // Add to chain. in scanInstruction()
645 LLVM_DEBUG(dbgs() << "Instruction was successfully added to chain.\n"); in scanInstruction()
656 dbgs() << "Cannot add to chain because accumulator operand wasn't " in scanInstruction()
661 LLVM_DEBUG(dbgs() << "Creating new chain for dest register " in scanInstruction()
663 auto G = std::make_unique<Chain>(MI, Idx, getColor(DestReg)); in scanInstruction()
669 // Non-MUL or MLA instruction. Invalidate any chain in the uses or defs in scanInstruction()
681 std::map<unsigned, Chain*> &ActiveChains) { in maybeKillChain()
683 // determine if a chain should be ended and remove from ActiveChains. in maybeKillChain()
688 // If this is a KILL of a current chain, record it. in maybeKillChain()
690 LLVM_DEBUG(dbgs() << "Kill seen for chain " << printReg(MO.getReg(), TRI) in maybeKillChain()
701 LLVM_DEBUG(dbgs() << "Kill (regmask) seen for chain " in maybeKillChain()