LLVM: include/llvm/Transforms/IPO/WholeProgramDevirt.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_TRANSFORMS_IPO_WHOLEPROGRAMDEVIRT_H

15#define LLVM_TRANSFORMS_IPO_WHOLEPROGRAMDEVIRT_H

16

21#include

22#include

23#include

24#include

25#include

26#include

27

28namespace llvm {

30

31template class ArrayRef;

36

38

39

40

42 std::vector<uint8_t> Bytes;

43

44

46

51 }

52 return std::make_pair(Bytes.data() + Pos, BytesUsed.data() + Pos);

53 }

54

55

56

60 for (unsigned I = 0; I != Size; ++I) {

61 DataUsed.first[I] = Val >> (I * 8);

62 assert(!DataUsed.second[I]);

63 DataUsed.second[I] = 0xff;

64 }

65 }

66

67

68

72 for (unsigned I = 0; I != Size; ++I) {

73 DataUsed.first[Size - I - 1] = Val >> (I * 8);

75 DataUsed.second[Size - I - 1] = 0xff;

76 }

77 }

78

79

82 if (b)

83 *DataUsed.first |= 1 << (Pos % 8);

84 assert(!(*DataUsed.second & (1 << Pos % 8)));

85 *DataUsed.second |= 1 << (Pos % 8);

86 }

87};

88

89

91

93

94

96

97

98

99

100

102

103

105};

106

107

119

120

123

124

127

128

130

131

132

134

135

136

138

139

141

142

144

145

146

147

148

150

151

152

153

154

155

157

158

159

163

164

165

169

170

175

176

181

182

183

184

192

193

201};

202

203

204

205

208

209

210

211

214 int64_t &OffsetByte, uint64_t &OffsetBit);

215

216

217

218

221 int64_t &OffsetByte, uint64_t &OffsetBit);

222

223}

224

241

251 Module &M, bool WholeProgramVisibilityEnabledInLTO,

253 bool ValidateAllVtablesHaveTypeInfos,

259

264

265

266

267

268

269

270

271

273 ModuleSummaryIndex &Summary, std::setGlobalValue::GUID &ExportedGUIDs,

274 std::map<ValueInfo, std::vector> &LocalWPDTargetsMap);

275

276

277

281 std::map<ValueInfo, std::vector> &LocalWPDTargetsMap);

282

283}

284

285#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

This file defines the DenseSet and SmallDenseSet classes.

This header defines various interfaces for pass management in LLVM.

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

Implements a dense probed hash-table based set.

Class to hold module path string table and global value map, and encapsulate methods for operating on...

A Module instance is used to store all the information related to an LLVM module.

MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...

A set of analyses that are preserved following a run of a transformation pass.

StringRef - Represent a constant reference to a string, i.e.

An efficient, type-erasing, non-owning reference to a callable.

LLVM_ABI uint64_t findLowestOffset(ArrayRef< VirtualCallTarget > Targets, bool IsAfter, uint64_t Size)

LLVM_ABI void setAfterReturnValues(MutableArrayRef< VirtualCallTarget > Targets, uint64_t AllocAfter, unsigned BitWidth, int64_t &OffsetByte, uint64_t &OffsetBit)

LLVM_ABI void setBeforeReturnValues(MutableArrayRef< VirtualCallTarget > Targets, uint64_t AllocBefore, unsigned BitWidth, int64_t &OffsetByte, uint64_t &OffsetBit)

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI bool hasWholeProgramVisibility(bool WholeProgramVisibilityEnabledInLTO)

LLVM_ABI void updatePublicTypeTestCalls(Module &M, bool WholeProgramVisibilityEnabledInLTO)

LLVM_ABI void getVisibleToRegularObjVtableGUIDs(ModuleSummaryIndex &Index, DenseSet< GlobalValue::GUID > &VisibleToRegularObjSymbols, function_ref< bool(StringRef)> IsVisibleToRegularObj)

Based on typeID string, get all associated vtable GUIDS that are visible to regular objects.

LLVM_ABI void updateIndexWPDForExports(ModuleSummaryIndex &Summary, function_ref< bool(StringRef, ValueInfo)> isExported, std::map< ValueInfo, std::vector< VTableSlotSummary > > &LocalWPDTargetsMap)

Call after cross-module importing to update the recorded single impl devirt target names for any loca...

LLVM_ABI void runWholeProgramDevirtOnIndex(ModuleSummaryIndex &Summary, std::set< GlobalValue::GUID > &ExportedGUIDs, std::map< ValueInfo, std::vector< VTableSlotSummary > > &LocalWPDTargetsMap)

