diff options
author | Dan Gohman <gohman@apple.com> | 2008-07-11 22:44:52 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-07-11 22:44:52 +0000 |
commit | a54cf176613f9ae8301519a61b8935652c0fb8ae (patch) | |
tree | 5fb442b17f7de38a44e4b08e1e75b78ecd7a8614 /lib/CodeGen/PseudoSourceValue.cpp | |
parent | eca64f0980e3f686a36007c53272780119635337 (diff) | |
download | external_llvm-a54cf176613f9ae8301519a61b8935652c0fb8ae.zip external_llvm-a54cf176613f9ae8301519a61b8935652c0fb8ae.tar.gz external_llvm-a54cf176613f9ae8301519a61b8935652c0fb8ae.tar.bz2 |
Include a frame index in the "fixed stack" pseudo source value
instead of using the frame index for the SVOffset, which was
inconsistent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53486 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PseudoSourceValue.cpp')
-rw-r--r-- | lib/CodeGen/PseudoSourceValue.cpp | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/lib/CodeGen/PseudoSourceValue.cpp b/lib/CodeGen/PseudoSourceValue.cpp index c62e49a..ea704e6 100644 --- a/lib/CodeGen/PseudoSourceValue.cpp +++ b/lib/CodeGen/PseudoSourceValue.cpp @@ -13,28 +13,27 @@ #include "llvm/CodeGen/PseudoSourceValue.h" #include "llvm/DerivedTypes.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/ManagedStatic.h" +#include <map> namespace llvm { - static ManagedStatic<PseudoSourceValue[5]> PSVs; + static ManagedStatic<PseudoSourceValue[4]> PSVs; - const PseudoSourceValue *PseudoSourceValue::getFixedStack() - { return &(*PSVs)[0]; } const PseudoSourceValue *PseudoSourceValue::getStack() - { return &(*PSVs)[1]; } + { return &(*PSVs)[0]; } const PseudoSourceValue *PseudoSourceValue::getGOT() + { return &(*PSVs)[1]; } + const PseudoSourceValue *PseudoSourceValue::getJumpTable() { return &(*PSVs)[2]; } const PseudoSourceValue *PseudoSourceValue::getConstantPool() { return &(*PSVs)[3]; } - const PseudoSourceValue *PseudoSourceValue::getJumpTable() - { return &(*PSVs)[4]; } static const char *const PSVNames[] = { - "FixedStack", "Stack", "GOT", - "ConstantPool", "JumpTable" + "ConstantPool" }; PseudoSourceValue::PseudoSourceValue() : @@ -43,4 +42,26 @@ namespace llvm { void PseudoSourceValue::print(std::ostream &OS) const { OS << PSVNames[this - *PSVs]; } + + /// FixedStackPseudoSourceValue - A specialized PseudoSourceValue + /// for holding FixedStack values, which must include a frame + /// index. + class VISIBILITY_HIDDEN FixedStackPseudoSourceValue + : public PseudoSourceValue { + const int FI; + public: + explicit FixedStackPseudoSourceValue(int fi) : FI(fi) {} + virtual void print(std::ostream &OS) const { + OS << "FixedStack" << FI; + } + }; + + static ManagedStatic<std::map<int, const PseudoSourceValue *> > FSValues; + + const PseudoSourceValue *PseudoSourceValue::getFixedStack(int FI) { + const PseudoSourceValue *&V = (*FSValues)[FI]; + if (!V) + V = new FixedStackPseudoSourceValue(FI); + return V; + } } |