Moving system functions names to BitcodeEmitter.cpp
This commit is contained in:
parent
b1aff41ce9
commit
4f4ab480a3
|
@ -29,6 +29,7 @@
|
||||||
#include <llvm/IR/Module.h>
|
#include <llvm/IR/Module.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
|
@ -192,6 +193,25 @@ llvm::Value* coerce(BitcodeEmitter::Private *d, llvm::Value *val, llvm::Type *to
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const std::map<Type, std::string> PUT_NAMES = {{
|
||||||
|
{Type::BOOL, "__Monicelli_putBool"},
|
||||||
|
{Type::CHAR, "__Monicelli_putChar"},
|
||||||
|
{Type::FLOAT, "__Monicelli_putFloat"},
|
||||||
|
{Type::DOUBLE, "__Monicelli_putDouble"},
|
||||||
|
{Type::INT, "__Monicelli_putInt"}
|
||||||
|
}};
|
||||||
|
|
||||||
|
static const std::map<Type, std::string> GET_NAMES = {
|
||||||
|
{Type::BOOL, "__Monicelli_getBool"},
|
||||||
|
{Type::CHAR, "__Monicelli_getChar"},
|
||||||
|
{Type::FLOAT, "__Monicelli_getFloat"},
|
||||||
|
{Type::DOUBLE, "__Monicelli_getDouble"},
|
||||||
|
{Type::INT, "__Monicelli_getInt"}
|
||||||
|
};
|
||||||
|
|
||||||
|
static const std::string ABORT_NAME = "__Monicelli_abort";
|
||||||
|
static const std::string ASSERT_NAME = "__Monicelli_assert";
|
||||||
|
|
||||||
static
|
static
|
||||||
bool convertAndStore(BitcodeEmitter::Private *d, llvm::AllocaInst *dest, llvm::Value *expression) {
|
bool convertAndStore(BitcodeEmitter::Private *d, llvm::AllocaInst *dest, llvm::Value *expression) {
|
||||||
llvm::Type *varType = dest->getAllocatedType();
|
llvm::Type *varType = dest->getAllocatedType();
|
||||||
|
|
|
@ -41,27 +41,6 @@
|
||||||
|
|
||||||
namespace monicelli {
|
namespace monicelli {
|
||||||
|
|
||||||
static const std::map<Type, std::string> PUT_NAMES = {{
|
|
||||||
{Type::BOOL, "__Monicelli_putBool"},
|
|
||||||
{Type::CHAR, "__Monicelli_putChar"},
|
|
||||||
{Type::FLOAT, "__Monicelli_putFloat"},
|
|
||||||
{Type::DOUBLE, "__Monicelli_putDouble"},
|
|
||||||
{Type::INT, "__Monicelli_putInt"}
|
|
||||||
}};
|
|
||||||
|
|
||||||
static const std::map<Type, std::string> GET_NAMES = {
|
|
||||||
{Type::BOOL, "__Monicelli_getBool"},
|
|
||||||
{Type::CHAR, "__Monicelli_getChar"},
|
|
||||||
{Type::FLOAT, "__Monicelli_getFloat"},
|
|
||||||
{Type::DOUBLE, "__Monicelli_getDouble"},
|
|
||||||
{Type::INT, "__Monicelli_getInt"}
|
|
||||||
};
|
|
||||||
|
|
||||||
static const std::string ABORT_NAME = "__Monicelli_abort";
|
|
||||||
static const std::string ASSERT_NAME = "__Monicelli_assert";
|
|
||||||
static const std::string ENTRYPOINT_NAME = "__Monicelli_main";
|
|
||||||
|
|
||||||
|
|
||||||
static const std::map<std::string, std::vector<FunctionPrototype const*>> STANDARD_MODULES = {
|
static const std::map<std::string, std::vector<FunctionPrototype const*>> STANDARD_MODULES = {
|
||||||
{"iostream", {
|
{"iostream", {
|
||||||
PUT(Type::CHAR, __Monicelli_putBool),
|
PUT(Type::CHAR, __Monicelli_putBool),
|
||||||
|
|
Reference in New Issue
Block a user