-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
44 lines (38 loc) · 1.16 KB
/
Copy pathmain.cpp
File metadata and controls
44 lines (38 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <stdio.h>
#include <stdlib.h>
#include "Tools/Argparser.h"
#include "Tools/Logger.h"
#include "Tools/CallStack.h"
#include "CPU/CPU.h"
#include "ASM2LLVM/ASM2LLVM.h"
#include <llvm/Support/InitLLVM.h>
int main(int argc, char** argv)
{
InitLLVM X(argc, argv);
InputParams inputParams;
initCallStack();
$
parseConsoleArguments(argc, argv, &inputParams);
if (!inputParams.inputFilename)
{
printf("You should use -i flag to set input binary file.\n");
system("pause");
return 1;
}
inputParams.memorySize = inputParams.memorySize > 128 ?
inputParams.memorySize :
128;
Logger::Instance().init(inputParams.noLogFileFlag ? nullptr : inputParams.logFilename);
CPU::Instance().init(inputParams);
Translator& translator = Translator::Instance();
TranslatorError error = translator.ASM2LLVM(
inputParams.inputFilename,
inputParams.outputFilename,
inputParams.memorySize,
inputParams.wantOptimization
);
if (inputParams.runJIT && error == TR_OK)
translator.runJIT();
system("pause");
$$ return 0;
}