summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/PseudoSourceValue.cpp
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2015-08-11 23:23:17 +0000
committerAlex Lorenz <arphaman@gmail.com>2015-08-11 23:23:17 +0000
commit5659a2f961087728b8da9ff24fbf139ca90330ce (patch)
tree84ab4735889285ba922a5c1799c62c65cc7a9103 /llvm/lib/CodeGen/PseudoSourceValue.cpp
parent52a0f1e8c6f01a37be5b5e868eee8c0ff2958be0 (diff)
downloadbcm5719-llvm-5659a2f961087728b8da9ff24fbf139ca90330ce.tar.gz
bcm5719-llvm-5659a2f961087728b8da9ff24fbf139ca90330ce.zip
PseudoSourceValue: Transform the mips subclass to target independent subclasses
This commit transforms the mips-specific 'MipsCallEntry' subclass of the 'PseudoSourceValue' class into two, target-independent subclasses named 'GlobalValuePseudoSourceValue' and 'ExternalSymbolPseudoSourceValue'. This change makes it easier to serialize the pseudo source values by removing target-specific pseudo source values. Reviewers: Akira Hatanaka llvm-svn: 244698
Diffstat (limited to 'llvm/lib/CodeGen/PseudoSourceValue.cpp')
-rw-r--r--llvm/lib/CodeGen/PseudoSourceValue.cpp43
1 files changed, 42 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/PseudoSourceValue.cpp b/llvm/lib/CodeGen/PseudoSourceValue.cpp
index 79b09ee990e..da54c69e36c 100644
--- a/llvm/lib/CodeGen/PseudoSourceValue.cpp
+++ b/llvm/lib/CodeGen/PseudoSourceValue.cpp
@@ -24,7 +24,8 @@
using namespace llvm;
static const char *const PSVNames[] = {
- "Stack", "GOT", "JumpTable", "ConstantPool", "FixedStack", "MipsCallEntry"};
+ "Stack", "GOT", "JumpTable", "ConstantPool", "FixedStack",
+ "GlobalValueCallEntry", "ExternalSymbolCallEntry"};
PseudoSourceValue::PseudoSourceValue(PSVKind Kind) : Kind(Kind) {}
@@ -76,6 +77,28 @@ void FixedStackPseudoSourceValue::printCustom(raw_ostream &OS) const {
OS << "FixedStack" << FI;
}
+CallEntryPseudoSourceValue::CallEntryPseudoSourceValue(PSVKind Kind)
+ : PseudoSourceValue(Kind) {}
+
+bool CallEntryPseudoSourceValue::isConstant(const MachineFrameInfo *) const {
+ return false;
+}
+
+bool CallEntryPseudoSourceValue::isAliased(const MachineFrameInfo *) const {
+ return false;
+}
+
+bool CallEntryPseudoSourceValue::mayAlias(const MachineFrameInfo *) const {
+ return false;
+}
+
+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),
@@ -101,3 +124,21 @@ const PseudoSourceValue *PseudoSourceValueManager::getFixedStack(int FI) {
V = llvm::make_unique<FixedStackPseudoSourceValue>(FI);
return V.get();
}
+
+const PseudoSourceValue *
+PseudoSourceValueManager::getGlobalValueCallEntry(const GlobalValue *GV) {
+ std::unique_ptr<const GlobalValuePseudoSourceValue> &E =
+ GlobalCallEntries[GV];
+ if (!E)
+ E = llvm::make_unique<GlobalValuePseudoSourceValue>(GV);
+ return E.get();
+}
+
+const PseudoSourceValue *
+PseudoSourceValueManager::getExternalSymbolCallEntry(const char *ES) {
+ std::unique_ptr<const ExternalSymbolPseudoSourceValue> &E =
+ ExternalCallEntries[ES];
+ if (!E)
+ E = llvm::make_unique<ExternalSymbolPseudoSourceValue>(ES);
+ return E.get();
+}
OpenPOWER on IntegriCloud