mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
076aeac7f3
This commit moves around most files. The new directory structure is as follows: * `lib/$LIBRARY/`: contains a library, i.e., a set of `.cpp` files used by multiple libraries/tools. * `include/revng/$LIBRARY/`: contains the public headers associated to the library in `lib/$LIBRARY/`. * `tools/$TOOL/`: directory where all the `.cpp` files (and private headers) for a tool reside. Currently we have two tools: `revamb` and `revamb-dump`. On top of this, all file names are now in camel case.
58 lines
1.2 KiB
C++
58 lines
1.2 KiB
C++
#ifndef STACKANALYSIS_H
|
|
#define STACKANALYSIS_H
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
// Standard includes
|
|
#include <string>
|
|
|
|
// LLVM includes
|
|
#include "llvm/Pass.h"
|
|
|
|
// Local libraries includes
|
|
#include "revng/BasicAnalyses/FunctionCallIdentification.h"
|
|
#include "revng/BasicAnalyses/GeneratedCodeBasicInfo.h"
|
|
#include "revng/StackAnalysis/FunctionsSummary.h"
|
|
|
|
namespace StackAnalysis {
|
|
|
|
template<bool AnalyzeABI>
|
|
class StackAnalysis : public llvm::FunctionPass {
|
|
|
|
public:
|
|
static char ID;
|
|
|
|
public:
|
|
StackAnalysis() : llvm::FunctionPass(ID) {}
|
|
|
|
void getAnalysisUsage(llvm::AnalysisUsage &AU) const override {
|
|
AU.setPreservesAll();
|
|
AU.addRequired<GeneratedCodeBasicInfo>();
|
|
}
|
|
|
|
bool runOnFunction(llvm::Function &F) override;
|
|
|
|
const std::set<const llvm::GlobalVariable *> &
|
|
getClobbered(llvm::BasicBlock *Function) {
|
|
return GrandResult.Functions[Function].ClobberedRegisters;
|
|
}
|
|
|
|
void serialize(std::ostream &Output) { Output << TextRepresentation; }
|
|
|
|
private:
|
|
FunctionsSummary GrandResult;
|
|
std::string TextRepresentation;
|
|
};
|
|
|
|
template<>
|
|
char StackAnalysis<true>::ID;
|
|
|
|
template<>
|
|
char StackAnalysis<false>::ID;
|
|
|
|
} // namespace StackAnalysis
|
|
|
|
#endif // STACKANALYSIS_H
|