You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
923 B
C++
42 lines
923 B
C++
4 months ago
|
#ifndef FORSPLL_LLVM_HPP
|
||
|
#define FORSPLL_LLVM_HPP
|
||
|
|
||
|
#include <llvm/ADT/APInt.h>
|
||
|
#include <llvm/IR/Constants.h>
|
||
|
#include <llvm/IR/IRBuilder.h>
|
||
|
#include <llvm/IR/LLVMContext.h>
|
||
|
#include <llvm/IR/Module.h>
|
||
|
#include <llvm/IR/Type.h>
|
||
|
#include <llvm/IR/DerivedTypes.h>
|
||
|
|
||
|
#include <string>
|
||
|
|
||
|
struct LLVMState
|
||
|
{
|
||
|
llvm::LLVMContext ctx;
|
||
|
llvm::Module modul;
|
||
|
llvm::IRBuilder<> builder;
|
||
|
|
||
|
llvm::Type *inttype;
|
||
|
llvm::Type *stacktype;
|
||
|
llvm::FunctionType *ftype;
|
||
|
llvm::Constant *one;
|
||
|
llvm::Constant *zero;
|
||
|
llvm::Constant *llvmSp;
|
||
|
llvm::Constant *llvmStack;
|
||
|
|
||
|
LLVMState();
|
||
|
|
||
|
llvm::Value *createPush();
|
||
|
llvm::Value *createPop();
|
||
|
llvm::Function *createFunction(const std::string& name);
|
||
|
llvm::BasicBlock *createEntry(llvm::Function *func);
|
||
|
llvm::Value *createVariable(const std::string& name);
|
||
|
llvm::Constant *createInt(int n);
|
||
|
|
||
|
void output();
|
||
|
};
|
||
|
|
||
|
#endif // FORSPLL_LLVM_HPP
|
||
|
|