Skip to content
This repository was archived by the owner on Jul 3, 2021. It is now read-only.

Commit 81a9d8b

Browse files
Initialize LLVM for native target codegen
1 parent b1b268b commit 81a9d8b

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

CMakeLists.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,37 @@ target_include_directories(JitFromScratch PRIVATE
4646
)
4747

4848
set(llvm_libs
49+
LLVMAggressiveInstCombine
50+
LLVMAnalysis
51+
LLVMAsmPrinter
4952
LLVMBinaryFormat
53+
LLVMBitReader
54+
LLVMBitWriter
55+
LLVMBitstreamReader
56+
LLVMCodeGen
5057
LLVMCore
58+
LLVMDebugInfoCodeView
59+
LLVMDebugInfoDWARF
60+
LLVMDebugInfoMSF
5161
LLVMDemangle
62+
LLVMGlobalISel
63+
LLVMInstCombine
64+
LLVMMC
65+
LLVMMCDisassembler
66+
LLVMMCParser
67+
LLVMObject
68+
LLVMProfileData
5269
LLVMRemarks
70+
LLVMScalarOpts
71+
LLVMSelectionDAG
5372
LLVMSupport
73+
LLVMTarget
74+
LLVMTransformUtils
75+
LLVMX86AsmParser
76+
LLVMX86CodeGen
77+
LLVMX86Desc
78+
LLVMX86Info
79+
LLVMX86Utils
5480
)
5581

5682
separate_arguments(LLVM_DEFINITIONS)

main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#include <llvm/Support/Format.h>
2+
#include <llvm/Support/InitLLVM.h>
3+
#include <llvm/Support/TargetSelect.h>
24
#include <llvm/Support/raw_ostream.h>
35

46
using namespace llvm;
@@ -37,6 +39,12 @@ int *integerDistances(const int (&x)[sizeOfArray], int *y) {
3739
}
3840

3941
int main(int argc, char **argv) {
42+
InitLLVM X(argc, argv);
43+
44+
InitializeNativeTarget();
45+
InitializeNativeTargetAsmPrinter();
46+
InitializeNativeTargetAsmParser();
47+
4048
int x[]{0, 1, 2};
4149
int y[]{3, 1, -1};
4250
int *z = integerDistances(x, y);

0 commit comments

Comments
 (0)