From 4f4ab480a3bb46014ce995f872f513aa0b69e766 Mon Sep 17 00:00:00 2001 From: Stefano Sanfilippo Date: Sun, 8 Mar 2015 12:47:52 +0100 Subject: [PATCH] Moving system functions names to BitcodeEmitter.cpp --- BitcodeEmitter.cpp | 20 ++++++++++++++++++++ RuntimePrototypes.hpp | 21 --------------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/BitcodeEmitter.cpp b/BitcodeEmitter.cpp index b78887a..2174ec0 100644 --- a/BitcodeEmitter.cpp +++ b/BitcodeEmitter.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -192,6 +193,25 @@ llvm::Value* coerce(BitcodeEmitter::Private *d, llvm::Value *val, llvm::Type *to return nullptr; } +static const std::map 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 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 bool convertAndStore(BitcodeEmitter::Private *d, llvm::AllocaInst *dest, llvm::Value *expression) { llvm::Type *varType = dest->getAllocatedType(); diff --git a/RuntimePrototypes.hpp b/RuntimePrototypes.hpp index af09c33..9c8e744 100644 --- a/RuntimePrototypes.hpp +++ b/RuntimePrototypes.hpp @@ -41,27 +41,6 @@ namespace monicelli { -static const std::map 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 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> STANDARD_MODULES = { {"iostream", { PUT(Type::CHAR, __Monicelli_putBool),