summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2013-12-29 00:52:28 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2013-12-29 00:52:28 +0100
commit3a00cee584580529c43b8c17376cc7aaacc81e4c (patch)
treeee6667e9e8422e29f993ffb5344faeeaf588a26d /tests
parent33d5003ca9a99d4e933cf427fa1249ed1a843dba (diff)
downloadLPC-Projet-3a00cee584580529c43b8c17376cc7aaacc81e4c.tar.gz
LPC-Projet-3a00cee584580529c43b8c17376cc7aaacc81e4c.zip
New optimization : some variables are put into registers.
Diffstat (limited to 'tests')
-rw-r--r--tests/exec/args2.cpp15
-rw-r--r--tests/exec/args2.out2
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/exec/args2.cpp b/tests/exec/args2.cpp
new file mode 100644
index 0000000..1d2efee
--- /dev/null
+++ b/tests/exec/args2.cpp
@@ -0,0 +1,15 @@
+#include <iostream>
+
+int test(int a) {
+ int *b = &a;
+ *b = *b + 42;
+ return a;
+}
+
+int main() {
+ int x = 0;
+ int y = test(x);
+ std::cout << "x = " << x << "\n";
+ std::cout << "y = " << y << "\n";
+}
+
diff --git a/tests/exec/args2.out b/tests/exec/args2.out
new file mode 100644
index 0000000..7921196
--- /dev/null
+++ b/tests/exec/args2.out
@@ -0,0 +1,2 @@
+x = 0
+y = 42