mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
InstrProf: SIL-level coverage mapping and lowering to LLVM
The adds the sil_coveragemap construct to SIL and the needed IRGen to turn these into LLVM's coverage maps. Swift SVN r25210
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "swift/AST/SILOptions.h"
|
||||
#include "swift/Basic/LangOptions.h"
|
||||
#include "swift/Basic/Range.h"
|
||||
#include "swift/SIL/SILCoverageMap.h"
|
||||
#include "swift/SIL/SILDeclRef.h"
|
||||
#include "swift/SIL/SILFunction.h"
|
||||
#include "swift/SIL/SILGlobalVariable.h"
|
||||
@@ -77,10 +78,12 @@ public:
|
||||
using GlobalListType = llvm::ilist<SILGlobalVariable>;
|
||||
using VTableListType = llvm::ilist<SILVTable>;
|
||||
using WitnessTableListType = llvm::ilist<SILWitnessTable>;
|
||||
using CoverageMapListType = llvm::ilist<SILCoverageMap>;
|
||||
using LinkingMode = SILOptions::LinkingMode;
|
||||
|
||||
private:
|
||||
friend class SILBasicBlock;
|
||||
friend class SILCoverageMap;
|
||||
friend class SILFunction;
|
||||
friend class SILGlobalVariable;
|
||||
friend class SILType;
|
||||
@@ -137,6 +140,9 @@ private:
|
||||
/// The list of SILGlobalVariables in the module.
|
||||
GlobalListType silGlobals;
|
||||
|
||||
// The list of SILCoverageMaps in the module.
|
||||
CoverageMapListType coverageMaps;
|
||||
|
||||
/// This is a cache of intrinsic Function declarations to numeric ID mappings.
|
||||
llvm::DenseMap<Identifier, IntrinsicInfo> IntrinsicIDCache;
|
||||
|
||||
@@ -319,6 +325,25 @@ public:
|
||||
return {silGlobals.begin(), silGlobals.end()};
|
||||
}
|
||||
|
||||
using coverage_map_iterator = CoverageMapListType::iterator;
|
||||
using coverage_map_const_iterator = CoverageMapListType::const_iterator;
|
||||
CoverageMapListType &getCoverageMapList() { return coverageMaps; }
|
||||
const CoverageMapListType &getCoverageMapList() const { return coverageMaps; }
|
||||
coverage_map_iterator coverage_map_begin() { return coverageMaps.begin(); }
|
||||
coverage_map_iterator coverage_map_end() { return coverageMaps.end(); }
|
||||
coverage_map_const_iterator coverage_map_begin() const {
|
||||
return coverageMaps.begin();
|
||||
}
|
||||
coverage_map_const_iterator coverage_map_end() const {
|
||||
return coverageMaps.end();
|
||||
}
|
||||
Range<coverage_map_iterator> getCoverageMaps() {
|
||||
return {coverageMaps.begin(), coverageMaps.end()};
|
||||
}
|
||||
Range<coverage_map_const_iterator> getCoverageMaps() const {
|
||||
return {coverageMaps.begin(), coverageMaps.end()};
|
||||
}
|
||||
|
||||
/// Look for a global variable by name.
|
||||
///
|
||||
/// \return null if this module has no such global variable
|
||||
|
||||
Reference in New Issue
Block a user