Codegen binops, kind-of
This commit is contained in:
parent
78816dff10
commit
a6939784f8
@ -23,8 +23,15 @@ namespace AST {
|
||||
}
|
||||
|
||||
llvm::Value* BinaryOperationExpression::codegen(codegen::Builder& builder, codegen::Scope& scope) {
|
||||
auto ty = builder.builder->getInt32Ty();
|
||||
return llvm::ConstantInt::get(ty, 0);
|
||||
auto lhs = this->m_lhs->codegen(builder, scope);
|
||||
auto rhs = this->m_rhs->codegen(builder, scope);
|
||||
switch (this->m_binop) {
|
||||
case BinOp::Assignment:
|
||||
builder.builder->CreateStore(rhs, lhs, false);
|
||||
return lhs;
|
||||
default:
|
||||
throw std::runtime_error("invalid binop");
|
||||
}
|
||||
}
|
||||
|
||||
void ReturnStatement::codegen(codegen::Builder& builder, codegen::Scope& scope) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user