summaryrefslogtreecommitdiff
path: root/node/ExprNode.hh
diff options
context:
space:
mode:
authorNagi5Yeq <wu@x-nagi.com>2020-05-30 15:52:36 +0800
committerNagi5Yeq <wu@x-nagi.com>2020-05-30 15:52:36 +0800
commit30726a1872c92d40424d496fc52043ca452d935f (patch)
tree86ce09251183ee544033ba8bfa9f51199aa58628 /node/ExprNode.hh
parent4c9d2d541c90968db2065260dc94c3be9e8adef9 (diff)
support for array access (partial)
Diffstat (limited to 'node/ExprNode.hh')
-rw-r--r--node/ExprNode.hh23
1 files changed, 18 insertions, 5 deletions
diff --git a/node/ExprNode.hh b/node/ExprNode.hh
index b985140..bf24f4d 100644
--- a/node/ExprNode.hh
+++ b/node/ExprNode.hh
@@ -60,15 +60,28 @@ class L2RCastingNode : public ExprNode {
std::shared_ptr<ExprNode> lvalue_;
};
-// like L2RCastingNode, but won't do the load, type is the pointer to lvalue
-// instead.
-class GetAddressNode : public ExprNode {
+// access an rvalue pointer, this generates one GEP instruction
+class PointerAccessNode : public ExprNode {
public:
- GetAddressNode(Context* context, std::shared_ptr<ExprNode> lvalue);
+ PointerAccessNode(Context* context, std::shared_ptr<ExprNode> lhs,
+ std::shared_ptr<ExprNode> rhs);
virtual Value CodeGen() override;
protected:
- std::shared_ptr<ExprNode> lvalue_;
+ std::shared_ptr<ExprNode> lhs_;
+ std::shared_ptr<ExprNode> rhs_;
+};
+
+// access an array or lvalue pointer
+class ArrayAccessNode : public ExprNode {
+ public:
+ ArrayAccessNode(Context* context, std::shared_ptr<ExprNode> lhs,
+ std::shared_ptr<ExprNode> rhs);
+ virtual Value CodeGen() override;
+
+ protected:
+ std::shared_ptr<ExprNode> lhs_;
+ std::shared_ptr<ExprNode> rhs_;
};
class IdentifierNode : public ExprNode {