Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Shen, Siran
wacc
Commits
a76b53dd
Commit
a76b53dd
authored
Mar 17, 2021
by
徐世桐
Browse files
sx119: fixed merge bug, duplicated constant propagation
parent
86e29bd1
Changes
4
Hide whitespace changes
Inline
Side-by-side
scripts/constantPropagationTest.sh
View file @
a76b53dd
...
...
@@ -2,7 +2,7 @@
VALID_EXAMPLES
=(
"/propagation"
#
"/evaluation"
"/evaluation"
)
VALID_EXAMPLES_SRC_DIR
=
"./src/test/custom/valid/constantPropagation"
...
...
@@ -25,9 +25,11 @@ for folder in ${VALID_EXAMPLES[@]}; do
echo
$file
./compile
-t
-o1
$file
>
"
${
EXECUTABLE_FILE_NAME
}
.log.txt"
if
diff
"
${
EXECUTABLE_FILE_NAME
}
.log.txt"
"
${
VALID_EXAMPLES_SRC_DIR
}${
folder
}
/
${
FILE_NAME
}
.log"
-I
scope
;
then
((
COUNTER +
=
1
))
fi
mv
"
${
EXECUTABLE_FILE_NAME
}
.log.txt"
"
${
VALID_EXAMPLES_SRC_DIR
}${
folder
}
/
${
FILE_NAME
}
.log"
# if diff "${EXECUTABLE_FILE_NAME}.log.txt" "${VALID_EXAMPLES_SRC_DIR}${folder}/${FILE_NAME}.log" -I scope; then
# (( COUNTER += 1 ))
# fi
echo
"
$COUNTER
/
$((
$TOTAL_COUNT
))
files have been executed"
...
...
src/Compiler.java
View file @
a76b53dd
...
...
@@ -98,17 +98,6 @@ public class Compiler {
System
.
out
.
println
(
"unsupported optimisation level: "
+
optimise_level
);
}
switch
(
optimise_level
)
{
case
"0"
:
break
;
case
"1"
:
NodeVisitor
<
Node
>
constPropOptimiser
=
new
ConstantPropagation
(
arch
);
program
=
constPropOptimiser
.
visit
(
program
);
break
;
default
:
System
.
out
.
println
(
"unsupported optimisation level: "
+
optimise_level
);
}
/* print optimised ast tree */
if
(
cmd_ops
.
contains
(
"--print_ast"
))
{
ASTPrinter
painter
=
new
ASTPrinter
();
...
...
src/test/custom/valid/constantPropagation/evaluation/binaryTest.log
View file @
a76b53dd
optimising using const propagate
WARNING: arithmetic on -14 and 2147483600 will cause overflow
WARNING: arithmetic on -14 and 2147483600 will cause overflow
{scope
INT
EGER
a = 0
BOOL
EAN
b = false
{scope
size = 5 current scope = utils.frontend.symbolTable.SymbolTable@32e6e9c3 parent = null
INT a = 0
BOOL b = false
a (4) = 3
a (4) = 0
a (4) = 3
...
...
src/test/custom/valid/constantPropagation/evaluation/unaryTest.log
View file @
a76b53dd
optimising using const propagate
WARNING: arithmetic on 0 and -2147483648 will cause overflow
{scope
INT
EGER
a = 0
BOOL
EAN
b = false
{scope
size = 6 current scope = utils.frontend.symbolTable.SymbolTable@7a5d012c parent = null
INT a = 0
BOOL b = false
CHAR c = <char:32>
b (5) = false
b (5) = true
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment