From 71d95c6597bbca6ef44ba8a2a401c28c19a32bbb Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 21 Nov 2016 03:08:24 -0500 Subject: IR: support unwrap maybe operation --- src/all_types.hpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/all_types.hpp') diff --git a/src/all_types.hpp b/src/all_types.hpp index b28099ba2f..5212576c71 100644 --- a/src/all_types.hpp +++ b/src/all_types.hpp @@ -1453,6 +1453,8 @@ enum IrInstructionId { IrInstructionIdAsm, IrInstructionIdCompileVar, IrInstructionIdSizeOf, + IrInstructionIdTestNull, + IrInstructionIdUnwrapMaybe, }; struct IrInstruction { @@ -1749,6 +1751,21 @@ struct IrInstructionSizeOf { IrInstruction *type_value; }; +// returns true if nonnull, returns false if null +// this is so that `zeroes` sets maybe values to null +struct IrInstructionTestNull { + IrInstruction base; + + IrInstruction *value; +}; + +struct IrInstructionUnwrapMaybe { + IrInstruction base; + + IrInstruction *value; + bool safety_check_on; +}; + enum LValPurpose { LValPurposeNone, LValPurposeAssign, @@ -1758,4 +1775,7 @@ enum LValPurpose { static const size_t slice_ptr_index = 0; static const size_t slice_len_index = 1; +static const size_t maybe_child_index = 0; +static const size_t maybe_null_index = 1; + #endif -- cgit v1.2.3