aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/PseudoSourceValue.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/PseudoSourceValue.cpp')
-rw-r--r--lib/CodeGen/PseudoSourceValue.cpp45
1 files changed, 28 insertions, 17 deletions
diff --git a/lib/CodeGen/PseudoSourceValue.cpp b/lib/CodeGen/PseudoSourceValue.cpp
index b29e62bf1aa3..86fd87450521 100644
--- a/lib/CodeGen/PseudoSourceValue.cpp
+++ b/lib/CodeGen/PseudoSourceValue.cpp
@@ -14,6 +14,7 @@
#include "llvm/CodeGen/PseudoSourceValue.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
+#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Support/ErrorHandling.h"
@@ -24,7 +25,11 @@ static const char *const PSVNames[] = {
"Stack", "GOT", "JumpTable", "ConstantPool", "FixedStack",
"GlobalValueCallEntry", "ExternalSymbolCallEntry"};
-PseudoSourceValue::PseudoSourceValue(PSVKind Kind) : Kind(Kind) {}
+PseudoSourceValue::PseudoSourceValue(PSVKind Kind, const TargetInstrInfo &TII)
+ : Kind(Kind) {
+ AddressSpace = TII.getAddressSpaceForPseudoSourceKind(Kind);
+}
+
PseudoSourceValue::~PseudoSourceValue() {}
@@ -75,8 +80,9 @@ void FixedStackPseudoSourceValue::printCustom(raw_ostream &OS) const {
OS << "FixedStack" << FI;
}
-CallEntryPseudoSourceValue::CallEntryPseudoSourceValue(PSVKind Kind)
- : PseudoSourceValue(Kind) {}
+CallEntryPseudoSourceValue::CallEntryPseudoSourceValue(
+ PSVKind Kind, const TargetInstrInfo &TII)
+ : PseudoSourceValue(Kind, TII) {}
bool CallEntryPseudoSourceValue::isConstant(const MachineFrameInfo *) const {
return false;
@@ -91,16 +97,20 @@ bool CallEntryPseudoSourceValue::mayAlias(const MachineFrameInfo *) const {
}
GlobalValuePseudoSourceValue::GlobalValuePseudoSourceValue(
- const GlobalValue *GV)
- : CallEntryPseudoSourceValue(GlobalValueCallEntry), GV(GV) {}
-
-ExternalSymbolPseudoSourceValue::ExternalSymbolPseudoSourceValue(const char *ES)
- : CallEntryPseudoSourceValue(ExternalSymbolCallEntry), ES(ES) {}
-
-PseudoSourceValueManager::PseudoSourceValueManager()
- : StackPSV(PseudoSourceValue::Stack), GOTPSV(PseudoSourceValue::GOT),
- JumpTablePSV(PseudoSourceValue::JumpTable),
- ConstantPoolPSV(PseudoSourceValue::ConstantPool) {}
+ const GlobalValue *GV,
+ const TargetInstrInfo &TII)
+ : CallEntryPseudoSourceValue(GlobalValueCallEntry, TII), GV(GV) {}
+ExternalSymbolPseudoSourceValue::ExternalSymbolPseudoSourceValue(
+ const char *ES, const TargetInstrInfo &TII)
+ : CallEntryPseudoSourceValue(ExternalSymbolCallEntry, TII), ES(ES) {}
+
+PseudoSourceValueManager::PseudoSourceValueManager(
+ const TargetInstrInfo &TIInfo)
+ : TII(TIInfo),
+ StackPSV(PseudoSourceValue::Stack, TII),
+ GOTPSV(PseudoSourceValue::GOT, TII),
+ JumpTablePSV(PseudoSourceValue::JumpTable, TII),
+ ConstantPoolPSV(PseudoSourceValue::ConstantPool, TII) {}
const PseudoSourceValue *PseudoSourceValueManager::getStack() {
return &StackPSV;
@@ -116,10 +126,11 @@ const PseudoSourceValue *PseudoSourceValueManager::getJumpTable() {
return &JumpTablePSV;
}
-const PseudoSourceValue *PseudoSourceValueManager::getFixedStack(int FI) {
+const PseudoSourceValue *
+PseudoSourceValueManager::getFixedStack(int FI) {
std::unique_ptr<FixedStackPseudoSourceValue> &V = FSValues[FI];
if (!V)
- V = llvm::make_unique<FixedStackPseudoSourceValue>(FI);
+ V = llvm::make_unique<FixedStackPseudoSourceValue>(FI, TII);
return V.get();
}
@@ -128,7 +139,7 @@ PseudoSourceValueManager::getGlobalValueCallEntry(const GlobalValue *GV) {
std::unique_ptr<const GlobalValuePseudoSourceValue> &E =
GlobalCallEntries[GV];
if (!E)
- E = llvm::make_unique<GlobalValuePseudoSourceValue>(GV);
+ E = llvm::make_unique<GlobalValuePseudoSourceValue>(GV, TII);
return E.get();
}
@@ -137,6 +148,6 @@ PseudoSourceValueManager::getExternalSymbolCallEntry(const char *ES) {
std::unique_ptr<const ExternalSymbolPseudoSourceValue> &E =
ExternalCallEntries[ES];
if (!E)
- E = llvm::make_unique<ExternalSymbolPseudoSourceValue>(ES);
+ E = llvm::make_unique<ExternalSymbolPseudoSourceValue>(ES, TII);
return E.get();
}