-
Notifications
You must be signed in to change notification settings - Fork 2
/
llvm.h
38 lines (36 loc) · 1.23 KB
/
llvm.h
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
32
33
34
35
36
37
38
#pragma once
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Verifier.h"
#include "type.h"
struct llvmWrapper {
std::shared_ptr<llvm::LLVMContext> ctx;
std::shared_ptr<llvm::Module> mod;
std::shared_ptr<llvm::IRBuilder<>> builder;
llvmWrapper() {
ctx = std::make_shared<llvm::LLVMContext>();
mod = std::make_shared<llvm::Module>("mod", *ctx);
builder = std::make_shared<llvm::IRBuilder<>>(*ctx);
};
llvm::Type* getBool();
llvm::Type* getInt();
llvm::Type* getChar();
llvm::Type* getDouble();
llvm::Type* getVoid();
llvm::Type* getType(Type t);
llvm::Type* getBaseType(Type t);
llvm::Value* convertToTruthy(llvm::Value*);
llvm::Value* implictConvert(llvm::Value*, llvm::Type*);
llvm::AllocaInst* createEntryBlockAlloca(llvm::Function* fun,
llvm::Type* type,
const std::string& name,
llvm::Value* num = nullptr);
};