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