summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/PseudoSourceValue.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-07-25 00:02:30 +0000
committerDan Gohman <gohman@apple.com>2008-07-25 00:02:30 +0000
commit09b0448dbc863d63d5494bb3d88365fde4703dab (patch)
tree7354c0ed04c76f73a2cec3580e195682fb198b81 /llvm/lib/CodeGen/PseudoSourceValue.cpp
parent5eb536b74c231e114ee52939ca811efe844d814f (diff)
downloadbcm5719-llvm-09b0448dbc863d63d5494bb3d88365fde4703dab.tar.gz
bcm5719-llvm-09b0448dbc863d63d5494bb3d88365fde4703dab.zip
Enable rematerialization of constants using AliasAnalysis::pointsToConstantMemory,
and knowledge of PseudoSourceValues. This unfortunately isn't sufficient to allow constants to be rematerialized in PIC mode -- the extra indirection is a complication. llvm-svn: 54000
Diffstat (limited to 'llvm/lib/CodeGen/PseudoSourceValue.cpp')
-rw-r--r--llvm/lib/CodeGen/PseudoSourceValue.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/PseudoSourceValue.cpp b/llvm/lib/CodeGen/PseudoSourceValue.cpp
index 27995547c60..bcf4ea8fb75 100644
--- a/llvm/lib/CodeGen/PseudoSourceValue.cpp
+++ b/llvm/lib/CodeGen/PseudoSourceValue.cpp
@@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/PseudoSourceValue.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Support/Compiler.h"
@@ -51,6 +52,9 @@ namespace llvm {
const int FI;
public:
explicit FixedStackPseudoSourceValue(int fi) : FI(fi) {}
+
+ virtual bool isConstant(const MachineFrameInfo *MFI) const;
+
virtual void print(std::ostream &OS) const {
OS << "FixedStack" << FI;
}
@@ -64,4 +68,20 @@ namespace llvm {
V = new FixedStackPseudoSourceValue(FI);
return V;
}
+
+ bool PseudoSourceValue::isConstant(const MachineFrameInfo *) const {
+ if (this == getStack())
+ return false;
+ if (this == getGOT() ||
+ this == getConstantPool() ||
+ this == getJumpTable())
+ return true;
+ assert(0 && "Unknown PseudoSourceValue!");
+ return false;
+ }
+
+ bool
+ FixedStackPseudoSourceValue::isConstant(const MachineFrameInfo *MFI) const {
+ return MFI && MFI->isImmutableObjectIndex(FI);
+ }
}
OpenPOWER on IntegriCloud