Add ModelToHeader

This commit is contained in:
Pietro Fezzardi
2021-07-15 10:17:27 +02:00
parent 432cf351d7
commit 067f2fffe1
8 changed files with 1258 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
//
// Copyright (c) rev.ng Srls. See LICENSE.md for details.
//
#include "revng/Model/LoadModelPass.h"
#include "revng-c/ModelToHeader/ModelToHeaderPass.h"
bool ModelToHeaderPass::runOnModule(llvm::Module &) {
auto &ModelPass = getAnalysis<LoadModelWrapperPass>().get();
[[maybe_unused]] const model::Binary &Model = ModelPass.getReadOnlyModel();
return true;
}
void ModelToHeaderPass::getAnalysisUsage(llvm::AnalysisUsage &AU) const {
AU.setPreservesAll();
AU.addRequired<LoadModelWrapperPass>();
}
char ModelToHeaderPass::ID = 0;
using llvm::RegisterPass;
static RegisterPass<ModelToHeaderPass> X("model-to-header",
"Pass that takes the model and prints "
"a C header for all the type "
"declarations, global variable "
"declarations, and function "
"declarations necessary");