aboutsummaryrefslogtreecommitdiff
path: root/src/all_types.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/all_types.hpp')
-rw-r--r--src/all_types.hpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/all_types.hpp b/src/all_types.hpp
index afe8bd0675..8ba3e4f484 100644
--- a/src/all_types.hpp
+++ b/src/all_types.hpp
@@ -2124,6 +2124,7 @@ enum ScopeId {
ScopeIdCompTime,
ScopeIdRuntime,
ScopeIdTypeOf,
+ ScopeIdExpr,
};
struct Scope {
@@ -2271,6 +2272,24 @@ struct ScopeTypeOf {
Scope base;
};
+enum MemoizedBool {
+ MemoizedBoolUnknown,
+ MemoizedBoolFalse,
+ MemoizedBoolTrue,
+};
+
+// This scope is created for each expression.
+// It's used to identify when an instruction needs to be spilled,
+// so that it can be accessed after a suspend point.
+struct ScopeExpr {
+ Scope base;
+
+ ScopeExpr **children_ptr;
+ size_t children_len;
+
+ MemoizedBool need_spill;
+};
+
// synchronized with code in define_builtin_compile_vars
enum AtomicOrder {
AtomicOrderUnordered,
@@ -2510,6 +2529,10 @@ struct IrInstruction {
// with this child field.
IrInstruction *child;
IrBasicBlock *owner_bb;
+ // Nearly any instruction can have to be stored as a local variable before suspending
+ // and then loaded after resuming, in case there is an expression with a suspend point
+ // in it, such as: x + await y
+ IrInstruction *spill;
IrInstructionId id;
// true if this instruction was generated by zig and not from user code
bool is_gen;