aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorReinUsesLisp <[email protected]>2019-10-18 04:25:57 -0300
committerReinUsesLisp <[email protected]>2019-10-18 04:27:52 -0300
commit42248408a970f11d0c256fe5d33dee8d03fb3982 (patch)
tree8529e9ec1e5e17a7a0b957bbef583947c763677a /include
parent8cf3d225db622cc150951ce56dd4cb774be410a7 (diff)
downloadsirit-42248408a970f11d0c256fe5d33dee8d03fb3982.tar.gz
sirit-42248408a970f11d0c256fe5d33dee8d03fb3982.zip
Remove Emit entry in favor of auto-emitting code
All instructions but OpVariable and OpLabel are automatically emitted. These functions have to call AddLocalVariable/AddGlobalVariable or AddLabel respectively.
Diffstat (limited to 'include')
-rw-r--r--include/sirit/sirit.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h
index ccc06e4..d889cbc 100644
--- a/include/sirit/sirit.h
+++ b/include/sirit/sirit.h
@@ -70,12 +70,26 @@ public:
}
/**
- * Adds an instruction to module's code
- * @param op Instruction to insert into code. Types and constants must not
- * be emitted.
- * @return Returns op.
+ * Adds an existing label to the code
+ * @param label Label to insert into code.
+ * @return Returns label.
*/
- Id Emit(Id op);
+ Id AddLabel(Id label);
+
+ /**
+ * Adds a label to the code
+ * @return Returns the created label.
+ */
+ Id AddLabel() {
+ return AddLabel(OpLabel());
+ }
+
+ /**
+ * Adds a local variable to the code
+ * @param variable Variable to insert into code.
+ * @return Returns variable.
+ */
+ Id AddLocalVariable(Id label);
/**
* Adds a global variable