From 312ccf761c034483f6bdcd659c44f56bc9818d96 Mon Sep 17 00:00:00 2001 From: Jan Sjodin Date: Thu, 14 Sep 2017 20:53:51 +0000 Subject: Add AddresSpace to PseudoSourceValue. Differential Revision: https://reviews.llvm.org/D35089 llvm-svn: 313297 --- llvm/lib/CodeGen/PseudoSourceValue.cpp | 45 +++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 17 deletions(-) (limited to 'llvm/lib/CodeGen/PseudoSourceValue.cpp') diff --git a/llvm/lib/CodeGen/PseudoSourceValue.cpp b/llvm/lib/CodeGen/PseudoSourceValue.cpp index b29e62bf1aa..5fa5587457d 100644 --- a/llvm/lib/CodeGen/PseudoSourceValue.cpp +++ b/llvm/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/Target/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 &V = FSValues[FI]; if (!V) - V = llvm::make_unique(FI); + V = llvm::make_unique(FI, TII); return V.get(); } @@ -128,7 +139,7 @@ PseudoSourceValueManager::getGlobalValueCallEntry(const GlobalValue *GV) { std::unique_ptr &E = GlobalCallEntries[GV]; if (!E) - E = llvm::make_unique(GV); + E = llvm::make_unique(GV, TII); return E.get(); } @@ -137,6 +148,6 @@ PseudoSourceValueManager::getExternalSymbolCallEntry(const char *ES) { std::unique_ptr &E = ExternalCallEntries[ES]; if (!E) - E = llvm::make_unique(ES); + E = llvm::make_unique(ES, TII); return E.get(); } -- cgit v1.2.3