Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
75623f48
Commit
75623f48
authored
Oct 25, 2017
by
Jaikrishnan Menon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CPU: Minor codegen cleanup
Remove commented-out code and predicate debuginfo generation
parent
92430c2e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
23 deletions
+8
-23
compiler.cpp
src/ngraph/codegen/compiler.cpp
+4
-13
compiler.hpp
src/ngraph/codegen/compiler.hpp
+4
-10
No files found.
src/ngraph/codegen/compiler.cpp
View file @
75623f48
...
...
@@ -68,18 +68,12 @@ static std::string GetExecutablePath(const char* Argv0)
execution_state
::
execution_state
()
:
m_execution_engine
{
nullptr
}
,
pch_enabled
(
false
)
,
debuginfo_enabled
(
false
)
{
}
execution_state
::~
execution_state
()
{
// /// Take the LLVM context used by this action.
// llvm::LLVMContext *takeLLVMContext();
// if (m_execution_engine)
// {
// m_execution_engine->runStaticConstructorsDestructors(true);
// }
}
std
::
unique_ptr
<
llvm
::
Module
>
execution_state
::
compile
(
const
string
&
source
,
const
string
&
name
)
...
...
@@ -146,10 +140,12 @@ std::unique_ptr<llvm::Module> execution_state::compile(const string& source, con
LO
->
WChar
=
1
;
LO
->
RTTI
=
1
;
if
(
debuginfo_enabled
)
{
// CodeGen options
auto
&
CGO
=
Clang
->
getInvocation
().
getCodeGenOpts
();
// TODO: Debuginfo inclusion should be predicated
CGO
.
setDebugInfo
(
codegenoptions
::
FullDebugInfo
);
}
if
(
pch_enabled
)
{
...
...
@@ -165,8 +161,6 @@ std::unique_ptr<llvm::Module> execution_state::compile(const string& source, con
Clang
->
getInvocation
().
getPreprocessorOpts
().
addRemappedFile
(
name
,
buffer
.
get
());
// Create and execute action
// CodeGenAction *compilerAction = new EmitLLVMOnlyAction();
// CodeGenAction* compilerAction = new EmitAssemblyAction();
CodeGenAction
*
compilerAction
=
new
EmitCodeGenOnlyAction
();
Clang
->
ExecuteAction
(
*
compilerAction
);
...
...
@@ -181,13 +175,10 @@ bool execution_state::add_module(std::unique_ptr<llvm::Module>& module)
{
if
(
!
m_execution_engine
)
{
// auto mm = unique_ptr<RTDyldMemoryManager>(new method_resolver(this));
m_execution_engine
=
llvm
::
EngineBuilder
(
move
(
module
))
.
setEngineKind
(
llvm
::
EngineKind
::
JIT
)
.
setOptLevel
(
llvm
::
CodeGenOpt
::
Aggressive
)
.
setErrorStr
(
&
jit_error
)
// .setUseMCJIT(true)
// .setMCJITMemoryManager(std::move(mm))
.
create
();
if
(
!
m_execution_engine
)
...
...
src/ngraph/codegen/compiler.hpp
View file @
75623f48
...
...
@@ -47,6 +47,9 @@ public:
void
enable_pch
()
{
pch_enabled
=
true
;
}
void
disable_pch
()
{
pch_enabled
=
false
;
}
void
enable_debuginfo
()
{
debuginfo_enabled
=
true
;
}
void
disable_debuginfo
()
{
debuginfo_enabled
=
false
;
}
std
::
unique_ptr
<
llvm
::
Module
>
compile
(
const
std
::
string
&
source
,
const
std
::
string
&
name
=
""
);
bool
add_module
(
std
::
unique_ptr
<
llvm
::
Module
>&
);
...
...
@@ -65,20 +68,11 @@ private:
llvm
::
ExecutionEngine
*
m_execution_engine
;
std
::
string
jit_error
;
bool
pch_enabled
;
bool
debuginfo_enabled
;
template
<
typename
signature
>
std
::
function
<
signature
>
f_cast
(
void
*
f
)
{
return
static_cast
<
signature
*>
(
reinterpret_cast
<
signature
*>
(
f
));
}
// class method_resolver : public llvm::RTDyldMemoryManager
// {
// public:
// method_resolver(compiler* m);
// virtual uint64_t getSymbolAddress(const std::string &name) override;
// private:
// compiler* m_Compiler;
// };
};
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