Deleted Added
full compact
InterferenceCache.cpp (221345) InterferenceCache.cpp (224145)
1//===-- InterferenceCache.h - Caching per-block interference ---*- C++ -*--===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// InterferenceCache remembers per-block interference in LiveIntervalUnions.
11//
12//===----------------------------------------------------------------------===//
13
14#define DEBUG_TYPE "regalloc"
15#include "InterferenceCache.h"
16#include "llvm/Target/TargetRegisterInfo.h"
1//===-- InterferenceCache.h - Caching per-block interference ---*- C++ -*--===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// InterferenceCache remembers per-block interference in LiveIntervalUnions.
11//
12//===----------------------------------------------------------------------===//
13
14#define DEBUG_TYPE "regalloc"
15#include "InterferenceCache.h"
16#include "llvm/Target/TargetRegisterInfo.h"
17#include "llvm/Support/ErrorHandling.h"
17
18using namespace llvm;
19
20void InterferenceCache::init(MachineFunction *mf,
21 LiveIntervalUnion *liuarray,
22 SlotIndexes *indexes,
23 const TargetRegisterInfo *tri) {
24 MF = mf;

--- 10 unchanged lines hidden (view full) ---

35 if (!Entries[E].valid(LIUArray, TRI))
36 Entries[E].revalidate();
37 return &Entries[E];
38 }
39 // No valid entry exists, pick the next round-robin entry.
40 E = RoundRobin;
41 if (++RoundRobin == CacheEntries)
42 RoundRobin = 0;
18
19using namespace llvm;
20
21void InterferenceCache::init(MachineFunction *mf,
22 LiveIntervalUnion *liuarray,
23 SlotIndexes *indexes,
24 const TargetRegisterInfo *tri) {
25 MF = mf;

--- 10 unchanged lines hidden (view full) ---

36 if (!Entries[E].valid(LIUArray, TRI))
37 Entries[E].revalidate();
38 return &Entries[E];
39 }
40 // No valid entry exists, pick the next round-robin entry.
41 E = RoundRobin;
42 if (++RoundRobin == CacheEntries)
43 RoundRobin = 0;
43 Entries[E].reset(PhysReg, LIUArray, TRI, MF);
44 PhysRegEntries[PhysReg] = E;
45 return &Entries[E];
44 for (unsigned i = 0; i != CacheEntries; ++i) {
45 // Skip entries that are in use.
46 if (Entries[E].hasRefs()) {
47 if (++E == CacheEntries)
48 E = 0;
49 continue;
50 }
51 Entries[E].reset(PhysReg, LIUArray, TRI, MF);
52 PhysRegEntries[PhysReg] = E;
53 return &Entries[E];
54 }
55 llvm_unreachable("Ran out of interference cache entries.");
46}
47
48/// revalidate - LIU contents have changed, update tags.
49void InterferenceCache::Entry::revalidate() {
50 // Invalidate all block entries.
51 ++Tag;
52 // Invalidate all iterators.
53 PrevPos = SlotIndex();
54 for (unsigned i = 0, e = Aliases.size(); i != e; ++i)
55 Aliases[i].second = Aliases[i].first->getTag();
56}
57
58void InterferenceCache::Entry::reset(unsigned physReg,
59 LiveIntervalUnion *LIUArray,
60 const TargetRegisterInfo *TRI,
61 const MachineFunction *MF) {
56}
57
58/// revalidate - LIU contents have changed, update tags.
59void InterferenceCache::Entry::revalidate() {
60 // Invalidate all block entries.
61 ++Tag;
62 // Invalidate all iterators.
63 PrevPos = SlotIndex();
64 for (unsigned i = 0, e = Aliases.size(); i != e; ++i)
65 Aliases[i].second = Aliases[i].first->getTag();
66}
67
68void InterferenceCache::Entry::reset(unsigned physReg,
69 LiveIntervalUnion *LIUArray,
70 const TargetRegisterInfo *TRI,
71 const MachineFunction *MF) {
72 assert(!hasRefs() && "Cannot reset cache entry with references");
62 // LIU's changed, invalidate cache.
63 ++Tag;
64 PhysReg = physReg;
65 Blocks.resize(MF->getNumBlockIDs());
66 Aliases.clear();
67 for (const unsigned *AS = TRI->getOverlaps(PhysReg); *AS; ++AS) {
68 LiveIntervalUnion *LIU = LIUArray + *AS;
69 Aliases.push_back(std::make_pair(LIU, LIU->getTag()));

--- 86 unchanged lines hidden ---
73 // LIU's changed, invalidate cache.
74 ++Tag;
75 PhysReg = physReg;
76 Blocks.resize(MF->getNumBlockIDs());
77 Aliases.clear();
78 for (const unsigned *AS = TRI->getOverlaps(PhysReg); *AS; ++AS) {
79 LiveIntervalUnion *LIU = LIUArray + *AS;
80 Aliases.push_back(std::make_pair(LIU, LIU->getTag()));

--- 86 unchanged lines hidden ---