mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
a5af28621b
The stack analysis is the foundation to obtain accurate information about the body of a function, which registers are callee-saved, arguments, return values and so on. It is implemented as a pass to run in revamb-dump. This commit also introduces analysis tests specific to what we aim to obtain from the analysis and also some basic unit tests for data structures related to the stack analysis.
50 lines
854 B
C++
50 lines
854 B
C++
#ifndef _STACKANALYSIS_H
|
|
#define _STACKANALYSIS_H
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
// Standard includes
|
|
|
|
// LLVM includes
|
|
#include "llvm/Pass.h"
|
|
|
|
// Local includes
|
|
#include "generatedcodebasicinfo.h"
|
|
|
|
// Forward declarations
|
|
namespace llvm {
|
|
class BasicBlock;
|
|
}
|
|
|
|
class JumpTargetManager;
|
|
|
|
namespace StackAnalysis {
|
|
|
|
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;
|
|
|
|
void serialize(std::ostream &Output) {
|
|
Output << TextRepresentation;
|
|
}
|
|
|
|
private:
|
|
std::string TextRepresentation;
|
|
};
|
|
|
|
}
|
|
|
|
#endif // _STACKANALYSIS_H
|