Skip to content

Commit ea66814

Browse files
authored
[CodeGen] Split off PseudoSourceValueManager into separate header (NFC) (#73327)
Most users of PseudoSourceValue.h only need PseudoSourceValue, not the PseudoSourceValueManager. However, this header pulls in some very expensive dependencies like ValueMap.h, which is only used for the manager. Split off the manager into a separate header and include it only where used.
1 parent a3fe9cb commit ea66814

File tree

10 files changed

+76
-44
lines changed

10 files changed

+76
-44
lines changed

llvm/include/llvm/CodeGen/PseudoSourceValue.h

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
#ifndef LLVM_CODEGEN_PSEUDOSOURCEVALUE_H
1414
#define LLVM_CODEGEN_PSEUDOSOURCEVALUE_H
1515

16-
#include "llvm/ADT/StringMap.h"
17-
#include "llvm/IR/ValueMap.h"
18-
#include <map>
19-
2016
namespace llvm {
2117

2218
class GlobalValue;
@@ -151,46 +147,6 @@ class ExternalSymbolPseudoSourceValue : public CallEntryPseudoSourceValue {
151147
const char *getSymbol() const { return ES; }
152148
};
153149

154-
/// Manages creation of pseudo source values.
155-
class PseudoSourceValueManager {
156-
const TargetMachine &TM;
157-
const PseudoSourceValue StackPSV, GOTPSV, JumpTablePSV, ConstantPoolPSV;
158-
std::map<int, std::unique_ptr<FixedStackPseudoSourceValue>> FSValues;
159-
StringMap<std::unique_ptr<const ExternalSymbolPseudoSourceValue>>
160-
ExternalCallEntries;
161-
ValueMap<const GlobalValue *,
162-
std::unique_ptr<const GlobalValuePseudoSourceValue>>
163-
GlobalCallEntries;
164-
165-
public:
166-
PseudoSourceValueManager(const TargetMachine &TM);
167-
168-
/// Return a pseudo source value referencing the area below the stack frame of
169-
/// a function, e.g., the argument space.
170-
const PseudoSourceValue *getStack();
171-
172-
/// Return a pseudo source value referencing the global offset table
173-
/// (or something the like).
174-
const PseudoSourceValue *getGOT();
175-
176-
/// Return a pseudo source value referencing the constant pool. Since constant
177-
/// pools are constant, this doesn't need to identify a specific constant
178-
/// pool entry.
179-
const PseudoSourceValue *getConstantPool();
180-
181-
/// Return a pseudo source value referencing a jump table. Since jump tables
182-
/// are constant, this doesn't need to identify a specific jump table.
183-
const PseudoSourceValue *getJumpTable();
184-
185-
/// Return a pseudo source value referencing a fixed stack frame entry,
186-
/// e.g., a spill slot.
187-
const PseudoSourceValue *getFixedStack(int FI);
188-
189-
const PseudoSourceValue *getGlobalValueCallEntry(const GlobalValue *GV);
190-
191-
const PseudoSourceValue *getExternalSymbolCallEntry(const char *ES);
192-
};
193-
194150
} // end namespace llvm
195151

196152
#endif
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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/StringMap.h"
17+
#include "llvm/CodeGen/PseudoSourceValue.h"
18+
#include "llvm/IR/ValueMap.h"
19+
#include <map>
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+
std::map<int, 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

llvm/lib/CodeGen/MIRParser/MIParser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "llvm/CodeGen/MachineMemOperand.h"
3636
#include "llvm/CodeGen/MachineOperand.h"
3737
#include "llvm/CodeGen/MachineRegisterInfo.h"
38+
#include "llvm/CodeGen/PseudoSourceValueManager.h"
3839
#include "llvm/CodeGen/RegisterBank.h"
3940
#include "llvm/CodeGen/RegisterBankInfo.h"
4041
#include "llvm/CodeGen/TargetInstrInfo.h"

llvm/lib/CodeGen/MachineFunction.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "llvm/CodeGen/MachineModuleInfo.h"
3333
#include "llvm/CodeGen/MachineRegisterInfo.h"
3434
#include "llvm/CodeGen/PseudoSourceValue.h"
35+
#include "llvm/CodeGen/PseudoSourceValueManager.h"
3536
#include "llvm/CodeGen/TargetFrameLowering.h"
3637
#include "llvm/CodeGen/TargetInstrInfo.h"
3738
#include "llvm/CodeGen/TargetLowering.h"

llvm/lib/CodeGen/MachineOperand.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "llvm/CodeGen/MachineFrameInfo.h"
1919
#include "llvm/CodeGen/MachineJumpTableInfo.h"
2020
#include "llvm/CodeGen/MachineRegisterInfo.h"
21+
#include "llvm/CodeGen/PseudoSourceValueManager.h"
2122
#include "llvm/CodeGen/TargetInstrInfo.h"
2223
#include "llvm/CodeGen/TargetRegisterInfo.h"
2324
#include "llvm/Config/llvm-config.h"

llvm/lib/CodeGen/PseudoSourceValue.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "llvm/CodeGen/PseudoSourceValue.h"
1414
#include "llvm/CodeGen/MachineFrameInfo.h"
15+
#include "llvm/CodeGen/PseudoSourceValueManager.h"
1516
#include "llvm/Support/ErrorHandling.h"
1617
#include "llvm/Support/raw_ostream.h"
1718
#include "llvm/Target/TargetMachine.h"

llvm/lib/CodeGen/StackColoring.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "llvm/CodeGen/MachineMemOperand.h"
3737
#include "llvm/CodeGen/MachineOperand.h"
3838
#include "llvm/CodeGen/Passes.h"
39+
#include "llvm/CodeGen/PseudoSourceValueManager.h"
3940
#include "llvm/CodeGen/SlotIndexes.h"
4041
#include "llvm/CodeGen/TargetOpcodes.h"
4142
#include "llvm/CodeGen/WinEHFuncInfo.h"

llvm/lib/CodeGen/StackSlotColoring.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "llvm/CodeGen/MachineOperand.h"
2828
#include "llvm/CodeGen/Passes.h"
2929
#include "llvm/CodeGen/PseudoSourceValue.h"
30+
#include "llvm/CodeGen/PseudoSourceValueManager.h"
3031
#include "llvm/CodeGen/SlotIndexes.h"
3132
#include "llvm/CodeGen/TargetInstrInfo.h"
3233
#include "llvm/CodeGen/TargetSubtargetInfo.h"

llvm/lib/Target/Mips/MipsMachineFunction.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "llvm/CodeGen/MachineFrameInfo.h"
1414
#include "llvm/CodeGen/MachineRegisterInfo.h"
1515
#include "llvm/CodeGen/PseudoSourceValue.h"
16+
#include "llvm/CodeGen/PseudoSourceValueManager.h"
1617
#include "llvm/CodeGen/TargetRegisterInfo.h"
1718
#include "llvm/Support/CommandLine.h"
1819

llvm/tools/llvm-reduce/ReducerWorkItem.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "llvm/CodeGen/MachineJumpTableInfo.h"
2323
#include "llvm/CodeGen/MachineModuleInfo.h"
2424
#include "llvm/CodeGen/MachineRegisterInfo.h"
25+
#include "llvm/CodeGen/PseudoSourceValueManager.h"
2526
#include "llvm/CodeGen/TargetInstrInfo.h"
2627
#include "llvm/IR/Constants.h"
2728
#include "llvm/IR/Instructions.h"

0 commit comments

Comments
 (0)