aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/PseudoSourceValue.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/PseudoSourceValue.cpp')
-rw-r--r--llvm/lib/CodeGen/PseudoSourceValue.cpp46
1 files changed, 20 insertions, 26 deletions
diff --git a/llvm/lib/CodeGen/PseudoSourceValue.cpp b/llvm/lib/CodeGen/PseudoSourceValue.cpp
index 74e721dbd138..40c52b9d9707 100644
--- a/llvm/lib/CodeGen/PseudoSourceValue.cpp
+++ b/llvm/lib/CodeGen/PseudoSourceValue.cpp
@@ -11,26 +11,23 @@
//===----------------------------------------------------------------------===//
#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"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Target/TargetMachine.h"
+
using namespace llvm;
static const char *const PSVNames[] = {
"Stack", "GOT", "JumpTable", "ConstantPool", "FixedStack",
"GlobalValueCallEntry", "ExternalSymbolCallEntry"};
-PseudoSourceValue::PseudoSourceValue(unsigned Kind, const TargetInstrInfo &TII)
+PseudoSourceValue::PseudoSourceValue(unsigned Kind, const TargetMachine &TM)
: Kind(Kind) {
- AddressSpace = TII.getAddressSpaceForPseudoSourceKind(Kind);
+ AddressSpace = TM.getAddressSpaceForPseudoSourceKind(Kind);
}
-
-PseudoSourceValue::~PseudoSourceValue() {}
+PseudoSourceValue::~PseudoSourceValue() = default;
void PseudoSourceValue::printCustom(raw_ostream &O) const {
if (Kind < TargetCustom)
@@ -79,9 +76,9 @@ void FixedStackPseudoSourceValue::printCustom(raw_ostream &OS) const {
OS << "FixedStack" << FI;
}
-CallEntryPseudoSourceValue::CallEntryPseudoSourceValue(
- unsigned Kind, const TargetInstrInfo &TII)
- : PseudoSourceValue(Kind, TII) {}
+CallEntryPseudoSourceValue::CallEntryPseudoSourceValue(unsigned Kind,
+ const TargetMachine &TM)
+ : PseudoSourceValue(Kind, TM) {}
bool CallEntryPseudoSourceValue::isConstant(const MachineFrameInfo *) const {
return false;
@@ -96,20 +93,17 @@ bool CallEntryPseudoSourceValue::mayAlias(const MachineFrameInfo *) const {
}
GlobalValuePseudoSourceValue::GlobalValuePseudoSourceValue(
- const GlobalValue *GV,
- const TargetInstrInfo &TII)
- : CallEntryPseudoSourceValue(GlobalValueCallEntry, TII), GV(GV) {}
+ const GlobalValue *GV, const TargetMachine &TM)
+ : CallEntryPseudoSourceValue(GlobalValueCallEntry, TM), GV(GV) {}
ExternalSymbolPseudoSourceValue::ExternalSymbolPseudoSourceValue(
- const char *ES, const TargetInstrInfo &TII)
- : CallEntryPseudoSourceValue(ExternalSymbolCallEntry, TII), ES(ES) {}
+ const char *ES, const TargetMachine &TM)
+ : CallEntryPseudoSourceValue(ExternalSymbolCallEntry, TM), 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) {}
+PseudoSourceValueManager::PseudoSourceValueManager(const TargetMachine &TMInfo)
+ : TM(TMInfo), StackPSV(PseudoSourceValue::Stack, TM),
+ GOTPSV(PseudoSourceValue::GOT, TM),
+ JumpTablePSV(PseudoSourceValue::JumpTable, TM),
+ ConstantPoolPSV(PseudoSourceValue::ConstantPool, TM) {}
const PseudoSourceValue *PseudoSourceValueManager::getStack() {
return &StackPSV;
@@ -129,7 +123,7 @@ const PseudoSourceValue *
PseudoSourceValueManager::getFixedStack(int FI) {
std::unique_ptr<FixedStackPseudoSourceValue> &V = FSValues[FI];
if (!V)
- V = std::make_unique<FixedStackPseudoSourceValue>(FI, TII);
+ V = std::make_unique<FixedStackPseudoSourceValue>(FI, TM);
return V.get();
}
@@ -138,7 +132,7 @@ PseudoSourceValueManager::getGlobalValueCallEntry(const GlobalValue *GV) {
std::unique_ptr<const GlobalValuePseudoSourceValue> &E =
GlobalCallEntries[GV];
if (!E)
- E = std::make_unique<GlobalValuePseudoSourceValue>(GV, TII);
+ E = std::make_unique<GlobalValuePseudoSourceValue>(GV, TM);
return E.get();
}
@@ -147,6 +141,6 @@ PseudoSourceValueManager::getExternalSymbolCallEntry(const char *ES) {
std::unique_ptr<const ExternalSymbolPseudoSourceValue> &E =
ExternalCallEntries[ES];
if (!E)
- E = std::make_unique<ExternalSymbolPseudoSourceValue>(ES, TII);
+ E = std::make_unique<ExternalSymbolPseudoSourceValue>(ES, TM);
return E.get();
}