mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-10 12:32:21 +00:00
Address Mehdi's post-commit review comments on r294795.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294822 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d46df28e0c
commit
049ef19b9c
@ -251,7 +251,8 @@ public:
|
||||
|
||||
/// An "identifier" for a virtual function. This contains the type identifier
|
||||
/// represented as a GUID and the offset from the address point to the virtual
|
||||
/// function pointer.
|
||||
/// function pointer, where "address point" is as defined in the Itanium ABI:
|
||||
/// https://mentorembedded.github.io/cxx-abi/abi.html#vtable-general
|
||||
struct VFuncId {
|
||||
GlobalValue::GUID GUID;
|
||||
uint64_t Offset;
|
||||
@ -273,19 +274,26 @@ private:
|
||||
/// List of <CalleeValueInfo, CalleeInfo> call edge pairs from this function.
|
||||
std::vector<EdgeTy> CallGraphEdgeList;
|
||||
|
||||
/// List of type identifiers used by this function in llvm.type.test
|
||||
/// intrinsics other than by an llvm.assume intrinsic, represented as GUIDs.
|
||||
std::vector<GlobalValue::GUID> TypeTests;
|
||||
/// All type identifier related information. Because these fields are
|
||||
/// relatively uncommon we only allocate space for them if necessary.
|
||||
struct TypeIdInfo {
|
||||
/// List of type identifiers used by this function in llvm.type.test
|
||||
/// intrinsics other than by an llvm.assume intrinsic, represented as GUIDs.
|
||||
std::vector<GlobalValue::GUID> TypeTests;
|
||||
|
||||
/// List of virtual calls made by this function using (respectively)
|
||||
/// llvm.assume(llvm.type.test) or llvm.type.checked.load intrinsics that do
|
||||
/// not have all constant integer arguments.
|
||||
std::vector<VFuncId> TypeTestAssumeVCalls, TypeCheckedLoadVCalls;
|
||||
/// List of virtual calls made by this function using (respectively)
|
||||
/// llvm.assume(llvm.type.test) or llvm.type.checked.load intrinsics that do
|
||||
/// not have all constant integer arguments.
|
||||
std::vector<VFuncId> TypeTestAssumeVCalls, TypeCheckedLoadVCalls;
|
||||
|
||||
/// List of virtual calls made by this function using (respectively)
|
||||
/// llvm.assume(llvm.type.test) or llvm.type.checked.load intrinsics with
|
||||
/// all constant integer arguments.
|
||||
std::vector<ConstVCall> TypeTestAssumeConstVCalls, TypeCheckedLoadConstVCalls;
|
||||
/// List of virtual calls made by this function using (respectively)
|
||||
/// llvm.assume(llvm.type.test) or llvm.type.checked.load intrinsics with
|
||||
/// all constant integer arguments.
|
||||
std::vector<ConstVCall> TypeTestAssumeConstVCalls,
|
||||
TypeCheckedLoadConstVCalls;
|
||||
};
|
||||
|
||||
std::unique_ptr<TypeIdInfo> TIdInfo;
|
||||
|
||||
public:
|
||||
/// Summary constructors.
|
||||
@ -297,12 +305,16 @@ public:
|
||||
std::vector<ConstVCall> TypeTestAssumeConstVCalls,
|
||||
std::vector<ConstVCall> TypeCheckedLoadConstVCalls)
|
||||
: GlobalValueSummary(FunctionKind, Flags, std::move(Refs)),
|
||||
InstCount(NumInsts), CallGraphEdgeList(std::move(CGEdges)),
|
||||
TypeTests(std::move(TypeTests)),
|
||||
TypeTestAssumeVCalls(std::move(TypeTestAssumeVCalls)),
|
||||
TypeCheckedLoadVCalls(std::move(TypeCheckedLoadVCalls)),
|
||||
TypeTestAssumeConstVCalls(std::move(TypeTestAssumeConstVCalls)),
|
||||
TypeCheckedLoadConstVCalls(std::move(TypeCheckedLoadConstVCalls)) {}
|
||||
InstCount(NumInsts), CallGraphEdgeList(std::move(CGEdges)) {
|
||||
if (!TypeTests.empty() || !TypeTestAssumeVCalls.empty() ||
|
||||
!TypeCheckedLoadVCalls.empty() || !TypeTestAssumeConstVCalls.empty() ||
|
||||
!TypeCheckedLoadConstVCalls.empty())
|
||||
TIdInfo = llvm::make_unique<TypeIdInfo>(TypeIdInfo{
|
||||
std::move(TypeTests), std::move(TypeTestAssumeVCalls),
|
||||
std::move(TypeCheckedLoadVCalls),
|
||||
std::move(TypeTestAssumeConstVCalls),
|
||||
std::move(TypeCheckedLoadConstVCalls)});
|
||||
}
|
||||
|
||||
/// Check if this is a function summary.
|
||||
static bool classof(const GlobalValueSummary *GVS) {
|
||||
@ -318,41 +330,51 @@ public:
|
||||
/// Returns the list of type identifiers used by this function in
|
||||
/// llvm.type.test intrinsics other than by an llvm.assume intrinsic,
|
||||
/// represented as GUIDs.
|
||||
ArrayRef<GlobalValue::GUID> type_tests() const { return TypeTests; }
|
||||
ArrayRef<GlobalValue::GUID> type_tests() const {
|
||||
if (TIdInfo)
|
||||
return TIdInfo->TypeTests;
|
||||
return {};
|
||||
}
|
||||
|
||||
/// Returns the list of virtual calls made by this function using
|
||||
/// llvm.assume(llvm.type.test) intrinsics that do not have all constant
|
||||
/// integer arguments.
|
||||
ArrayRef<VFuncId> type_test_assume_vcalls() const {
|
||||
return TypeTestAssumeVCalls;
|
||||
if (TIdInfo)
|
||||
return TIdInfo->TypeTestAssumeVCalls;
|
||||
return {};
|
||||
}
|
||||
|
||||
/// Returns the list of virtual calls made by this function using
|
||||
/// llvm.type.checked.load intrinsics that do not have all constant integer
|
||||
/// arguments.
|
||||
ArrayRef<VFuncId> type_checked_load_vcalls() const {
|
||||
return TypeCheckedLoadVCalls;
|
||||
if (TIdInfo)
|
||||
return TIdInfo->TypeCheckedLoadVCalls;
|
||||
return {};
|
||||
}
|
||||
|
||||
/// Returns the list of virtual calls made by this function using
|
||||
/// llvm.assume(llvm.type.test) intrinsics with all constant integer
|
||||
/// arguments.
|
||||
ArrayRef<ConstVCall> type_test_assume_const_vcalls() const {
|
||||
return TypeTestAssumeConstVCalls;
|
||||
if (TIdInfo)
|
||||
return TIdInfo->TypeTestAssumeConstVCalls;
|
||||
return {};
|
||||
}
|
||||
|
||||
/// Returns the list of virtual calls made by this function using
|
||||
/// llvm.type.checked.load intrinsics with all constant integer arguments.
|
||||
ArrayRef<ConstVCall> type_checked_load_const_vcalls() const {
|
||||
return TypeCheckedLoadConstVCalls;
|
||||
if (TIdInfo)
|
||||
return TIdInfo->TypeCheckedLoadConstVCalls;
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct DenseMapInfo<FunctionSummary::VFuncId> {
|
||||
static inline FunctionSummary::VFuncId getEmptyKey() {
|
||||
return {0, uint64_t(-1)};
|
||||
}
|
||||
static inline FunctionSummary::VFuncId getTombstoneKey() {
|
||||
static FunctionSummary::VFuncId getEmptyKey() { return {0, uint64_t(-1)}; }
|
||||
static FunctionSummary::VFuncId getTombstoneKey() {
|
||||
return {0, uint64_t(-2)};
|
||||
}
|
||||
static bool isEqual(FunctionSummary::VFuncId L, FunctionSummary::VFuncId R) {
|
||||
@ -362,10 +384,10 @@ template <> struct DenseMapInfo<FunctionSummary::VFuncId> {
|
||||
};
|
||||
|
||||
template <> struct DenseMapInfo<FunctionSummary::ConstVCall> {
|
||||
static inline FunctionSummary::ConstVCall getEmptyKey() {
|
||||
static FunctionSummary::ConstVCall getEmptyKey() {
|
||||
return {{0, uint64_t(-1)}, {}};
|
||||
}
|
||||
static inline FunctionSummary::ConstVCall getTombstoneKey() {
|
||||
static FunctionSummary::ConstVCall getTombstoneKey() {
|
||||
return {{0, uint64_t(-2)}, {}};
|
||||
}
|
||||
static bool isEqual(FunctionSummary::ConstVCall L,
|
||||
|
@ -4847,6 +4847,10 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(
|
||||
// "OriginalName" attachement.
|
||||
GlobalValueSummary *LastSeenSummary = nullptr;
|
||||
bool Combined = false;
|
||||
|
||||
// We can expect to see any number of type ID information records before
|
||||
// each function summary records; these variables store the information
|
||||
// collected so far so that it can be used to create the summary object.
|
||||
std::vector<GlobalValue::GUID> PendingTypeTests;
|
||||
std::vector<FunctionSummary::VFuncId> PendingTypeTestAssumeVCalls,
|
||||
PendingTypeCheckedLoadVCalls;
|
||||
|
Loading…
x
Reference in New Issue
Block a user