//===- LiveIntervalUnion.cpp - Live interval union data structure ---------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // LiveIntervalUnion represents a coalesced set of live intervals. This may be // used during coalescing to represent a congruence class, or during register // allocation to model liveness of a physical register. // //===----------------------------------------------------------------------===// #include "llvm/CodeGen/LiveIntervalUnion.h" #include "llvm/ADT/STLExtras.h" #include "llvm/CodeGen/LiveInterval.h" #include "llvm/CodeGen/TargetRegisterInfo.h" #include "llvm/Support/raw_ostream.h" #include <cassert> #include <cstdlib> usingnamespacellvm; #define DEBUG_TYPE … // Merge a LiveInterval's segments. Guarantee no overlaps. void LiveIntervalUnion::unify(const LiveInterval &VirtReg, const LiveRange &Range) { … } // Remove a live virtual register's segments from this union. void LiveIntervalUnion::extract(const LiveInterval &VirtReg, const LiveRange &Range) { … } void LiveIntervalUnion::print(raw_ostream &OS, const TargetRegisterInfo *TRI) const { … } #ifndef NDEBUG // Verify the live intervals in this union and add them to the visited set. void LiveIntervalUnion::verify(LiveVirtRegBitSet& VisitedVRegs) { for (SegmentIter SI = Segments.begin(); SI.valid(); ++SI) VisitedVRegs.set(SI.value()->reg()); } #endif //!NDEBUG const LiveInterval *LiveIntervalUnion::getOneVReg() const { … } // Scan the vector of interfering virtual registers in this union. Assume it's // quite small. bool LiveIntervalUnion::Query::isSeenInterference( const LiveInterval *VirtReg) const { … } // Collect virtual registers in this union that interfere with this // query's live virtual register. // // The query state is one of: // // 1. CheckedFirstInterference == false: Iterators are uninitialized. // 2. SeenAllInterferences == true: InterferingVRegs complete, iterators unused. // 3. Iterators left at the last seen intersection. // unsigned LiveIntervalUnion::Query::collectInterferingVRegs(unsigned MaxInterferingRegs) { … } void LiveIntervalUnion::Array::init(LiveIntervalUnion::Allocator &Alloc, unsigned NSize) { … } void LiveIntervalUnion::Array::clear() { … }