It is pointless to turn a UINT_TO_FP into an
[oota-llvm.git] / lib / CodeGen / PseudoSourceValue.cpp
index da9af49f944aa693783c98698fef06de179f4c59..c62e49a4b0823cdf51051b9c6d75eb4fd78f5abb 100644 (file)
 
 #include "llvm/CodeGen/PseudoSourceValue.h"
 #include "llvm/DerivedTypes.h"
+#include "llvm/Support/ManagedStatic.h"
 
 namespace llvm {
-  const PseudoSourceValue PseudoSourceValue::FPRel("FPRel");
-  const PseudoSourceValue PseudoSourceValue::SPRel("SPRel");
-  const PseudoSourceValue PseudoSourceValue::GPRel("GPRel");
-  const PseudoSourceValue PseudoSourceValue::TPRel("TPRel");
-  const PseudoSourceValue PseudoSourceValue::CPRel("CPRel");
-  const PseudoSourceValue PseudoSourceValue::JTRel("JTRel");
+  static ManagedStatic<PseudoSourceValue[5]> PSVs;
 
-  PseudoSourceValue::PseudoSourceValue(const char *_name) :
-    Value(PointerType::getUnqual(Type::Int8Ty), PseudoSourceValueVal),
-          name(_name) {
-  }
+  const PseudoSourceValue *PseudoSourceValue::getFixedStack()
+  { return &(*PSVs)[0]; }
+  const PseudoSourceValue *PseudoSourceValue::getStack()
+  { return &(*PSVs)[1]; }
+  const PseudoSourceValue *PseudoSourceValue::getGOT()
+  { 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"
+  };
+
+  PseudoSourceValue::PseudoSourceValue() :
+    Value(PointerType::getUnqual(Type::Int8Ty), PseudoSourceValueVal) {}
 
   void PseudoSourceValue::print(std::ostream &OS) const {
-    OS << name;
+    OS << PSVNames[this - *PSVs];
   }
 }