Removed warnings and worked a little bit on initialize
#include <log/log.h>
+/* Disable warnings from LLVM */
+#if defined(_MSC_VER) || defined(__clang__)
+ #pragma warning(push)
+// TODO
+#elif defined(__GNUC__)
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wunused-parameter"
+ #pragma GCC diagnostic ignored "-Wredundant-decls"
+#endif
+
// LLVM
#include <llvm/ExecutionEngine/ExecutionEngine.h>
#include <llvm/ExecutionEngine/GenericValue.h>
#include <llvm/Support/TargetSelect.h>
// Optimizations
-//#include <llvm/Analysis/BasicAliasAnalysis.h>
+#include <llvm/Analysis/BasicAliasAnalysis.h>
#include <llvm/Transforms/Scalar.h>
+/* Disable warnings from LLVM */
+#if defined(_MSC_VER) || defined(__clang__)
+ #pragma warning(pop)
+#elif defined(__GNUC__)
+ #pragma GCC diagnostic pop
+#endif
+
+using namespace llvm;
+using namespace std;
+
+using llvm::ArrayRef;
+using llvm::EngineBuilder;
+using llvm::ExecutionEngine;
+using llvm::Function;
+using llvm::GenericValue;
+using llvm::LLVMContext;
+using llvm::Module;
+using llvm::parseIRFile;
+using llvm::SMDiagnostic;
+using llvm::StringRef;
+using std::cout;
+using std::endl;
+using std::unique_ptr;
+
typedef struct loader_impl_llvm_function_type
{
// TODO: The reference to LLVM function must be stored here
@@ -65,8 +99,9 @@ typedef struct loader_impl_llvm_handle_type
typedef struct loader_impl_llvm_type
{
- // TODO: The reference to LLVM interpreter must be stored here
- void *todo;
+ // TODO: The reference to LLVM interpreter must be stored here (Is this correct?)
+ LLVMContext context;
+ SMDiagnostic error;
} * loader_impl_llvm;
@@ -162,9 +197,20 @@ int llvm_loader_impl_register_types(loader_impl impl)
type_id id;
const char *name;
} type_id_name_pair[] = {
- { TYPE_INT, "i32" },
- { TYPE_FLOAT, "float" }
- // TODO: Implement the rest of the types
+
+ { TYPE_SHORT, "i16" }, //D
+ { TYPE_INT, "i32" }, // D
+ { TYPE_LONG, "i64" }, // D
+ { TYPE_FLOAT, "float" }, // D
+ { TYPE_DOUBLE, "double" }, // D
+ { TYPE_BOOL, "i1" }, // D
+ { TYPE_CHAR, "i8" }, // D
+ { TYPE_STRING, "i8**" }, // D
+
+ { TYPE_BUFFER, "Buffer" }, // Left
+ { TYPE_PTR, "Ptr" } // Left
+ // TODO: Implement the rest of the types (Buffer and pointer remaining)
+
};
for (auto &pair : type_id_name_pair)
@@ -228,7 +274,7 @@ int llvm_loader_impl_execution_path(loader_impl impl, const loader_naming_path p
if (llvm_handle == nullptr)
{
// TODO: Emit exception when exception handling is implemented
- return NULL;
+ return 1;
}
/* TODO */
