From a54cf176613f9ae8301519a61b8935652c0fb8ae Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 11 Jul 2008 22:44:52 +0000 Subject: 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 --- lib/CodeGen/PseudoSourceValue.cpp | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) (limited to 'lib/CodeGen/PseudoSourceValue.cpp') 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 namespace llvm { - static ManagedStatic PSVs; + static ManagedStatic 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 > FSValues; + + const PseudoSourceValue *PseudoSourceValue::getFixedStack(int FI) { + const PseudoSourceValue *&V = (*FSValues)[FI]; + if (!V) + V = new FixedStackPseudoSourceValue(FI); + return V; + } } -- cgit v1.1