Commit d185b48c authored by Jaikrishnan Menon's avatar Jaikrishnan Menon

Codegen: Add license header and switch line endings - CRLF -> LF

parent da80abe6
This diff is collapsed.
#pragma once // ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
#include <llvm/ExecutionEngine/MCJIT.h> // forces JIT to link in // Licensed under the Apache License, Version 2.0 (the "License");
#include <llvm/ExecutionEngine/SectionMemoryManager.h> // you may not use this file except in compliance with the License.
#include <llvm/Option/Arg.h> // You may obtain a copy of the License at
//
namespace nervana // http://www.apache.org/licenses/LICENSE-2.0
{ //
namespace cpu // Unless required by applicable law or agreed to in writing, software
{ // distributed under the License is distributed on an "AS IS" BASIS,
class module; // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
class execution_state; // See the License for the specific language governing permissions and
} // ----------------------------------------------------------------------------
}
#pragma once
class nervana::cpu::module
{ #include <llvm/ExecutionEngine/MCJIT.h> // forces JIT to link in
public: #include <llvm/ExecutionEngine/SectionMemoryManager.h>
private: #include <llvm/Option/Arg.h>
std::unique_ptr<llvm::Module> m_module;
}; namespace nervana
{
class nervana::cpu::execution_state : public llvm::SectionMemoryManager namespace cpu
{ {
public: class module;
execution_state(); class execution_state;
~execution_state(); }
}
std::unique_ptr<llvm::Module> compile(const std::string& source, const std::string& name = "");
class nervana::cpu::module
bool add_module(std::unique_ptr<llvm::Module>&); {
public:
void finalize(); private:
std::unique_ptr<llvm::Module> m_module;
template <typename ftype> };
std::function<ftype> find_function(const std::string& func_name)
{ class nervana::cpu::execution_state : public llvm::SectionMemoryManager
auto f = m_execution_engine->getPointerToNamedFunction(func_name); {
public:
return f_cast<ftype>(f); execution_state();
} ~execution_state();
private: std::unique_ptr<llvm::Module> compile(const std::string& source, const std::string& name = "");
llvm::ExecutionEngine* m_execution_engine;
bool add_module(std::unique_ptr<llvm::Module>&);
template <typename signature>
std::function<signature> f_cast(void* f) void finalize();
{
return static_cast<signature*>((signature*)f); template <typename ftype>
} std::function<ftype> find_function(const std::string& func_name)
{
// class method_resolver : public llvm::RTDyldMemoryManager auto f = m_execution_engine->getPointerToNamedFunction(func_name);
// {
// public: return f_cast<ftype>(f);
// method_resolver(compiler* m); }
// virtual uint64_t getSymbolAddress(const std::string &name) override;
private:
// private: llvm::ExecutionEngine* m_execution_engine;
// compiler* m_Compiler;
// }; template <typename signature>
}; std::function<signature> f_cast(void* f)
{
return static_cast<signature*>((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;
// };
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment