[StackSafety] Add info into function summary
Summary: This patch adds optional field into function summary, implements asm and bitcode serialization. YAML serialization is omitted and can be added later if needed. This patch includes this information into summary only if module contains at least one sanitize_memtag function. In a near future MTE is the user of the analysis. Later if needed we can provede more direct control on when information is included into summary. Reviewers: eugenis Subscribers: hiraditya, steven_wu, dexonsmith, arphaman, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D80908
This commit is contained in:
@@ -3576,6 +3576,29 @@ static void writeFunctionTypeMetadataRecords(BitstreamWriter &Stream,
|
||||
FS->type_test_assume_const_vcalls());
|
||||
WriteConstVCallVec(bitc::FS_TYPE_CHECKED_LOAD_CONST_VCALL,
|
||||
FS->type_checked_load_const_vcalls());
|
||||
|
||||
auto WriteRange = [&](ConstantRange Range) {
|
||||
Range = Range.sextOrTrunc(FunctionSummary::ParamAccess::RangeWidth);
|
||||
assert(Range.getLower().getNumWords() == 1);
|
||||
assert(Range.getUpper().getNumWords() == 1);
|
||||
emitSignedInt64(Record, *Range.getLower().getRawData());
|
||||
emitSignedInt64(Record, *Range.getUpper().getRawData());
|
||||
};
|
||||
|
||||
if (!FS->paramAccesses().empty()) {
|
||||
Record.clear();
|
||||
for (auto &Arg : FS->paramAccesses()) {
|
||||
Record.push_back(Arg.ParamNo);
|
||||
WriteRange(Arg.Use);
|
||||
Record.push_back(Arg.Calls.size());
|
||||
for (auto &Call : Arg.Calls) {
|
||||
Record.push_back(Call.ParamNo);
|
||||
Record.push_back(Call.Callee);
|
||||
WriteRange(Call.Offsets);
|
||||
}
|
||||
}
|
||||
Stream.EmitRecord(bitc::FS_PARAM_ACCESS, Record);
|
||||
}
|
||||
}
|
||||
|
||||
/// Collect type IDs from type tests used by function.
|
||||
|
||||
Reference in New Issue
Block a user