Update prebuilt Clang to r416183b from Android.
https://android.googlesource.com/platform/prebuilts/clang/host/
linux-x86/+/06a71ddac05c22edb2d10b590e1769b3f8619bef
clang 12.0.5 (based on r416183b) from build 7284624.
Change-Id: I277a316abcf47307562d8b748b84870f31a72866
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/linux-x64/clang/include/llvm/Analysis/StackSafetyAnalysis.h b/linux-x64/clang/include/llvm/Analysis/StackSafetyAnalysis.h
index f9d8b08..59c1e3e 100644
--- a/linux-x64/clang/include/llvm/Analysis/StackSafetyAnalysis.h
+++ b/linux-x64/clang/include/llvm/Analysis/StackSafetyAnalysis.h
@@ -13,28 +13,71 @@
#ifndef LLVM_ANALYSIS_STACKSAFETYANALYSIS_H
#define LLVM_ANALYSIS_STACKSAFETYANALYSIS_H
+#include "llvm/IR/ModuleSummaryIndex.h"
#include "llvm/IR/PassManager.h"
#include "llvm/Pass.h"
namespace llvm {
+class AllocaInst;
+class ScalarEvolution;
+
/// Interface to access stack safety analysis results for single function.
class StackSafetyInfo {
public:
- struct FunctionInfo;
+ struct InfoTy;
private:
- std::unique_ptr<FunctionInfo> Info;
+ Function *F = nullptr;
+ std::function<ScalarEvolution &()> GetSE;
+ mutable std::unique_ptr<InfoTy> Info;
public:
StackSafetyInfo();
- StackSafetyInfo(FunctionInfo &&Info);
+ StackSafetyInfo(Function *F, std::function<ScalarEvolution &()> GetSE);
StackSafetyInfo(StackSafetyInfo &&);
StackSafetyInfo &operator=(StackSafetyInfo &&);
~StackSafetyInfo();
+ const InfoTy &getInfo() const;
+
// TODO: Add useful for client methods.
void print(raw_ostream &O) const;
+
+ /// Parameters use for a FunctionSummary.
+ /// Function collects access information of all pointer parameters.
+ /// Information includes a range of direct access of parameters by the
+ /// functions and all call sites accepting the parameter.
+ /// StackSafety assumes that missing parameter information means possibility
+ /// of access to the parameter with any offset, so we can correctly link
+ /// code without StackSafety information, e.g. non-ThinLTO.
+ std::vector<FunctionSummary::ParamAccess>
+ getParamAccesses(ModuleSummaryIndex &Index) const;
+};
+
+class StackSafetyGlobalInfo {
+public:
+ struct InfoTy;
+
+private:
+ Module *M = nullptr;
+ std::function<const StackSafetyInfo &(Function &F)> GetSSI;
+ const ModuleSummaryIndex *Index = nullptr;
+ mutable std::unique_ptr<InfoTy> Info;
+ const InfoTy &getInfo() const;
+
+public:
+ StackSafetyGlobalInfo();
+ StackSafetyGlobalInfo(
+ Module *M, std::function<const StackSafetyInfo &(Function &F)> GetSSI,
+ const ModuleSummaryIndex *Index);
+ StackSafetyGlobalInfo(StackSafetyGlobalInfo &&);
+ StackSafetyGlobalInfo &operator=(StackSafetyGlobalInfo &&);
+ ~StackSafetyGlobalInfo();
+
+ bool isSafe(const AllocaInst &AI) const;
+ void print(raw_ostream &O) const;
+ void dump() const;
};
/// StackSafetyInfo wrapper for the new pass manager.
@@ -72,8 +115,6 @@
bool runOnFunction(Function &F) override;
};
-using StackSafetyGlobalInfo = std::map<const GlobalValue *, StackSafetyInfo>;
-
/// This pass performs the global (interprocedural) stack safety analysis (new
/// pass manager).
class StackSafetyGlobalAnalysis
@@ -99,14 +140,15 @@
/// This pass performs the global (interprocedural) stack safety analysis
/// (legacy pass manager).
class StackSafetyGlobalInfoWrapperPass : public ModulePass {
- StackSafetyGlobalInfo SSI;
+ StackSafetyGlobalInfo SSGI;
public:
static char ID;
StackSafetyGlobalInfoWrapperPass();
+ ~StackSafetyGlobalInfoWrapperPass();
- const StackSafetyGlobalInfo &getResult() const { return SSI; }
+ const StackSafetyGlobalInfo &getResult() const { return SSGI; }
void print(raw_ostream &O, const Module *M) const override;
void getAnalysisUsage(AnalysisUsage &AU) const override;
@@ -114,6 +156,10 @@
bool runOnModule(Module &M) override;
};
+bool needsParamAccessSummary(const Module &M);
+
+void generateParamAccessSummary(ModuleSummaryIndex &Index);
+
} // end namespace llvm
#endif // LLVM_ANALYSIS_STACKSAFETYANALYSIS_H