mirror of
https://github.com/NaC-L/Mergen.git
synced 2026-05-12 09:40:34 +00:00
cdd52c271a
- 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
46 lines
1.2 KiB
C++
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;
|
|
}
|