blob: c62e49a4b0823cdf51051b9c6d75eb4fd78f5abb [file] [log] [blame]
Dan Gohman69de1932008-02-06 22:27:42 +00001//===-- 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
18namespace llvm {
19 static ManagedStatic<PseudoSourceValue[5]> PSVs;
20
Dan Gohmandebeeba2008-02-11 18:57:43 +000021 const PseudoSourceValue *PseudoSourceValue::getFixedStack()
22 { return &(*PSVs)[0]; }
23 const PseudoSourceValue *PseudoSourceValue::getStack()
24 { return &(*PSVs)[1]; }
25 const PseudoSourceValue *PseudoSourceValue::getGOT()
26 { return &(*PSVs)[2]; }
27 const PseudoSourceValue *PseudoSourceValue::getConstantPool()
28 { return &(*PSVs)[3]; }
29 const PseudoSourceValue *PseudoSourceValue::getJumpTable()
30 { return &(*PSVs)[4]; }
Dan Gohman69de1932008-02-06 22:27:42 +000031
Dan Gohmancfbb2f02008-03-25 21:45:14 +000032 static const char *const PSVNames[] = {
Dan Gohman69de1932008-02-06 22:27:42 +000033 "FixedStack",
34 "Stack",
35 "GOT",
36 "ConstantPool",
37 "JumpTable"
38 };
39
40 PseudoSourceValue::PseudoSourceValue() :
41 Value(PointerType::getUnqual(Type::Int8Ty), PseudoSourceValueVal) {}
42
43 void PseudoSourceValue::print(std::ostream &OS) const {
44 OS << PSVNames[this - *PSVs];
45 }
46}