Files
Mergen/lifter/core/LifterApplication.hpp
yusufcanislek cdd52c271a feat: profile VMP samples and speed up lifting
- add nested lift diagnostics and helper-level profiling for protected381 targets
- refactor function signature specs and optimize folderBinOps fast paths
- implement the full SCAS family and document VMP 3.6 INT dispatcher findings
- add reproducible profiling scripts and root VMP testing notes
2026-03-31 22:02:57 +03:00

46 lines
1.2 KiB
C++

#pragma once
#include "CommandLineHelpers.hpp"
#include "Utils.h"
#include <cstdint>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
template <typename LiftEntryFn>
inline int runLifterApplication(const std::vector<std::string>& args,
LiftEntryFn&& liftEntry) {
const char* programName = args.empty() ? "mergen-lifter" : args.front().c_str();
if (args.size() < 3) {
printLifterUsage(programName);
return 1;
}
uint64_t startAddr = 0;
if (!parseStartAddressArg(args[2], startAddr)) {
std::cerr << "Invalid startAddr value: " << args[2] << std::endl;
printLifterUsage(programName);
return 1;
}
std::vector<uint8_t> fileData;
if (!readBinaryFile(args[1], fileData)) {
return 1;
}
const bool liftSucceeded =
std::forward<LiftEntryFn>(liftEntry)(startAddr, std::move(fileData));
if (!liftSucceeded) {
return 1;
}
auto milliseconds = timer::stopTimer();
debugging::doIfDebug([&]() {
std::cout << "\n"
<< std::dec << milliseconds << " milliseconds have passed"
<< std::endl;
std::cout << "Lift and optimization pipeline completed" << std::endl;
});
return 0;
}