Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gazelle-LLVM-prototype
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Naman Dixit
gazelle-LLVM-prototype
Commits
dcbaea45
You need to sign in or sign up before continuing.
Commit
dcbaea45
authored
May 30, 2022
by
Naman Dixit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented all the features
parent
031ca77f
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
350 additions
and
73 deletions
+350
-73
build.linux
build.linux
+2
-2
src/jit.cpp
src/jit.cpp
+77
-0
src/main.cpp
src/main.cpp
+270
-70
version.linux
version.linux
+1
-1
No files found.
build.linux
View file @
dcbaea45
...
@@ -48,9 +48,9 @@ LanguageFlags="--std=c++17 -DBUILD_INTERNAL -DBUILD_SLOW -DBUILD_DEBUG -D_GNU_SO
...
@@ -48,9 +48,9 @@ LanguageFlags="--std=c++17 -DBUILD_INTERNAL -DBUILD_SLOW -DBUILD_DEBUG -D_GNU_SO
-D_POSIX_C_SOURCE=200809L -D_DEFAULT_SOURCE
\
-D_POSIX_C_SOURCE=200809L -D_DEFAULT_SOURCE
\
"
"
WarningFlags
=
"-Weverything -Wpedantic -pedantic-errors -Werror
\
WarningFlags
=
"-Weverything -Wpedantic -pedantic-errors -Werror
\
-Wno-c++98-compat
\
-Wno-c++98-compat
-Wno-padded
\
"
"
LinkerFlags
=
"-static-libgcc -pthread -ldl
$(
llvm-config-13
--ldflags
--libs
)
-lncurses
\
LinkerFlags
=
"-
rdynamic -
static-libgcc -pthread -ldl
$(
llvm-config-13
--ldflags
--libs
)
-lncurses
\
-lclangFrontendTool -lclangFrontend -lclangDriver -lclangSerialization -lclangCodeGen
\
-lclangFrontendTool -lclangFrontend -lclangDriver -lclangSerialization -lclangCodeGen
\
-lclangParse -lclangSema -lclangStaticAnalyzerFrontend -lclangStaticAnalyzerCheckers
\
-lclangParse -lclangSema -lclangStaticAnalyzerFrontend -lclangStaticAnalyzerCheckers
\
-lclangStaticAnalyzerCore -lclangAnalysis -lclangARCMigrate -lclangRewriteFrontend
\
-lclangStaticAnalyzerCore -lclangAnalysis -lclangARCMigrate -lclangRewriteFrontend
\
...
...
src/jit.cpp
0 → 100644
View file @
dcbaea45
/*
* Creator: Naman Dixit
* Notice: © Copyright 2022 Naman Dixit
*/
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow-field-in-constructor"
namespace
{
using
namespace
llvm
;
using
namespace
orc
;
class
GazelleJIT
{
private:
std
::
unique_ptr
<
ExecutionSession
>
ES
;
DataLayout
DL
;
MangleAndInterner
Mangle
;
RTDyldObjectLinkingLayer
ObjectLayer
;
IRCompileLayer
CompileLayer
;
JITDylib
&
MainJD
;
public:
GazelleJIT
(
std
::
unique_ptr
<
ExecutionSession
>
ES
,
JITTargetMachineBuilder
JTMB
,
DataLayout
DL
)
:
ES
(
std
::
move
(
ES
)),
DL
(
std
::
move
(
DL
)),
Mangle
(
*
this
->
ES
,
this
->
DL
),
ObjectLayer
(
*
this
->
ES
,
[]()
{
return
std
::
make_unique
<
SectionMemoryManager
>
();
}),
CompileLayer
(
*
this
->
ES
,
ObjectLayer
,
std
::
make_unique
<
ConcurrentIRCompiler
>
(
std
::
move
(
JTMB
))),
MainJD
(
this
->
ES
->
createBareJITDylib
(
"<main>"
))
{
MainJD
.
addGenerator
(
cantFail
(
DynamicLibrarySearchGenerator
::
GetForCurrentProcess
(
DL
.
getGlobalPrefix
())));
}
~
GazelleJIT
()
{
if
(
auto
Err
=
ES
->
endSession
())
ES
->
reportError
(
std
::
move
(
Err
));
}
static
Expected
<
std
::
unique_ptr
<
GazelleJIT
>>
Create
()
{
auto
EPC
=
SelfExecutorProcessControl
::
Create
();
if
(
!
EPC
)
return
EPC
.
takeError
();
auto
ES
=
std
::
make_unique
<
ExecutionSession
>
(
std
::
move
(
*
EPC
));
JITTargetMachineBuilder
JTMB
(
ES
->
getExecutorProcessControl
().
getTargetTriple
());
auto
DL
=
JTMB
.
getDefaultDataLayoutForTarget
();
if
(
!
DL
)
return
DL
.
takeError
();
return
std
::
make_unique
<
GazelleJIT
>
(
std
::
move
(
ES
),
std
::
move
(
JTMB
),
std
::
move
(
*
DL
));
}
const
DataLayout
&
getDataLayout
()
const
{
return
DL
;
}
JITDylib
&
getMainJITDylib
()
{
return
MainJD
;
}
Error
addModule
(
ThreadSafeModule
TSM
,
ResourceTrackerSP
RT
=
nullptr
)
{
if
(
!
RT
)
RT
=
MainJD
.
getDefaultResourceTracker
();
return
CompileLayer
.
add
(
RT
,
std
::
move
(
TSM
));
}
Expected
<
JITEvaluatedSymbol
>
lookup
(
StringRef
Name
)
{
return
ES
->
lookup
({
&
MainJD
},
Mangle
(
Name
.
str
()));
}
};
}
#pragma clang diagnostic pop
src/main.cpp
View file @
dcbaea45
This diff is collapsed.
Click to expand it.
version.linux
View file @
dcbaea45
221
402
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment