14 #ifndef LLVM_TRANSFORMS_IPO_WHOLEPROGRAMDEVIRT_H 15 #define LLVM_TRANSFORMS_IPO_WHOLEPROGRAMDEVIRT_H 28 template <
typename T>
class ArrayRef;
29 template <
typename T>
class MutableArrayRef;
32 class ModuleSummaryIndex;
46 if (Bytes.size() < Pos +
Size) {
47 Bytes.resize(Pos + Size);
48 BytesUsed.resize(Pos + Size);
50 return std::make_pair(Bytes.data() + Pos, BytesUsed.data() + Pos);
55 void setLE(uint64_t Pos, uint64_t Val, uint8_t
Size) {
58 for (
unsigned I = 0;
I !=
Size; ++
I) {
59 DataUsed.first[
I] = Val >> (
I * 8);
61 DataUsed.second[
I] = 0xff;
67 void setBE(uint64_t Pos, uint64_t Val, uint8_t
Size) {
70 for (
unsigned I = 0;
I !=
Size; ++
I) {
71 DataUsed.first[Size -
I - 1] = Val >> (
I * 8);
72 assert(!DataUsed.second[Size -
I - 1]);
73 DataUsed.second[Size -
I - 1] = 0xff;
81 *DataUsed.first |= 1 << (Pos % 8);
82 assert(!(*DataUsed.second & (1 << Pos % 8)));
83 *DataUsed.second |= 1 << (Pos % 8);
93 uint64_t ObjectSize = 0;
114 return Bits < other.
Bits || (Bits == other.
Bits && Offset < other.
Offset);
124 : Fn(nullptr), TM(TM), IsBigEndian(IsBigEndian), WasDevirt(
false) {}
170 assert(Pos >= 8 * minBeforeBytes());
176 assert(Pos >= 8 * minAfterBytes());
184 assert(Pos >= 8 * minBeforeBytes());
193 assert(Pos >= 8 * minAfterBytes());
211 uint64_t AllocBefore,
unsigned BitWidth,
212 int64_t &OffsetByte, uint64_t &OffsetBit);
218 uint64_t AllocAfter,
unsigned BitWidth,
219 int64_t &OffsetByte, uint64_t &OffsetBit);
228 : ExportSummary(ExportSummary), ImportSummary(ImportSummary) {
229 assert(!(ExportSummary && ImportSummary));
248 std::map<
ValueInfo, std::vector<VTableSlotSummary>> &LocalWPDTargetsMap);
255 std::map<
ValueInfo, std::vector<VTableSlotSummary>> &LocalWPDTargetsMap);
259 #endif // LLVM_TRANSFORMS_IPO_WHOLEPROGRAMDEVIRT_H
const ModuleSummaryIndex * ImportSummary
This class represents lattice values for constants.
void setBit(uint64_t Pos, bool b)
std::vector< uint8_t > BytesUsed
A Module instance is used to store all the information related to an LLVM module. ...
An efficient, type-erasing, non-owning reference to a callable.
void setAfterReturnValues(MutableArrayRef< VirtualCallTarget > Targets, uint64_t AllocAfter, unsigned BitWidth, int64_t &OffsetByte, uint64_t &OffsetBit)
WholeProgramDevirtPass(ModuleSummaryIndex *ExportSummary, const ModuleSummaryIndex *ImportSummary)
void setBeforeReturnValues(MutableArrayRef< VirtualCallTarget > Targets, uint64_t AllocBefore, unsigned BitWidth, int64_t &OffsetByte, uint64_t &OffsetBit)
uint64_t minAfterBytes() const
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...
A CRTP mix-in to automatically provide informational APIs needed for passes.
void setAfterBytes(uint64_t Pos, uint8_t Size)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Class to hold module path string table and global value map, and encapsulate methods for operating on...
VirtualCallTarget(const TypeMemberInfo *TM, bool IsBigEndian)
void setBeforeBytes(uint64_t Pos, uint8_t Size)
A set of analyses that are preserved following a run of a transformation pass.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
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.
Struct that holds a reference to a particular GUID in a global value summary.
uint64_t allocatedBeforeBytes() const
Module.h This file contains the declarations for the Module class.
void setBeforeBit(uint64_t Pos)
void setBE(uint64_t Pos, uint64_t Val, uint8_t Size)
ModuleSummaryIndex * ExportSummary
std::vector< uint8_t > Bytes
uint64_t findLowestOffset(ArrayRef< VirtualCallTarget > Targets, bool IsAfter, uint64_t Size)
void setAfterBit(uint64_t Pos)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
uint64_t minBeforeBytes() const
std::pair< uint8_t *, uint8_t * > getPtrToData(uint64_t Pos, uint8_t Size)
const TypeMemberInfo * TM
StringRef - Represent a constant reference to a string, i.e.
A container for analyses that lazily runs them and caches their results.
This header defines various interfaces for pass management in LLVM.
bool operator<(const TypeMemberInfo &other) const
uint64_t allocatedAfterBytes() const
void setLE(uint64_t Pos, uint64_t Val, uint8_t Size)