Perform index-based whole program devirtualization on the Summary index.

constexpr unsigned BitWidth

LLVM_ABI void updateVCallVisibilityInModule(Module &M, bool WholeProgramVisibilityEnabledInLTO, const DenseSet< GlobalValue::GUID > &DynamicExportSymbols, bool ValidateAllVtablesHaveTypeInfos, function_ref< bool(StringRef)> IsVisibleToRegularObj)

If whole program visibility asserted, then upgrade all public vcall visibility metadata on vtable def...

AnalysisManager< Module > ModuleAnalysisManager

Convenience typedef for the Module analysis manager.

LLVM_ABI void updateVCallVisibilityInIndex(ModuleSummaryIndex &Index, bool WholeProgramVisibilityEnabledInLTO, const DenseSet< GlobalValue::GUID > &DynamicExportSymbols, const DenseSet< GlobalValue::GUID > &VisibleToRegularObjSymbols)

If whole program visibility asserted, then upgrade all public vcall visibility metadata on vtable def...

A CRTP mix-in to automatically provide informational APIs needed for passes.

StringRef TypeID

Definition WholeProgramDevirt.h:243

uint64_t ByteOffset

Definition WholeProgramDevirt.h:244

Struct that holds a reference to a particular GUID in a global value summary.

WholeProgramDevirtPass(ModuleSummaryIndex *ExportSummary, const ModuleSummaryIndex *ImportSummary, bool DevirtSpeculatively=false)

Definition WholeProgramDevirt.h:232

bool UseCommandLine

Definition WholeProgramDevirt.h:228

WholeProgramDevirtPass()

Definition WholeProgramDevirt.h:230

bool DevirtSpeculatively

Definition WholeProgramDevirt.h:229

const ModuleSummaryIndex * ImportSummary

Definition WholeProgramDevirt.h:227

ModuleSummaryIndex * ExportSummary

Definition WholeProgramDevirt.h:226

LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &)

void setBit(uint64_t Pos, bool b)

Definition WholeProgramDevirt.h:80

void setBE(uint64_t Pos, uint64_t Val, uint8_t Size)

Definition WholeProgramDevirt.h:69

void setLE(uint64_t Pos, uint64_t Val, uint8_t Size)

Definition WholeProgramDevirt.h:57

std::vector< uint8_t > Bytes

Definition WholeProgramDevirt.h:42

std::pair< uint8_t *, uint8_t * > getPtrToData(uint64_t Pos, uint8_t Size)

Definition WholeProgramDevirt.h:47

std::vector< uint8_t > BytesUsed

Definition WholeProgramDevirt.h:45

VTableBits * Bits

Definition WholeProgramDevirt.h:110

uint64_t Offset

Definition WholeProgramDevirt.h:113

bool operator<(const TypeMemberInfo &other) const

Definition WholeProgramDevirt.h:115

uint64_t ObjectSize

Definition WholeProgramDevirt.h:95

AccumBitVector After

Definition WholeProgramDevirt.h:104

GlobalVariable * GV

Definition WholeProgramDevirt.h:92

AccumBitVector Before

Definition WholeProgramDevirt.h:101

uint64_t allocatedAfterBytes() const

Definition WholeProgramDevirt.h:166

VirtualCallTarget(const TypeMemberInfo *TM, bool IsBigEndian)

Definition WholeProgramDevirt.h:125

LLVM_ABI VirtualCallTarget(GlobalValue *Fn, const TypeMemberInfo *TM)

bool IsBigEndian

Definition WholeProgramDevirt.h:140

void setBeforeBit(uint64_t Pos)

Definition WholeProgramDevirt.h:171

GlobalValue * Fn

Definition WholeProgramDevirt.h:129

void setBeforeBytes(uint64_t Pos, uint8_t Size)

Definition WholeProgramDevirt.h:185

void setAfterBit(uint64_t Pos)

Definition WholeProgramDevirt.h:177

uint64_t allocatedBeforeBytes() const

Definition WholeProgramDevirt.h:160

uint64_t minBeforeBytes() const

Definition WholeProgramDevirt.h:149

void setAfterBytes(uint64_t Pos, uint8_t Size)

Definition WholeProgramDevirt.h:194

uint64_t minAfterBytes() const

Definition WholeProgramDevirt.h:156

uint64_t RetVal

Definition WholeProgramDevirt.h:137

const TypeMemberInfo * TM

Definition WholeProgramDevirt.h:133

bool WasDevirt

Definition WholeProgramDevirt.h:143