-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
31 lines (24 loc) · 773 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "kaleidoscope/Driver/ReplDriver.h"
#include <llvm/Support/TargetSelect.h>
#include <fmt/core.h>
#ifdef _WIN32
# define DLLEXPORT __declspec(dllexport)
#else
# define DLLEXPORT
#endif
/// putchard - putchar that takes a double and returns 0.
extern "C" DLLEXPORT [[maybe_unused]] auto putchard(double X) -> double {
fmt::print(stderr, "{}", static_cast<char>(X));
return X;
}
/// printd - print that takes a double prints it with newline, returning 0.
extern "C" DLLEXPORT [[maybe_unused]] auto printd(double X) -> double {
fmt::print(stderr, "{}", X);
return X;
}
auto main() -> int {
llvm::InitializeNativeTarget();
llvm::InitializeNativeTargetAsmPrinter();
llvm::InitializeNativeTargetAsmParser();
kaleidoscope::ReplDriver().mainLoop();
}