1*5f757f3fSDimitry Andric //===-- llvm/CodeGen/PseudoSourceValueManager.h -----------------*- C++ -*-===//
2*5f757f3fSDimitry Andric //
3*5f757f3fSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*5f757f3fSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*5f757f3fSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*5f757f3fSDimitry Andric //
7*5f757f3fSDimitry Andric //===----------------------------------------------------------------------===//
8*5f757f3fSDimitry Andric //
9*5f757f3fSDimitry Andric // This file contains the declaration of the PseudoSourceValueManager class.
10*5f757f3fSDimitry Andric //
11*5f757f3fSDimitry Andric //===----------------------------------------------------------------------===//
12*5f757f3fSDimitry Andric 
13*5f757f3fSDimitry Andric #ifndef LLVM_CODEGEN_PSEUDOSOURCEVALUEMANAGER_H
14*5f757f3fSDimitry Andric #define LLVM_CODEGEN_PSEUDOSOURCEVALUEMANAGER_H
15*5f757f3fSDimitry Andric 
16*5f757f3fSDimitry Andric #include "llvm/ADT/StringMap.h"
17*5f757f3fSDimitry Andric #include "llvm/CodeGen/PseudoSourceValue.h"
18*5f757f3fSDimitry Andric #include "llvm/IR/ValueMap.h"
19*5f757f3fSDimitry Andric #include <map>
20*5f757f3fSDimitry Andric 
21*5f757f3fSDimitry Andric namespace llvm {
22*5f757f3fSDimitry Andric 
23*5f757f3fSDimitry Andric class GlobalValue;
24*5f757f3fSDimitry Andric class TargetMachine;
25*5f757f3fSDimitry Andric 
26*5f757f3fSDimitry Andric /// Manages creation of pseudo source values.
27*5f757f3fSDimitry Andric class PseudoSourceValueManager {
28*5f757f3fSDimitry Andric   const TargetMachine &TM;
29*5f757f3fSDimitry Andric   const PseudoSourceValue StackPSV, GOTPSV, JumpTablePSV, ConstantPoolPSV;
30*5f757f3fSDimitry Andric   std::map<int, std::unique_ptr<FixedStackPseudoSourceValue>> FSValues;
31*5f757f3fSDimitry Andric   StringMap<std::unique_ptr<const ExternalSymbolPseudoSourceValue>>
32*5f757f3fSDimitry Andric       ExternalCallEntries;
33*5f757f3fSDimitry Andric   ValueMap<const GlobalValue *,
34*5f757f3fSDimitry Andric            std::unique_ptr<const GlobalValuePseudoSourceValue>>
35*5f757f3fSDimitry Andric       GlobalCallEntries;
36*5f757f3fSDimitry Andric 
37*5f757f3fSDimitry Andric public:
38*5f757f3fSDimitry Andric   PseudoSourceValueManager(const TargetMachine &TM);
39*5f757f3fSDimitry Andric 
40*5f757f3fSDimitry Andric   /// Return a pseudo source value referencing the area below the stack frame of
41*5f757f3fSDimitry Andric   /// a function, e.g., the argument space.
42*5f757f3fSDimitry Andric   const PseudoSourceValue *getStack();
43*5f757f3fSDimitry Andric 
44*5f757f3fSDimitry Andric   /// Return a pseudo source value referencing the global offset table
45*5f757f3fSDimitry Andric   /// (or something the like).
46*5f757f3fSDimitry Andric   const PseudoSourceValue *getGOT();
47*5f757f3fSDimitry Andric 
48*5f757f3fSDimitry Andric   /// Return a pseudo source value referencing the constant pool. Since constant
49*5f757f3fSDimitry Andric   /// pools are constant, this doesn't need to identify a specific constant
50*5f757f3fSDimitry Andric   /// pool entry.
51*5f757f3fSDimitry Andric   const PseudoSourceValue *getConstantPool();
52*5f757f3fSDimitry Andric 
53*5f757f3fSDimitry Andric   /// Return a pseudo source value referencing a jump table. Since jump tables
54*5f757f3fSDimitry Andric   /// are constant, this doesn't need to identify a specific jump table.
55*5f757f3fSDimitry Andric   const PseudoSourceValue *getJumpTable();
56*5f757f3fSDimitry Andric 
57*5f757f3fSDimitry Andric   /// Return a pseudo source value referencing a fixed stack frame entry,
58*5f757f3fSDimitry Andric   /// e.g., a spill slot.
59*5f757f3fSDimitry Andric   const PseudoSourceValue *getFixedStack(int FI);
60*5f757f3fSDimitry Andric 
61*5f757f3fSDimitry Andric   const PseudoSourceValue *getGlobalValueCallEntry(const GlobalValue *GV);
62*5f757f3fSDimitry Andric 
63*5f757f3fSDimitry Andric   const PseudoSourceValue *getExternalSymbolCallEntry(const char *ES);
64*5f757f3fSDimitry Andric };
65*5f757f3fSDimitry Andric 
66*5f757f3fSDimitry Andric } // end namespace llvm
67*5f757f3fSDimitry Andric 
68*5f757f3fSDimitry Andric #endif
69