From d4e6ae6f8237f18d9d0b51e7a6404118dffb709f Mon Sep 17 00:00:00 2001 From: Nagi5Yeq Date: Fri, 29 May 2020 00:08:49 +0800 Subject: add pointer and shifting support --- node/ExprNode.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'node/ExprNode.cc') diff --git a/node/ExprNode.cc b/node/ExprNode.cc index 4183120..ba505fc 100644 --- a/node/ExprNode.cc +++ b/node/ExprNode.cc @@ -66,6 +66,17 @@ Value L2RCastingNode::CodeGen() { return context_->GetBuilder()->CreateLoad(type_->GetLLVMType(), left); } +GetAddressNode::GetAddressNode(Context* context, + std::shared_ptr lvalue) + : ExprNode(context) + , lvalue_(lvalue) {} + +Value GetAddressNode::CodeGen() { + Value left = lvalue_->CodeGen(); + type_ = context_->GetTypeManager()->GetPointerType(lvalue_->GetType()); + return left; +} + IdentifierNode::IdentifierNode(Context* context, const std::string& name) : ExprNode(context) , name_(name) {} -- cgit