aboutsummaryrefslogtreecommitdiff
path: root/test/conditional-compound-literal.qbe
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-05-12 15:37:10 -0700
committerMichael Forney <mforney@mforney.org>2019-05-12 15:45:35 -0700
commite70ee0ec1a0f7784dac638ac2d782afec4dd7a4c (patch)
tree826e0e24fc93c1973c96cfaaffc4224357065ed4 /test/conditional-compound-literal.qbe
parentf7b471b8576846e575f8c73ef6b70c4b06ff377d (diff)
eval: Keep track of kind of constant expression we are evaluating
When we are evaluating an arithmetic constant expression, we don't want to indroduce static data definitions for string or compound literals. Fixes #59.
Diffstat (limited to 'test/conditional-compound-literal.qbe')
-rw-r--r--test/conditional-compound-literal.qbe25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/conditional-compound-literal.qbe b/test/conditional-compound-literal.qbe
new file mode 100644
index 0000000..9e9c5f7
--- /dev/null
+++ b/test/conditional-compound-literal.qbe
@@ -0,0 +1,25 @@
+export
+function w $main() {
+@start.1
+ %.1 =l alloc4 4
+ %.3 =l alloc8 8
+ %.6 =l alloc4 4
+@body.2
+ %.2 =l add %.1, 0
+ storew 0, %.2
+ %.4 =l add %.3, 0
+ %.5 =w cnew 0, 0
+ jnz %.5, @cond_true.3, @cond_false.4
+@cond_true.3
+ jmp @cond_join.5
+@cond_false.4
+ %.7 =l add %.6, 0
+ %.8 =w loadsw %.1
+ storew %.8, %.7
+@cond_join.5
+ %.9 =l phi @cond_true.3 0, @cond_false.4 %.6
+ storel %.9, %.4
+ %.10 =l loadl %.3
+ %.11 =w loadsw %.10
+ ret %.11
+}