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