119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman//===---- LiveRangeCalc.h - Calculate live ranges ---------------*- C++ -*-===// 219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman// 319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman// The LLVM Compiler Infrastructure 419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman// 519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman// This file is distributed under the University of Illinois Open Source 619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman// License. See LICENSE.TXT for details. 719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman// 819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman//===----------------------------------------------------------------------===// 919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman// 1019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman// The LiveRangeCalc class can be used to compute live ranges from scratch. It 1119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman// caches information about values in the CFG to speed up repeated operations 1219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman// on the same live range. The cache can be shared by non-overlapping live 1319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman// ranges. SplitKit uses that when computing the live range of split products. 1419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman// 1519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman// A low-level interface is available to clients that know where a variable is 1619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman// live, but don't know which value it has as every point. LiveRangeCalc will 1719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman// propagate values down the dominator tree, and even insert PHI-defs where 1819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman// needed. SplitKit uses this faster interface when possible. 1919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman// 2019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman//===----------------------------------------------------------------------===// 2119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 2219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#ifndef LLVM_CODEGEN_LIVERANGECALC_H 2319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#define LLVM_CODEGEN_LIVERANGECALC_H 2419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 2519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#include "llvm/ADT/BitVector.h" 2619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#include "llvm/ADT/IndexedMap.h" 2719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#include "llvm/CodeGen/LiveInterval.h" 2819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 2919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Baumannamespace llvm { 3019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 3119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman/// Forward declarations for MachineDominators.h: 3219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Baumanclass MachineDominatorTree; 3319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Baumantemplate <class NodeT> class DomTreeNodeBase; 3419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Baumantypedef DomTreeNodeBase<MachineBasicBlock> MachineDomTreeNode; 3519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 3619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Baumanclass LiveRangeCalc { 3719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// Seen - Bit vector of active entries in LiveOut, also used as a visited 3819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// set by findReachingDefs. One entry per basic block, indexed by block 3919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// number. This is kept as a separate bit vector because it can be cleared 4019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// quickly when switching live ranges. 4119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman BitVector Seen; 4219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 4319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// LiveOutPair - A value and the block that defined it. The domtree node is 4419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// redundant, it can be computed as: MDT[Indexes.getMBBFromIndex(VNI->def)]. 4519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman typedef std::pair<VNInfo*, MachineDomTreeNode*> LiveOutPair; 4619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 4719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// LiveOutMap - Map basic blocks to the value leaving the block. 4819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman typedef IndexedMap<LiveOutPair, MBB2NumberFunctor> LiveOutMap; 4919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 5019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// LiveOut - Map each basic block where a live range is live out to the 5119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// live-out value and its defining block. 5219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// 5319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// For every basic block, MBB, one of these conditions shall be true: 5419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// 5519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// 1. !Seen.count(MBB->getNumber()) 5619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// Blocks without a Seen bit are ignored. 5719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// 2. LiveOut[MBB].second.getNode() == MBB 5819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// The live-out value is defined in MBB. 5919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// 3. forall P in preds(MBB): LiveOut[P] == LiveOut[MBB] 6019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// The live-out value passses through MBB. All predecessors must carry 6119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// the same value. 6219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// 6319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// The domtree node may be null, it can be computed. 6419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// 6519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// The map can be shared by multiple live ranges as long as no two are 6619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// live-out of the same block. 6719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman LiveOutMap LiveOut; 6819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 6919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// LiveInBlock - Information about a basic block where a live range is known 7019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// to be live-in, but the value has not yet been determined. 7119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman struct LiveInBlock { 7219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // LI - The live range that is live-in to this block. The algorithms can 7319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // handle multiple non-overlapping live ranges simultaneously. 7419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman LiveInterval *LI; 7519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 7619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // DomNode - Dominator tree node for the block. 7719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // Cleared when the final value has been determined and LI has been updated. 7819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman MachineDomTreeNode *DomNode; 7919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 8019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // Position in block where the live-in range ends, or SlotIndex() if the 8119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // range passes through the block. When the final value has been 8219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // determined, the range from the block start to Kill will be added to LI. 8319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman SlotIndex Kill; 8419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 8519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // Live-in value filled in by updateSSA once it is known. 8619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman VNInfo *Value; 8719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 8819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman LiveInBlock(LiveInterval *li, MachineDomTreeNode *node, SlotIndex kill) 8919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman : LI(li), DomNode(node), Kill(kill), Value(0) {} 9019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman }; 9119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 9219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// LiveIn - Work list of blocks where the live-in value has yet to be 9319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// determined. This list is typically computed by findReachingDefs() and 9419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// used as a work list by updateSSA(). The low-level interface may also be 9519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// used to add entries directly. 9619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman SmallVector<LiveInBlock, 16> LiveIn; 9719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 9819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// findReachingDefs - Assuming that LI is live-in to KillMBB and killed at 9919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// Kill, search for values that can reach KillMBB. All blocks that need LI 10019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// to be live-in are added to LiveIn. If a unique reaching def is found, 10119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// its value is returned, if Kill is jointly dominated by multiple values, 10219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// NULL is returned. 10319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman VNInfo *findReachingDefs(LiveInterval *LI, 10419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman MachineBasicBlock *KillMBB, 10519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman SlotIndex Kill, 10619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman SlotIndexes *Indexes, 10719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman MachineDominatorTree *DomTree); 10819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 10919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// updateSSA - Compute the values that will be live in to all requested 11019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// blocks in LiveIn. Create PHI-def values as required to preserve SSA form. 11119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// 11219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// Every live-in block must be jointly dominated by the added live-out 11319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// blocks. No values are read from the live ranges. 11419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman void updateSSA(SlotIndexes *Indexes, 11519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman MachineDominatorTree *DomTree, 11619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman VNInfo::Allocator *Alloc); 11719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 11819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// updateLiveIns - Add liveness as specified in the LiveIn vector, using VNI 11919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// as a wildcard value for LiveIn entries without a value. 12019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman void updateLiveIns(VNInfo *VNI, SlotIndexes*); 12119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 12219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Baumanpublic: 12319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman //===--------------------------------------------------------------------===// 12419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // High-level interface. 12519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman //===--------------------------------------------------------------------===// 12619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // 12719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // Calculate live ranges from scratch. 12819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // 12919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 13019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// reset - Prepare caches for a new set of non-overlapping live ranges. The 13119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// caches must be reset before attempting calculations with a live range 13219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// that may overlap a previously computed live range, and before the first 13319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// live range in a function. If live ranges are not known to be 13419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// non-overlapping, call reset before each. 13519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman void reset(const MachineFunction *MF); 13619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 13719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// calculate - Calculate the live range of a virtual register from its defs 13819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// and uses. LI must be empty with no values. 13919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman void calculate(LiveInterval *LI, 14019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman MachineRegisterInfo *MRI, 14119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman SlotIndexes *Indexes, 14219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman VNInfo::Allocator *Alloc); 14319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 14419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman //===--------------------------------------------------------------------===// 14519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // Mid-level interface. 14619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman //===--------------------------------------------------------------------===// 14719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // 14819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // Modify existing live ranges. 14919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // 15019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 15119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// extend - Extend the live range of LI to reach Kill. 15219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// 15319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// The existing values in LI must be live so they jointly dominate Kill. If 15419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// Kill is not dominated by a single existing value, PHI-defs are inserted 15519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// as required to preserve SSA form. If Kill is known to be dominated by a 15619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// single existing value, Alloc may be null. 15719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman void extend(LiveInterval *LI, 15819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman SlotIndex Kill, 15919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman SlotIndexes *Indexes, 16019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman MachineDominatorTree *DomTree, 16119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman VNInfo::Allocator *Alloc); 16219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 16319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// extendToUses - Extend the live range of LI to reach all uses. 16419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// 16519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// All uses must be jointly dominated by existing liveness. PHI-defs are 16619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// inserted as needed to preserve SSA form. 16719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman void extendToUses(LiveInterval *LI, 16819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman MachineRegisterInfo *MRI, 16919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman SlotIndexes *Indexes, 17019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman MachineDominatorTree *DomTree, 17119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman VNInfo::Allocator *Alloc); 17219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 17319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman //===--------------------------------------------------------------------===// 17419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // Low-level interface. 17519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman //===--------------------------------------------------------------------===// 17619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // 17719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // These functions can be used to compute live ranges where the live-in and 17819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // live-out blocks are already known, but the SSA value in each block is 17919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // unknown. 18019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // 18119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // After calling reset(), add known live-out values and known live-in blocks. 18219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // Then call calculateValues() to compute the actual value that is 18319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // live-in to each block, and add liveness to the live ranges. 18419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman // 18519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 18619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// setLiveOutValue - Indicate that VNI is live out from MBB. The 18719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// calculateValues() function will not add liveness for MBB, the caller 18819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// should take care of that. 18919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// 19019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// VNI may be null only if MBB is a live-through block also passed to 19119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// addLiveInBlock(). 19219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman void setLiveOutValue(MachineBasicBlock *MBB, VNInfo *VNI) { 19319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman Seen.set(MBB->getNumber()); 19419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman LiveOut[MBB] = LiveOutPair(VNI, (MachineDomTreeNode *)0); 19519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman } 19619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 19719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// addLiveInBlock - Add a block with an unknown live-in value. This 19819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// function can only be called once per basic block. Once the live-in value 19919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// has been determined, calculateValues() will add liveness to LI. 20019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// 20119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// @param LI The live range that is live-in to the block. 20219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// @param DomNode The domtree node for the block. 20319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// @param Kill Index in block where LI is killed. If the value is 20419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// live-through, set Kill = SLotIndex() and also call 20519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// setLiveOutValue(MBB, 0). 20619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman void addLiveInBlock(LiveInterval *LI, 20719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman MachineDomTreeNode *DomNode, 20819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman SlotIndex Kill = SlotIndex()) { 20919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman LiveIn.push_back(LiveInBlock(LI, DomNode, Kill)); 21019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman } 21119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 21219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// calculateValues - Calculate the value that will be live-in to each block 21319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// added with addLiveInBlock. Add PHI-def values as needed to preserve SSA 21419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// form. Add liveness to all live-in blocks up to the Kill point, or the 21519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// whole block for live-through blocks. 21619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// 21719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// Every predecessor of a live-in block must have been given a value with 21819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman /// setLiveOutValue, the value may be null for live-trough blocks. 21919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman void calculateValues(SlotIndexes *Indexes, 22019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman MachineDominatorTree *DomTree, 22119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman VNInfo::Allocator *Alloc); 22219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman}; 22319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 22419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman} // end namespace llvm 22519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman 22619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#endif 227