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 #include "llvm/Support/Compiler.h" 21 22 namespace llvm { 23 24 class GlobalValue; 25 class TargetMachine; 26 27 /// Manages creation of pseudo source values. 28 class PseudoSourceValueManager { 29 const TargetMachine &TM; 30 const PseudoSourceValue StackPSV, GOTPSV, JumpTablePSV, ConstantPoolPSV; 31 SmallVector<std::unique_ptr<FixedStackPseudoSourceValue>> FSValues; 32 StringMap<std::unique_ptr<const ExternalSymbolPseudoSourceValue>> 33 ExternalCallEntries; 34 ValueMap<const GlobalValue *, 35 std::unique_ptr<const GlobalValuePseudoSourceValue>> 36 GlobalCallEntries; 37 38 public: 39 LLVM_ABI PseudoSourceValueManager(const TargetMachine &TM); 40 41 /// Return a pseudo source value referencing the area below the stack frame of 42 /// a function, e.g., the argument space. 43 LLVM_ABI const PseudoSourceValue *getStack(); 44 45 /// Return a pseudo source value referencing the global offset table 46 /// (or something the like). 47 LLVM_ABI const PseudoSourceValue *getGOT(); 48 49 /// Return a pseudo source value referencing the constant pool. Since constant 50 /// pools are constant, this doesn't need to identify a specific constant 51 /// pool entry. 52 LLVM_ABI const PseudoSourceValue *getConstantPool(); 53 54 /// Return a pseudo source value referencing a jump table. Since jump tables 55 /// are constant, this doesn't need to identify a specific jump table. 56 LLVM_ABI const PseudoSourceValue *getJumpTable(); 57 58 /// Return a pseudo source value referencing a fixed stack frame entry, 59 /// e.g., a spill slot. 60 LLVM_ABI const PseudoSourceValue *getFixedStack(int FI); 61 62 LLVM_ABI const PseudoSourceValue * 63 getGlobalValueCallEntry(const GlobalValue *GV); 64 65 LLVM_ABI const PseudoSourceValue *getExternalSymbolCallEntry(const char *ES); 66 }; 67 68 } // end namespace llvm 69 70 #endif 71