llvm.org GIT mirror llvm / f38dc19
Add a new PseudoSourceValue class, which will be used to help track memory reference information in the backend. Most of this was written by Florian Brander, cleanup and updating to TOT by me. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46556 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 12 years ago
3 changed file(s) with 96 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 //===-- llvm/CodeGen/PseudoSourceValue.h ------------------------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains the declaration of the PseudoSourceValue class.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #ifndef LLVM_CODEGEN_PSEUDOSOURCEVALUE_H
14 #define LLVM_CODEGEN_PSEUDOSOURCEVALUE_H
15
16 #include "llvm/Value.h"
17
18 namespace llvm {
19 /// PseudoSourceValue - Special value supplied for machine level alias
20 /// analysis. It indicates that the a memory access references the functions
21 /// stack frame (e.g., a spill slot), below the stack frame (e.g., argument
22 /// space), or constant pool.
23 class PseudoSourceValue : public Value {
24 const char *name;
25 public:
26 explicit PseudoSourceValue(const char *_name);
27
28 virtual void print(std::ostream &OS) const;
29
30 /// classof - Methods for support type inquiry through isa, cast, and
31 /// dyn_cast:
32 ///
33 static inline bool classof(const PseudoSourceValue *) { return true; }
34 static inline bool classof(const Value *V) {
35 return V->getValueID() == PseudoSourceValueVal;
36 }
37
38 /// A pseudo source value referencing to the stack frame of a function,
39 /// e.g., a spill slot.
40 static const PseudoSourceValue FPRel;
41
42 /// A source value referencing the area below the stack frame of a function,
43 /// e.g., the argument space.
44 static const PseudoSourceValue SPRel;
45
46 /// A source value referencing the global offset table (or something the
47 /// like).
48 static const PseudoSourceValue GPRel;
49
50 /// A source value relative to some kind of thread id/pointer.
51 static const PseudoSourceValue TPRel;
52
53 /// A SV referencing the constant pool
54 static const PseudoSourceValue CPRel;
55
56 /// A SV referencing the jump table
57 static const PseudoSourceValue JTRel;
58 };
59 } // End llvm namespace
60
61 #endif
187187 ConstantPointerNullVal, // This is an instance of ConstantPointerNull
188188 InlineAsmVal, // This is an instance of InlineAsm
189189 InstructionVal, // This is an instance of Instruction
190 PseudoSourceValueVal, // This is an instance of PseudoSourceValue
190191
191192 // Markers:
192193 ConstantFirstVal = FunctionVal,
0 //===-- llvm/CodeGen/PseudoSourceValue.cpp ----------------------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the PseudoSourceValue class.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "llvm/CodeGen/PseudoSourceValue.h"
14 #include "llvm/DerivedTypes.h"
15
16 namespace llvm {
17 const PseudoSourceValue PseudoSourceValue::FPRel("FPRel");
18 const PseudoSourceValue PseudoSourceValue::SPRel("SPRel");
19 const PseudoSourceValue PseudoSourceValue::GPRel("GPRel");
20 const PseudoSourceValue PseudoSourceValue::TPRel("TPRel");
21 const PseudoSourceValue PseudoSourceValue::CPRel("CPRel");
22 const PseudoSourceValue PseudoSourceValue::JTRel("JTRel");
23
24 PseudoSourceValue::PseudoSourceValue(const char *_name) :
25 Value(PointerType::getUnqual(Type::Int8Ty), PseudoSourceValueVal),
26 name(_name) {
27 }
28
29 void PseudoSourceValue::print(std::ostream &OS) const {
30 OS << name;
31 }
32 }