#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];
}
}