summaryrefslogtreecommitdiff
path: root/src/mir/mir.hpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-11-20 09:26:13 +0800
committerJohn Hodge <tpg@mutabah.net>2016-11-20 09:26:13 +0800
commita6aae2e4413789e548a30fd9cb421cc2f6964b14 (patch)
treea6872cea76eaea7fe24e4c11ac5eb9b42482a3c4 /src/mir/mir.hpp
parentad7c16cd3664a79c09e00a76ae4e081aadd88493 (diff)
downloadmrust-a6aae2e4413789e548a30fd9cb421cc2f6964b14.tar.gz
MIR - Union support hacked up
Diffstat (limited to 'src/mir/mir.hpp')
-rw-r--r--src/mir/mir.hpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/mir/mir.hpp b/src/mir/mir.hpp
index c0c94807..c0ee0d21 100644
--- a/src/mir/mir.hpp
+++ b/src/mir/mir.hpp
@@ -109,22 +109,28 @@ TAGGED_UNION(RValue, Use,
::HIR::BorrowType type;
LValue val;
}),
+ // Cast on primitives
(Cast, struct {
LValue val;
::HIR::TypeRef type;
}),
+ // Binary operation on primitives
(BinOp, struct {
LValue val_l;
eBinOp op;
LValue val_r;
}),
+ // Unary operation on primitives
(UniOp, struct {
LValue val;
eUniOp op;
}),
+ // Extract the metadata from a DST pointer
+ // NOTE: If used on an array, this yields the array size (for generics)
(DstMeta, struct {
LValue val;
}),
+ // Construct a DST pointer from a thin pointer and metadata
(MakeDst, struct {
LValue ptr_val;
LValue meta_val;
@@ -132,14 +138,17 @@ TAGGED_UNION(RValue, Use,
(Tuple, struct {
::std::vector<LValue> vals;
}),
+ // Array literal
(Array, struct {
::std::vector<LValue> vals;
}),
- //(Variant, struct {
- // ::HIR::GenericPath path;
- // unsigned int index;
- // LValue val;
- // }),
+ // Create a new instance of a union (and eventually enum)
+ (Variant, struct {
+ ::HIR::GenericPath path;
+ unsigned int index;
+ LValue val;
+ }),
+ // Create a new instance of a struct (or enum)
(Struct, struct {
::HIR::GenericPath path;
::std::vector<LValue> vals;