//===- InterferenceCache.cpp - Caching per-block interference -------------===// // // 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 // //===----------------------------------------------------------------------===// // // InterferenceCache remembers per-block interference in LiveIntervalUnions. // //===----------------------------------------------------------------------===// #include "InterferenceCache.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/CodeGen/LiveIntervals.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineOperand.h" #include "llvm/CodeGen/TargetRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h" #include "llvm/Support/ErrorHandling.h" #include <cassert> #include <cstdint> #include <tuple> usingnamespacellvm; #define DEBUG_TYPE … // Static member used for null interference cursors. const InterferenceCache::BlockInterference InterferenceCache::Cursor::NoInterference; // Initializes PhysRegEntries (instead of a SmallVector, PhysRegEntries is a // buffer of size NumPhysRegs to speed up alloc/clear for targets with large // reg files). Calloced memory is used for good form, and quites tools like // Valgrind too, but zero initialized memory is not required by the algorithm: // this is because PhysRegEntries works like a SparseSet and its entries are // only valid when there is a corresponding CacheEntries assignment. There is // also support for when pass managers are reused for targets with different // numbers of PhysRegs: in this case PhysRegEntries is freed and reinitialized. void InterferenceCache::reinitPhysRegEntries() { … } void InterferenceCache::init(MachineFunction *mf, LiveIntervalUnion *liuarray, SlotIndexes *indexes, LiveIntervals *lis, const TargetRegisterInfo *tri) { … } InterferenceCache::Entry *InterferenceCache::get(MCRegister PhysReg) { … } /// revalidate - LIU contents have changed, update tags. void InterferenceCache::Entry::revalidate(LiveIntervalUnion *LIUArray, const TargetRegisterInfo *TRI) { … } void InterferenceCache::Entry::reset(MCRegister physReg, LiveIntervalUnion *LIUArray, const TargetRegisterInfo *TRI, const MachineFunction *MF) { … } bool InterferenceCache::Entry::valid(LiveIntervalUnion *LIUArray, const TargetRegisterInfo *TRI) { … } void InterferenceCache::Entry::update(unsigned MBBNum) { … }