summaryrefslogtreecommitdiff
path: root/node/ExprNode.cc
diff options
context:
space:
mode:
authorNagi5Yeq <wu@x-nagi.com>2020-05-29 00:08:49 +0800
committerNagi5Yeq <wu@x-nagi.com>2020-05-29 00:08:49 +0800
commitd4e6ae6f8237f18d9d0b51e7a6404118dffb709f (patch)
treeeb0969f20e5959866e535ac8fe5c84db55595ab5 /node/ExprNode.cc
parent404afbef3c9223bc44ddd91066c52c44349e43c7 (diff)
add pointer and shifting support
Diffstat (limited to 'node/ExprNode.cc')
-rw-r--r--node/ExprNode.cc11
1 files changed, 11 insertions, 0 deletions
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<ExprNode> 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) {}