Dan Gohman | 69de193 | 2008-02-06 22:27:42 +0000 | [diff] [blame^] | 1 | //===-- llvm/CodeGen/PseudoSourceValue.cpp ----------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file implements the PseudoSourceValue class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "llvm/CodeGen/PseudoSourceValue.h" |
| 15 | #include "llvm/DerivedTypes.h" |
| 16 | #include "llvm/Support/ManagedStatic.h" |
| 17 | |
| 18 | namespace llvm { |
| 19 | static ManagedStatic<PseudoSourceValue[5]> PSVs; |
| 20 | |
| 21 | const PseudoSourceValue &PseudoSourceValue::getFixedStack() { return (*PSVs)[0]; } |
| 22 | const PseudoSourceValue &PseudoSourceValue::getStack() { return (*PSVs)[1]; } |
| 23 | const PseudoSourceValue &PseudoSourceValue::getGOT() { return (*PSVs)[2]; } |
| 24 | const PseudoSourceValue &PseudoSourceValue::getConstantPool() { return (*PSVs)[3]; } |
| 25 | const PseudoSourceValue &PseudoSourceValue::getJumpTable() { return (*PSVs)[4]; } |
| 26 | |
| 27 | static const char *PSVNames[] = { |
| 28 | "FixedStack", |
| 29 | "Stack", |
| 30 | "GOT", |
| 31 | "ConstantPool", |
| 32 | "JumpTable" |
| 33 | }; |
| 34 | |
| 35 | PseudoSourceValue::PseudoSourceValue() : |
| 36 | Value(PointerType::getUnqual(Type::Int8Ty), PseudoSourceValueVal) {} |
| 37 | |
| 38 | void PseudoSourceValue::print(std::ostream &OS) const { |
| 39 | OS << PSVNames[this - *PSVs]; |
| 40 | } |
| 41 | } |