- QueryAlias in AliasAnalysis after LoopParallel may make mistakes, because LoopParallel may generate new pointers, but AliasAnalysis only consider array.
supports int and float
supports array of any dimensions
supports while, for, if, else, break, continue
A[f()] += B[f()] is same as A[f()] = A[f()] + B[f()]
//this expression below is valid
const int a = 5,b = 13
int Arr[a][b] = {}
//not support ++ operator
++i is same as +(+i)
//keyword of for loop is @for
//because SysY2022 does not have keyword "for", and we can define a variable named "for"
@for(int i=1;i<=10;i=i+1){}
you can see more details in lexer/SysY_lexer.l and parser/SysY_parser.y
see lib/sylib.c and lib/sylib.h
you can see more details in documents/*
Clang 15.0+
riscv64-unknown-linux-gnu-gcc 12.2+
qemu-riscv64 7.0+
flex 2.6+
bison 3.8+
mkdir obj
mkdir bin
make -j
if you update parser(*.y), use the command below
make parser
make -j
if you update lexer(*.l), use the command below
make lexer
make -j
To test functional testcases without optimization
## see SysY_test.sh for more details
./SysY_test.sh S 00 rv64gc
To test functional testcases with optimization
## see SysY_test.sh for more details
./SysY_test.sh S 01 rv64gc
To test performance testcases with optimization
## see SysY_performance.sh for more details
./SysY_test_performance.sh S rv64gc
To generate asm of single file(*.sy) with optimization
## first put your inputfile in testcase/example
## then run the command below, outputfile is in test_output/example
## you can see SysY_test_single.sh for more details
./SysY_test_single.sh [filename] S O1
-ControlFlowGraph
-DomTree
-AliasAnalysis
-MemoryDependencyAnalysis
-LoopBasicInformation
-ScalarEvolution
-LoopCarriedDependencyAnalysis
-TailRecursiveElimination
-Mem2reg
-FunctionInline
-SparseConditionalConstantPropagation
-SimplifyCFG
-InstSimplify
-InstCombine
-AggressiveDeadCodeElimination
-Reassociate
-CommonSubexpressionElimination
-DeadStoreElimination
-RedundantBranchElimination
-LoopSimplify
-LCSSA
-LoopInvariantCodeMotion
-LoopFullUnroll
-LoopIdomRecognize
-LoopFusion
-LoopParallel
-LoopStrengthReduce
-LoopUnroll
-MachinePeephole
-MachineCSE
-MachineLICM
-MachineInstructionSchedule
-RegisterCoalesce
-LinearScan
-PrologueEpilogueOpt
-ShortForwardBranchOpt
https://github.com/llvm/llvm-project/blob/main/llvm/lib
testcase reference
https://github.com/pku-minic/awesome-sysy
https://github.com/sally-compiler/SallyCompiler
tutorials of some problems in OJ https://www.luogu.com.cn/