diff options
| author | Nagi5Yeq <wu@x-nagi.com> | 2020-05-29 00:08:49 +0800 |
|---|---|---|
| committer | Nagi5Yeq <wu@x-nagi.com> | 2020-05-29 00:08:49 +0800 |
| commit | d4e6ae6f8237f18d9d0b51e7a6404118dffb709f (patch) | |
| tree | eb0969f20e5959866e535ac8fe5c84db55595ab5 /node/ExprNode.cc | |
| parent | 404afbef3c9223bc44ddd91066c52c44349e43c7 (diff) | |
add pointer and shifting support
Diffstat (limited to 'node/ExprNode.cc')
| -rw-r--r-- | node/ExprNode.cc | 11 |
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) {} |
