Deleted Added
full compact
PseudoSourceValue.cpp (198396) PseudoSourceValue.cpp (198892)
1//===-- llvm/CodeGen/PseudoSourceValue.cpp ----------------------*- 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// This file implements the PseudoSourceValue class.
11//
12//===----------------------------------------------------------------------===//
13
14#include "llvm/CodeGen/MachineFrameInfo.h"
15#include "llvm/CodeGen/PseudoSourceValue.h"
16#include "llvm/DerivedTypes.h"
1//===-- llvm/CodeGen/PseudoSourceValue.cpp ----------------------*- 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// This file implements the PseudoSourceValue class.
11//
12//===----------------------------------------------------------------------===//
13
14#include "llvm/CodeGen/MachineFrameInfo.h"
15#include "llvm/CodeGen/PseudoSourceValue.h"
16#include "llvm/DerivedTypes.h"
17#include "llvm/Support/Compiler.h"
17#include "llvm/LLVMContext.h"
18#include "llvm/Support/ErrorHandling.h"
19#include "llvm/Support/ManagedStatic.h"
20#include "llvm/Support/raw_ostream.h"
21#include <map>
22using namespace llvm;
23
24static ManagedStatic<PseudoSourceValue[4]> PSVs;
25

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

50void PseudoSourceValue::printCustom(raw_ostream &O) const {
51 O << PSVNames[this - *PSVs];
52}
53
54namespace {
55 /// FixedStackPseudoSourceValue - A specialized PseudoSourceValue
56 /// for holding FixedStack values, which must include a frame
57 /// index.
18#include "llvm/Support/ErrorHandling.h"
19#include "llvm/Support/ManagedStatic.h"
20#include "llvm/Support/raw_ostream.h"
21#include <map>
22using namespace llvm;
23
24static ManagedStatic<PseudoSourceValue[4]> PSVs;
25

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

50void PseudoSourceValue::printCustom(raw_ostream &O) const {
51 O << PSVNames[this - *PSVs];
52}
53
54namespace {
55 /// FixedStackPseudoSourceValue - A specialized PseudoSourceValue
56 /// for holding FixedStack values, which must include a frame
57 /// index.
58 class VISIBILITY_HIDDEN FixedStackPseudoSourceValue
59 : public PseudoSourceValue {
58 class FixedStackPseudoSourceValue : public PseudoSourceValue {
60 const int FI;
61 public:
62 explicit FixedStackPseudoSourceValue(int fi) : FI(fi) {}
63
64 virtual bool isConstant(const MachineFrameInfo *MFI) const;
65
66 virtual bool isAliased(const MachineFrameInfo *MFI) const;
67
59 const int FI;
60 public:
61 explicit FixedStackPseudoSourceValue(int fi) : FI(fi) {}
62
63 virtual bool isConstant(const MachineFrameInfo *MFI) const;
64
65 virtual bool isAliased(const MachineFrameInfo *MFI) const;
66
67 virtual bool mayAlias(const MachineFrameInfo *) const;
68
68 virtual void printCustom(raw_ostream &OS) const {
69 OS << "FixedStack" << FI;
70 }
71 };
72}
73
74static ManagedStatic<std::map<int, const PseudoSourceValue *> > FSValues;
75

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

96 this == getGOT() ||
97 this == getConstantPool() ||
98 this == getJumpTable())
99 return false;
100 llvm_unreachable("Unknown PseudoSourceValue!");
101 return true;
102}
103
69 virtual void printCustom(raw_ostream &OS) const {
70 OS << "FixedStack" << FI;
71 }
72 };
73}
74
75static ManagedStatic<std::map<int, const PseudoSourceValue *> > FSValues;
76

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

97 this == getGOT() ||
98 this == getConstantPool() ||
99 this == getJumpTable())
100 return false;
101 llvm_unreachable("Unknown PseudoSourceValue!");
102 return true;
103}
104
105bool PseudoSourceValue::mayAlias(const MachineFrameInfo *MFI) const {
106 if (this == getGOT() ||
107 this == getConstantPool() ||
108 this == getJumpTable())
109 return false;
110 return true;
111}
112
104bool FixedStackPseudoSourceValue::isConstant(const MachineFrameInfo *MFI) const{
105 return MFI && MFI->isImmutableObjectIndex(FI);
106}
107
108bool FixedStackPseudoSourceValue::isAliased(const MachineFrameInfo *MFI) const {
109 // Negative frame indices are used for special things that don't
110 // appear in LLVM IR. Non-negative indices may be used for things
111 // like static allocas.
112 if (!MFI)
113 return FI >= 0;
114 // Spill slots should not alias others.
115 return !MFI->isFixedObjectIndex(FI) && !MFI->isSpillSlotObjectIndex(FI);
116}
113bool FixedStackPseudoSourceValue::isConstant(const MachineFrameInfo *MFI) const{
114 return MFI && MFI->isImmutableObjectIndex(FI);
115}
116
117bool FixedStackPseudoSourceValue::isAliased(const MachineFrameInfo *MFI) const {
118 // Negative frame indices are used for special things that don't
119 // appear in LLVM IR. Non-negative indices may be used for things
120 // like static allocas.
121 if (!MFI)
122 return FI >= 0;
123 // Spill slots should not alias others.
124 return !MFI->isFixedObjectIndex(FI) && !MFI->isSpillSlotObjectIndex(FI);
125}
126
127bool FixedStackPseudoSourceValue::mayAlias(const MachineFrameInfo *MFI) const {
128 if (!MFI)
129 return true;
130 // Spill slots will not alias any LLVM IR value.
131 return !MFI->isSpillSlotObjectIndex(FI);
132}