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 | 02c7c6cb335ed3c5e3904c0676cc5ea04336a8c0 (patch) | |
tree | 5b6a66ac43f728b6dce8ef27f1518b1dd633696c /llvm/lib/CodeGen/PseudoSourceValue.cpp | |
parent | 1a7478451763d2af500cd3b2b8c10debae73cbe3 (diff) | |
download | bcm5719-llvm-02c7c6cb335ed3c5e3904c0676cc5ea04336a8c0.tar.gz bcm5719-llvm-02c7c6cb335ed3c5e3904c0676cc5ea04336a8c0.zip |
Include a frame index in the "fixed stack" pseudo source value
instead of using the frame index for the SVOffset, which was
inconsistent.
llvm-svn: 53486
Diffstat (limited to 'llvm/lib/CodeGen/PseudoSourceValue.cpp')
-rw-r--r-- | llvm/lib/CodeGen/PseudoSourceValue.cpp | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/PseudoSourceValue.cpp b/llvm/lib/CodeGen/PseudoSourceValue.cpp index c62e49a4b08..ea704e6e9c4 100644 --- a/llvm/lib/CodeGen/PseudoSourceValue.cpp +++ b/llvm/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; + } } |