├── uni-is ├── .gitignore ├── UniIS │ ├── Drivers.hs │ ├── Targets.hs │ ├── Drivers │ │ ├── TransformCPModel.hs │ │ ├── MakeArrayIndexMaplists.hs │ │ ├── TransformCPSolution.hs │ │ ├── MakeCPModel.hs │ │ ├── MakePatternMatchset.hs │ │ ├── PlotFunctionGraphs.hs │ │ ├── PlotPatternGraphs.hs │ │ ├── TransformPatternMatchset.hs │ │ ├── TransformFunctionGraph.hs │ │ ├── MakeAssemblyCode.hs │ │ ├── CheckDispatcher.hs │ │ └── PlotDispatcher.hs │ └── Targets │ │ └── Base.hs ├── uni-is.cabal ├── LICENSE └── Makefile ├── tools ├── .gitignore └── LICENSE ├── uni-is-llvm ├── .gitignore ├── UniISLLVM │ ├── Drivers.hs │ └── Drivers │ │ ├── Base.hs │ │ ├── MakeDispatcher.hs │ │ ├── MakeFunctionFromLLVM.hs │ │ └── DispatcherTools.hs ├── uni-is-llvm.cabal ├── LICENSE └── Makefile ├── uni-targen ├── .gitignore ├── UniTarGen │ ├── Drivers.hs │ └── Drivers │ │ └── Base.hs ├── uni-targen.cabal ├── LICENSE └── Makefile ├── .gitignore ├── hlib └── instr-sel │ ├── .gitignore │ ├── Language │ └── InstrSel │ │ ├── OpTypes.hs │ │ ├── DataTypes.hs │ │ ├── PrettyShow.hs │ │ ├── Constraints.hs │ │ ├── OpStructures.hs │ │ ├── DriverTools.hs │ │ ├── Functions │ │ ├── LLVM.hs │ │ └── IDs.hs │ │ ├── OpStructures │ │ ├── LLVM.hs │ │ └── Base.hs │ │ ├── Utils │ │ ├── ByteStringBuilder.hs │ │ ├── Set.hs │ │ ├── Time.hs │ │ ├── ByteString.hs │ │ ├── Lisp.hs │ │ └── JSON.hs │ │ ├── TargetMachines │ │ └── Generators │ │ │ └── LLVM.hs │ │ ├── Functions.hs │ │ ├── TargetMachines.hs │ │ ├── ConstraintModels.hs │ │ ├── Utils.hs │ │ ├── Graphs.hs │ │ ├── PrettyShow │ │ └── Base.hs │ │ └── Constraints │ │ └── ConstraintBuilder.hs │ ├── LICENSE │ └── Makefile ├── solvers ├── .gitignore ├── minizinc │ ├── .gitignore │ ├── sexpdata.py │ ├── sexparser.py │ └── constraints-converter ├── LICENSE └── presolver │ ├── sexparser.py │ └── lower-bound │ └── sexparser.py ├── uni-is-targets ├── .gitignore ├── uni-is-targets.cabal ├── LICENSE └── Makefile ├── testing ├── regression │ ├── hexagon5 │ │ ├── mem.cost │ │ ├── phi.cost │ │ ├── call.cost │ │ ├── fact.cost │ │ ├── pointers.cost │ │ ├── reuse.cost │ │ ├── small.cost │ │ ├── auto-inc.cost │ │ ├── indirect-call.cost │ │ ├── phi-dual-use.cost │ │ ├── gsm.add.gsm_L_add.cost │ │ ├── gsm.add.gsm_L_asl.cost │ │ ├── gsm.add.gsm_L_asr.cost │ │ ├── gsm.add.gsm_L_sub.cost │ │ ├── gsm.add.gsm_abs.cost │ │ ├── gsm.add.gsm_add.cost │ │ ├── gsm.add.gsm_asl.cost │ │ ├── gsm.add.gsm_asr.cost │ │ ├── gsm.add.gsm_mult.cost │ │ ├── gsm.add.gsm_sub.cost │ │ ├── g721.g711.alaw2linear.cost │ │ ├── g721.g711.ulaw2linear.cost │ │ ├── g721.g72x.reconstruct.cost │ │ ├── gsm.add.gsm_mult_r.cost │ │ ├── jpeg.jutils.jround_up.cost │ │ ├── jpeg.jdatasrc.jpeg_stdio_src.cost │ │ ├── pgp.rsaglue2.make_RSA_PUBLIC_KEY.cost │ │ ├── jpeg.jcparam.jpeg_quality_scaling.cost │ │ ├── jpeg.jdapimin.jpeg_CreateDecompress.cost │ │ ├── pgp.mpilib.mp_shortmod.mp_shortmod.cost │ │ ├── ghostscript.infblock.inflate_blocks_new.cost │ │ ├── jpeg.jcmainct.jinit_c_main_controller.cost │ │ ├── jpeg.jdmainct.process_data_simple_main.cost │ │ ├── call.s.1 │ │ ├── indirect-call.s.1 │ │ ├── mem.s.1 │ │ ├── reuse.s.1 │ │ ├── phi.s.1 │ │ ├── jpeg.jutils.jround_up.s.1 │ │ ├── auto-inc.s.1 │ │ ├── small.s.1 │ │ ├── pointers.s.1 │ │ ├── phi-dual-use.s.1 │ │ ├── fact.s.1 │ │ ├── gsm.add.gsm_L_asr.s.1 │ │ ├── gsm.add.gsm_add.s.1 │ │ ├── gsm.add.gsm_sub.s.1 │ │ ├── g721.g711.ulaw2linear.s.1 │ │ ├── gsm.add.gsm_L_asl.s.1 │ │ ├── gsm.add.gsm_abs.s.1 │ │ ├── gsm.add.gsm_mult.s.1 │ │ ├── gsm.add.gsm_mult_r.s.1 │ │ ├── pgp.rsaglue2.make_RSA_PUBLIC_KEY.s.1 │ │ ├── gsm.add.gsm_asr.s.1 │ │ ├── jpeg.jdmainct.process_data_simple_main.s.1 │ │ ├── gsm.add.gsm_asl.s.1 │ │ ├── jpeg.jcparam.jpeg_quality_scaling.s.1 │ │ ├── ghostscript.infblock.inflate_blocks_new.s.1 │ │ ├── jpeg.jdatasrc.jpeg_stdio_src.s.1 │ │ ├── jpeg.jdapimin.jpeg_CreateDecompress.s.1 │ │ ├── g721.g711.alaw2linear.s.1 │ │ ├── gsm.add.gsm_L_add.s.1 │ │ ├── g721.g72x.reconstruct.s.1 │ │ ├── gsm.add.gsm_L_sub.s.1 │ │ └── jpeg.jcmainct.jinit_c_main_controller.s.1 │ ├── mips32 │ │ ├── call.cost │ │ ├── mem.cost │ │ ├── phi.cost │ │ ├── reuse.cost │ │ ├── small.cost │ │ ├── auto-inc.cost │ │ ├── fact.cost │ │ ├── pointers.cost │ │ ├── indirect-call.cost │ │ ├── phi-dual-use.cost │ │ ├── gsm.add.gsm_L_add.cost │ │ ├── gsm.add.gsm_L_asl.cost │ │ ├── gsm.add.gsm_L_asr.cost │ │ ├── gsm.add.gsm_L_sub.cost │ │ ├── gsm.add.gsm_abs.cost │ │ ├── gsm.add.gsm_add.cost │ │ ├── gsm.add.gsm_asl.cost │ │ ├── gsm.add.gsm_asr.cost │ │ ├── gsm.add.gsm_mult.cost │ │ ├── gsm.add.gsm_mult_r.cost │ │ ├── gsm.add.gsm_sub.cost │ │ ├── g721.g711.alaw2linear.cost │ │ ├── g721.g711.ulaw2linear.cost │ │ ├── g721.g72x.reconstruct.cost │ │ ├── jpeg.jutils.jround_up.cost │ │ ├── jpeg.jdatasrc.jpeg_stdio_src.cost │ │ ├── jpeg.jcparam.jpeg_quality_scaling.cost │ │ ├── pgp.rsaglue2.make_RSA_PUBLIC_KEY.cost │ │ ├── ghostscript.infblock.inflate_blocks_new.cost │ │ ├── jpeg.jcmainct.jinit_c_main_controller.cost │ │ ├── jpeg.jdapimin.jpeg_CreateDecompress.cost │ │ ├── jpeg.jdmainct.process_data_simple_main.cost │ │ ├── pgp.mpilib.mp_shortmod.mp_shortmod.cost │ │ ├── call.s.1 │ │ ├── indirect-call.s.1 │ │ ├── mem.s.1 │ │ ├── phi.s.1 │ │ ├── jpeg.jutils.jround_up.s.1 │ │ ├── reuse.s.1 │ │ ├── small.s.1 │ │ ├── auto-inc.s.1 │ │ ├── pointers.s.1 │ │ ├── fact.s.1 │ │ ├── phi-dual-use.s.1 │ │ ├── gsm.add.gsm_abs.s.1 │ │ ├── g721.g711.ulaw2linear.s.1 │ │ ├── gsm.add.gsm_mult.s.1 │ │ ├── gsm.add.gsm_add.s.1 │ │ ├── gsm.add.gsm_sub.s.1 │ │ ├── gsm.add.gsm_L_asr.s.1 │ │ ├── gsm.add.gsm_mult_r.s.1 │ │ ├── gsm.add.gsm_L_asl.s.1 │ │ ├── gsm.add.gsm_asr.s.1 │ │ ├── jpeg.jdmainct.process_data_simple_main.s.1 │ │ ├── gsm.add.gsm_asl.s.1 │ │ ├── g721.g711.alaw2linear.s.1 │ │ ├── pgp.rsaglue2.make_RSA_PUBLIC_KEY.s.1 │ │ ├── ghostscript.infblock.inflate_blocks_new.s.1 │ │ ├── jpeg.jcparam.jpeg_quality_scaling.s.1 │ │ ├── g721.g72x.reconstruct.s.1 │ │ ├── gsm.add.gsm_L_add.s.1 │ │ ├── jpeg.jdapimin.jpeg_CreateDecompress.s.1 │ │ ├── gsm.add.gsm_L_sub.s.1 │ │ └── jpeg.jdatasrc.jpeg_stdio_src.s.1 │ ├── medium-test-cases.db │ ├── small-test-cases.db │ ├── reuse.ll │ ├── mem.ll │ ├── jpeg.jutils.jround_up.ll │ ├── phi.ll │ ├── phi-dual-use.ll │ ├── pointers.ll │ ├── g721.g711.ulaw2linear.ll │ ├── call.ll │ ├── gsm.add.gsm_abs.ll │ ├── indirect-call.ll │ ├── small.ll │ ├── gsm.add.gsm_add.ll │ ├── gsm.add.gsm_sub.ll │ ├── gsm.add.gsm_mult.ll │ ├── gsm.add.gsm_mult_r.ll │ ├── fact.ll │ ├── jpeg.jcparam.jpeg_quality_scaling.ll │ ├── auto-inc.ll │ ├── gsm.add.gsm_L_asr.ll │ ├── gsm.add.gsm_L_asl.ll │ ├── g721.g711.alaw2linear.ll │ ├── g721.g72x.reconstruct.ll │ ├── gsm.add.gsm_asr.ll │ ├── gsm.add.gsm_L_add.ll │ ├── gsm.add.gsm_asl.ll │ └── gsm.add.gsm_L_sub.ll ├── bugpoint │ └── compile-from-bc └── .gitignore ├── .gitmodules ├── TODO.org ├── LICENSE └── README /uni-is/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /tools/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.d 3 | -------------------------------------------------------------------------------- /uni-is-llvm/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /uni-targen/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | \#*\# 2 | .\#* 3 | *.pyc -------------------------------------------------------------------------------- /hlib/instr-sel/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /solvers/.gitignore: -------------------------------------------------------------------------------- 1 | *.d 2 | *.o 3 | -------------------------------------------------------------------------------- /uni-is-targets/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/mem.cost: -------------------------------------------------------------------------------- 1 | 32 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/phi.cost: -------------------------------------------------------------------------------- 1 | 64 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/call.cost: -------------------------------------------------------------------------------- 1 | 8 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/mem.cost: -------------------------------------------------------------------------------- 1 | 24 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/phi.cost: -------------------------------------------------------------------------------- 1 | 48 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/reuse.cost: -------------------------------------------------------------------------------- 1 | 32 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/small.cost: -------------------------------------------------------------------------------- 1 | 48 2 | -------------------------------------------------------------------------------- /solvers/minizinc/.gitignore: -------------------------------------------------------------------------------- 1 | mzn-params-gen 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/call.cost: -------------------------------------------------------------------------------- 1 | 16 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/fact.cost: -------------------------------------------------------------------------------- 1 | 1024 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/pointers.cost: -------------------------------------------------------------------------------- 1 | 84 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/reuse.cost: -------------------------------------------------------------------------------- 1 | 24 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/small.cost: -------------------------------------------------------------------------------- 1 | 72 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/auto-inc.cost: -------------------------------------------------------------------------------- 1 | 1020 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/fact.cost: -------------------------------------------------------------------------------- 1 | 4736 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/pointers.cost: -------------------------------------------------------------------------------- 1 | 64 2 | -------------------------------------------------------------------------------- /solvers/minizinc/sexpdata.py: -------------------------------------------------------------------------------- 1 | ../presolver/sexpdata.py -------------------------------------------------------------------------------- /testing/regression/hexagon5/auto-inc.cost: -------------------------------------------------------------------------------- 1 | 1028 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/indirect-call.cost: -------------------------------------------------------------------------------- 1 | 16 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/phi-dual-use.cost: -------------------------------------------------------------------------------- 1 | 88 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/indirect-call.cost: -------------------------------------------------------------------------------- 1 | 8 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/phi-dual-use.cost: -------------------------------------------------------------------------------- 1 | 88 2 | -------------------------------------------------------------------------------- /solvers/minizinc/sexparser.py: -------------------------------------------------------------------------------- 1 | ../presolver/sexparser.py -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_L_add.cost: -------------------------------------------------------------------------------- 1 | 925 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_L_asl.cost: -------------------------------------------------------------------------------- 1 | 532 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_L_asr.cost: -------------------------------------------------------------------------------- 1 | 510 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_L_sub.cost: -------------------------------------------------------------------------------- 1 | 654 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_abs.cost: -------------------------------------------------------------------------------- 1 | 356 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_add.cost: -------------------------------------------------------------------------------- 1 | 280 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_asl.cost: -------------------------------------------------------------------------------- 1 | 663 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_asr.cost: -------------------------------------------------------------------------------- 1 | 725 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_mult.cost: -------------------------------------------------------------------------------- 1 | 216 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_sub.cost: -------------------------------------------------------------------------------- 1 | 280 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_L_add.cost: -------------------------------------------------------------------------------- 1 | 623 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_L_asl.cost: -------------------------------------------------------------------------------- 1 | 389 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_L_asr.cost: -------------------------------------------------------------------------------- 1 | 367 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_L_sub.cost: -------------------------------------------------------------------------------- 1 | 511 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_abs.cost: -------------------------------------------------------------------------------- 1 | 122 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_add.cost: -------------------------------------------------------------------------------- 1 | 128 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_asl.cost: -------------------------------------------------------------------------------- 1 | 431 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_asr.cost: -------------------------------------------------------------------------------- 1 | 451 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_mult.cost: -------------------------------------------------------------------------------- 1 | 256 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_mult_r.cost: -------------------------------------------------------------------------------- 1 | 264 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_sub.cost: -------------------------------------------------------------------------------- 1 | 128 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/g721.g711.alaw2linear.cost: -------------------------------------------------------------------------------- 1 | 1039 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/g721.g711.ulaw2linear.cost: -------------------------------------------------------------------------------- 1 | 216 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/g721.g72x.reconstruct.cost: -------------------------------------------------------------------------------- 1 | 395 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_mult_r.cost: -------------------------------------------------------------------------------- 1 | 224 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/jpeg.jutils.jround_up.cost: -------------------------------------------------------------------------------- 1 | 48 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/g721.g711.alaw2linear.cost: -------------------------------------------------------------------------------- 1 | 759 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/g721.g711.ulaw2linear.cost: -------------------------------------------------------------------------------- 1 | 168 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/g721.g72x.reconstruct.cost: -------------------------------------------------------------------------------- 1 | 256 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/jpeg.jutils.jround_up.cost: -------------------------------------------------------------------------------- 1 | 336 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/jpeg.jdatasrc.jpeg_stdio_src.cost: -------------------------------------------------------------------------------- 1 | 537 2 | -------------------------------------------------------------------------------- /solvers/minizinc/constraints-converter: -------------------------------------------------------------------------------- 1 | ../presolver/constraints-converter -------------------------------------------------------------------------------- /testing/regression/hexagon5/jpeg.jdatasrc.jpeg_stdio_src.cost: -------------------------------------------------------------------------------- 1 | 361 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/pgp.rsaglue2.make_RSA_PUBLIC_KEY.cost: -------------------------------------------------------------------------------- 1 | 400 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/jpeg.jcparam.jpeg_quality_scaling.cost: -------------------------------------------------------------------------------- 1 | 540 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/pgp.rsaglue2.make_RSA_PUBLIC_KEY.cost: -------------------------------------------------------------------------------- 1 | 304 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/jpeg.jcparam.jpeg_quality_scaling.cost: -------------------------------------------------------------------------------- 1 | 235 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/jpeg.jdapimin.jpeg_CreateDecompress.cost: -------------------------------------------------------------------------------- 1 | 336 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/pgp.mpilib.mp_shortmod.mp_shortmod.cost: -------------------------------------------------------------------------------- 1 | 16838 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/ghostscript.infblock.inflate_blocks_new.cost: -------------------------------------------------------------------------------- 1 | 427 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/jpeg.jcmainct.jinit_c_main_controller.cost: -------------------------------------------------------------------------------- 1 | 4959 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/jpeg.jdapimin.jpeg_CreateDecompress.cost: -------------------------------------------------------------------------------- 1 | 384 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/jpeg.jdmainct.process_data_simple_main.cost: -------------------------------------------------------------------------------- 1 | 502 2 | -------------------------------------------------------------------------------- /testing/regression/mips32/pgp.mpilib.mp_shortmod.mp_shortmod.cost: -------------------------------------------------------------------------------- 1 | 11992 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/ghostscript.infblock.inflate_blocks_new.cost: -------------------------------------------------------------------------------- 1 | 529 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/jpeg.jcmainct.jinit_c_main_controller.cost: -------------------------------------------------------------------------------- 1 | 4379 2 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/jpeg.jdmainct.process_data_simple_main.cost: -------------------------------------------------------------------------------- 1 | 532 2 | -------------------------------------------------------------------------------- /testing/bugpoint/compile-from-bc: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | llvm-dis "$@" 4 | make "${@%.*}.s" 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "hlib/llvm-general"] 2 | path = hlib/llvm-general 3 | url = https://github.com/bscarlet/llvm-general.git 4 | -------------------------------------------------------------------------------- /testing/regression/mips32/call.s.1: -------------------------------------------------------------------------------- 1 | 8 entry: 2 | 1 [%call] <- "CALL foo" <- [%a] 3 | 0 [] <- "RetRA %call" <- [%call] 4 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/call.s.1: -------------------------------------------------------------------------------- 1 | 8 entry: 2 | 1 [%call] <- "call foo" <- [%a] 3 | 1 [] <- "return %call" <- [%call] 4 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/indirect-call.s.1: -------------------------------------------------------------------------------- 1 | 8 entry: 2 | 1 [%v] <- "call %ptr" <- [%a, %ptr] 3 | 1 [] <- "return %v" <- [%v] 4 | -------------------------------------------------------------------------------- /testing/regression/mips32/indirect-call.s.1: -------------------------------------------------------------------------------- 1 | 8 entry: 2 | 1 [%v] <- "CALL %ptr" <- [%a, %ptr] 3 | 0 [] <- "RetRA %v" <- [%v] 4 | -------------------------------------------------------------------------------- /testing/.gitignore: -------------------------------------------------------------------------------- 1 | /*.hi 2 | /*.o 3 | /*.pdf 4 | /*.dot 5 | /*.json 6 | /*.s 7 | /*.ll 8 | /*.mll 9 | /*.stats 10 | /*.modeldump 11 | /*.mzn 12 | /*.dump 13 | /*.bc 14 | /*.hs 15 | /*.temp 16 | -------------------------------------------------------------------------------- /testing/regression/mips32/mem.s.1: -------------------------------------------------------------------------------- 1 | 8 entry: 2 | 1 [%0] <- "LW %0, 0(%a)" <- [%a] 3 | 1 [%add] <- "ADDI $%add, $%0, 1" <- [%0] 4 | 1 [] <- "SW %add, 0(%a)" <- [%add, %a] 5 | 0 [] <- "RetRA %add" <- [%add] 6 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/mem.s.1: -------------------------------------------------------------------------------- 1 | 8 entry: 2 | 1 [%0] <- "%0 = memw(%a)" <- [%a] 3 | 1 [%add] <- "%add = add(%0, #1)" <- [%0] 4 | 1 [] <- "memw(%a) = %add" <- [%add, %a] 5 | 1 [] <- "return %add" <- [%add] 6 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/reuse.s.1: -------------------------------------------------------------------------------- 1 | 8 entry: 2 | 1 [%100000.copy.2] <- "%100000.copy.2 = ##100000" <- [] 3 | 1 [%c] <- "%100000.copy.2 += add(%a, #100000)" <- [%100000.copy.2, %a] 4 | 1 [] <- "return %c" <- [%c] 5 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/phi.s.1: -------------------------------------------------------------------------------- 1 | 16 entry: 2 | 1 [%cmp] <- "%cmp = cmp.gt(%n, ##1)" <- [%n] 3 | 1 [%x] <- "%x = add(%n, #10)" <- [%n] 4 | 1 [] <- "if (!%cmp) jump bb2" <- [%cmp] 5 | 8 bb1: 6 | 16 bb2: 7 | 1 [] <- "return %x" <- [%x] 8 | -------------------------------------------------------------------------------- /testing/regression/medium-test-cases.db: -------------------------------------------------------------------------------- 1 | ghostscript.infblock.inflate_blocks_new 2 | jpeg.jcmainct.jinit_c_main_controller 3 | jpeg.jdapimin.jpeg_CreateDecompress 4 | jpeg.jdatasrc.jpeg_stdio_src 5 | jpeg.jdmainct.process_data_simple_main 6 | pgp.mpilib.mp_shortmod.mp_shortmod 7 | -------------------------------------------------------------------------------- /testing/regression/mips32/phi.s.1: -------------------------------------------------------------------------------- 1 | 16 entry: 2 | 1 [%1.copy.1] <- "ADDiu %1.copy.1, $0, 1" <- [] 3 | 1 [%x] <- "ADDI $%x, $%n, 10" <- [%n] 4 | 1 [] <- "BGT $%n, $%1.copy.1, bb1" <- [%n, %1.copy.1] 5 | 8 bb1: 6 | 16 bb2: 7 | 0 [] <- "RetRA %x" <- [%x] 8 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/jpeg.jutils.jround_up.s.1: -------------------------------------------------------------------------------- 1 | 8 0: 2 | 1 [%2] <- "%b += add(%a, #-1)" <- [%b, %a] 3 | [] <- "ADJCALLSTACKDOWN" <- [%b, %2] 4 | [] <- "%3 = __hexagon_modsi(%2, %b)" <- [] 5 | 3 [%3] <- "ADJCALLSTACKDOWN" <- [] 6 | 1 [%4] <- "%4 = sub(%2, %3)" <- [%2, %3] 7 | 1 [] <- "return %4" <- [%4] 8 | -------------------------------------------------------------------------------- /testing/regression/mips32/jpeg.jutils.jround_up.s.1: -------------------------------------------------------------------------------- 1 | 8 0: 2 | 1 [%1] <- "ADDI $%1, $%a, -1" <- [%a] 3 | 1 [%2] <- "ADDU $%2, $%1, $%b" <- [%1, %b] 4 | 38 [%3] <- "DIV %2, %b" <- [%2, %b] 5 | 1 [%3.copy.1] <- "MFHI $%3.copy.1" <- [%3] 6 | 1 [%4] <- "SUBU $%4, $%2, $%3.copy.1" <- [%2, %3.copy.1] 7 | 0 [] <- "RetRA %4" <- [%4] 8 | -------------------------------------------------------------------------------- /testing/regression/mips32/reuse.s.1: -------------------------------------------------------------------------------- 1 | 8 entry: 2 | [] <- "LUi %tmp.1, 100000[31:16]" <- [] 3 | 2 [%100000.copy.1] <- "ORi %100000.copy.1, %tmp.1, 100000[15:0]" <- [] 4 | 1 [%b] <- "ADDU $%b, $%100000.copy.1, $%a" <- [%100000.copy.1, %a] 5 | 1 [%c] <- "ADDU $%c, $%100000.copy.1, $%b" <- [%100000.copy.1, %b] 6 | 0 [] <- "RetRA %c" <- [%c] 7 | -------------------------------------------------------------------------------- /uni-is/UniIS/Drivers.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module UniIS.Drivers 13 | ( module UniIS.Drivers.Base ) 14 | where 15 | 16 | import UniIS.Drivers.Base 17 | -------------------------------------------------------------------------------- /uni-is/UniIS/Targets.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module UniIS.Targets 13 | ( module UniIS.Targets.Base ) 14 | where 15 | 16 | import UniIS.Targets.Base 17 | -------------------------------------------------------------------------------- /uni-is-llvm/UniISLLVM/Drivers.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module UniISLLVM.Drivers 13 | ( module UniISLLVM.Drivers.Base ) 14 | where 15 | 16 | import UniISLLVM.Drivers.Base 17 | -------------------------------------------------------------------------------- /uni-targen/UniTarGen/Drivers.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module UniTarGen.Drivers 13 | ( module UniTarGen.Drivers.Base ) 14 | where 15 | 16 | import UniTarGen.Drivers.Base 17 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/auto-inc.s.1: -------------------------------------------------------------------------------- 1 | 8 0: 2 | 255 loop: 3 | 0 [%.012.prol] <- "PHI (%buf, 0) (%gep, loop)" <- [%buf, %gep] 4 | 1 [%gep, %1] <- "%1 = memb(%.012.prol ++ #1)" <- [%.012.prol, %.012.prol] 5 | [] <- "%tmp.1 = zxtb %1" <- [%1] 6 | 2 [%cmp] <- "%cmp = cmp.eq(%tmp.1, ##0)" <- [] 7 | 1 [] <- "if (!%cmp) jump loop" <- [%cmp] 8 | 8 exit: 9 | 1 [] <- "return %count" <- [%count] 10 | -------------------------------------------------------------------------------- /testing/regression/mips32/small.s.1: -------------------------------------------------------------------------------- 1 | 16 entry: 2 | 1 [%10.copy.2] <- "ADDiu %10.copy.2, $0, 10" <- [] 3 | 1 [%add] <- "ADDU $%add, $%a, $%a" <- [%a, %a] 4 | 1 [] <- "BEQ $%10.copy.2, $%add, if.then" <- [%10.copy.2, %add] 5 | 8 if.end: 6 | 8 if.then: 7 | 16 return: 8 | 0 [%retval.0] <- "PHI (%add, entry) (%10.copy.2, entry)" <- [%add, %10.copy.2] 9 | 0 [] <- "RetRA %retval.0" <- [%retval.0] 10 | -------------------------------------------------------------------------------- /hlib/instr-sel/Language/InstrSel/OpTypes.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module Language.InstrSel.OpTypes 13 | ( module Language.InstrSel.OpTypes.Base ) 14 | where 15 | 16 | import Language.InstrSel.OpTypes.Base 17 | -------------------------------------------------------------------------------- /hlib/instr-sel/Language/InstrSel/DataTypes.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module Language.InstrSel.DataTypes 13 | ( module Language.InstrSel.DataTypes.Base ) 14 | where 15 | 16 | import Language.InstrSel.DataTypes.Base 17 | -------------------------------------------------------------------------------- /testing/regression/mips32/auto-inc.s.1: -------------------------------------------------------------------------------- 1 | 8 0: 2 | 255 loop: 3 | 0 [%.012.prol] <- "PHI (%buf, 0) (%gep, loop)" <- [%buf, %gep] 4 | 1 [%1] <- "LW %1, 0(%.012.prol)" <- [%.012.prol] 5 | 1 [%gep] <- "ADDI $%gep, $%.012.prol, 1" <- [%.012.prol] 6 | [] <- "BEQ $r0, $%1, exit" <- [%0.copy.1, %1] 7 | 2 [] <- "B loop" <- [] 8 | 8 exit: 9 | [] <- "SEH %tmp.1, %count" <- [%count] 10 | 0 [] <- "RetRA %tmp.1" <- [] 11 | -------------------------------------------------------------------------------- /hlib/instr-sel/Language/InstrSel/PrettyShow.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module Language.InstrSel.PrettyShow 13 | ( module Language.InstrSel.PrettyShow.Base ) 14 | where 15 | 16 | import Language.InstrSel.PrettyShow.Base 17 | -------------------------------------------------------------------------------- /hlib/instr-sel/Language/InstrSel/Constraints.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module Language.InstrSel.Constraints 13 | ( module Language.InstrSel.Constraints.Base ) 14 | where 15 | 16 | import Language.InstrSel.Constraints.Base 17 | -------------------------------------------------------------------------------- /hlib/instr-sel/Language/InstrSel/OpStructures.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module Language.InstrSel.OpStructures 13 | ( module Language.InstrSel.OpStructures.Base ) 14 | where 15 | 16 | import Language.InstrSel.OpStructures.Base 17 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/small.s.1: -------------------------------------------------------------------------------- 1 | 16 entry: 2 | 1 [%add] <- "%add = add(%a, %a)" <- [%a, %a] 3 | 1 [%cmp] <- "%cmp = cmp.eq(%add, ##10)" <- [%add] 4 | 1 [] <- "if (!%cmp) jump if.end" <- [%cmp] 5 | 8 if.then: 6 | 1 [%10.copy.1] <- "%10.copy.1 = ##10" <- [] 7 | 8 if.end: 8 | 16 return: 9 | 0 [%retval.0] <- "PHI (%add, entry) (%10.copy.1, if.then)" <- [%add, %10.copy.1] 10 | 1 [] <- "return %retval.0" <- [%retval.0] 11 | -------------------------------------------------------------------------------- /hlib/instr-sel/Language/InstrSel/DriverTools.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module Language.InstrSel.DriverTools 13 | ( module Language.InstrSel.DriverTools.Base 14 | ) 15 | where 16 | 17 | import Language.InstrSel.DriverTools.Base 18 | -------------------------------------------------------------------------------- /testing/regression/mips32/pointers.s.1: -------------------------------------------------------------------------------- 1 | 12 entry: 2 | 1 [] <- "BEQ $r0, $%a, end" <- [%null.copy.1, %a] 3 | 8 load: 4 | 1 [%255.copy.1] <- "ADDiu %255.copy.1, $0, 255" <- [] 5 | 0 [%1] <- "ORi %1, $0, 255" <- [] 6 | 1 [%3] <- "LW %3, 0(%1)" <- [%1] 7 | 1 [%4] <- "LW %4, 0(%255.copy.1)" <- [%255.copy.1] 8 | 1 [%5] <- "ADDU $%5, $%4, $%3" <- [%4, %3] 9 | 1 [] <- "SW %5, 0(%a)" <- [%5, %a] 10 | 12 end: 11 | 1 [] <- "Ret" <- [] 12 | -------------------------------------------------------------------------------- /hlib/instr-sel/Language/InstrSel/Functions/LLVM.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module Language.InstrSel.Functions.LLVM 13 | ( module Language.InstrSel.Functions.LLVM.FunctionMaker ) 14 | where 15 | 16 | import Language.InstrSel.Functions.LLVM.FunctionMaker 17 | -------------------------------------------------------------------------------- /hlib/instr-sel/Language/InstrSel/OpStructures/LLVM.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module Language.InstrSel.OpStructures.LLVM 13 | ( module Language.InstrSel.OpStructures.LLVM.OSMaker ) 14 | where 15 | 16 | import Language.InstrSel.OpStructures.LLVM.OSMaker 17 | -------------------------------------------------------------------------------- /hlib/instr-sel/Language/InstrSel/Utils/ByteStringBuilder.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module Language.InstrSel.Utils.ByteStringBuilder 13 | ( module Data.ByteString.Builder 14 | , (<>) 15 | ) 16 | where 17 | 18 | import Data.ByteString.Builder 19 | import Data.Monoid 20 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/pointers.s.1: -------------------------------------------------------------------------------- 1 | 12 entry: 2 | 1 [%0] <- "%0 = cmp.eq(%a, ##0)" <- [%a] 3 | 1 [] <- "if (%0) jump end" <- [%0] 4 | 8 load: 5 | 1 [%255.copy.2] <- "%255.copy.2 = #255" <- [] 6 | 1 [%1] <- "%1 = zxth %255.copy.2" <- [%255.copy.2] 7 | 1 [%3] <- "%3 = memw(%1)" <- [%1] 8 | 1 [%4] <- "%4 = memw(#255)" <- [] 9 | 1 [%5] <- "%5 = add(%4, %3)" <- [%4, %3] 10 | 1 [] <- "memw(%a) = %5" <- [%5, %a] 11 | 12 end: 12 | 1 [] <- "return" <- [] 13 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/phi-dual-use.s.1: -------------------------------------------------------------------------------- 1 | 16 entry: 2 | 1 [%cmp] <- "%cmp = cmp.gt(%n, ##1)" <- [%n] 3 | 1 [%x] <- "%x = add(%n, #10)" <- [%n] 4 | 1 [] <- "if (!%cmp) jump bb2" <- [%cmp] 5 | 8 bb1: 6 | 1 [%0.copy.2] <- "%0.copy.2 = ##0" <- [] 7 | 16 bb2: 8 | 0 [%y] <- "PHI (%0.copy.2, bb1) (%x, entry)" <- [%0.copy.2, %x] 9 | 0 [%z] <- "PHI (%0.copy.2, bb1) (%x, entry)" <- [%0.copy.2, %x] 10 | 1 [%bla] <- "%bla = add(%z, %y)" <- [%z, %y] 11 | 1 [] <- "return %bla" <- [%bla] 12 | -------------------------------------------------------------------------------- /hlib/instr-sel/Language/InstrSel/TargetMachines/Generators/LLVM.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module Language.InstrSel.TargetMachines.Generators.LLVM 13 | ( module Language.InstrSel.TargetMachines.Generators.LLVM.Base ) 14 | where 15 | 16 | import Language.InstrSel.TargetMachines.Generators.LLVM.Base 17 | -------------------------------------------------------------------------------- /hlib/instr-sel/Language/InstrSel/Functions.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module Language.InstrSel.Functions 13 | ( module Language.InstrSel.Functions.Base 14 | , module Language.InstrSel.Functions.IDs 15 | ) 16 | where 17 | 18 | import Language.InstrSel.Functions.Base 19 | import Language.InstrSel.Functions.IDs 20 | -------------------------------------------------------------------------------- /testing/regression/small-test-cases.db: -------------------------------------------------------------------------------- 1 | auto-inc 2 | call 3 | fact 4 | g721.g711.alaw2linear 5 | g721.g711.ulaw2linear 6 | g721.g72x.reconstruct 7 | gsm.add.gsm_abs 8 | gsm.add.gsm_add 9 | gsm.add.gsm_asl 10 | gsm.add.gsm_asr 11 | gsm.add.gsm_L_add 12 | gsm.add.gsm_L_asl 13 | gsm.add.gsm_L_asr 14 | gsm.add.gsm_L_sub 15 | gsm.add.gsm_mult 16 | gsm.add.gsm_mult_r 17 | gsm.add.gsm_sub 18 | indirect-call 19 | jpeg.jcparam.jpeg_quality_scaling 20 | jpeg.jutils.jround_up 21 | mem 22 | pgp.rsaglue2.make_RSA_PUBLIC_KEY 23 | phi 24 | phi-dual-use 25 | pointers 26 | reuse 27 | small 28 | -------------------------------------------------------------------------------- /hlib/instr-sel/Language/InstrSel/TargetMachines.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module Language.InstrSel.TargetMachines 13 | ( module Language.InstrSel.TargetMachines.Base 14 | , module Language.InstrSel.TargetMachines.IDs 15 | ) 16 | where 17 | 18 | import Language.InstrSel.TargetMachines.Base 19 | import Language.InstrSel.TargetMachines.IDs 20 | -------------------------------------------------------------------------------- /hlib/instr-sel/Language/InstrSel/ConstraintModels.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module Language.InstrSel.ConstraintModels 13 | ( module Language.InstrSel.ConstraintModels.Base 14 | , module Language.InstrSel.ConstraintModels.IDs 15 | ) 16 | where 17 | 18 | import Language.InstrSel.ConstraintModels.Base 19 | import Language.InstrSel.ConstraintModels.IDs 20 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/fact.s.1: -------------------------------------------------------------------------------- 1 | 8 entry: 2 | 1 [] <- "jump for.cond" <- [] 3 | 248 for.body: 4 | 1 [%dec] <- "%dec = add(%n.addr.0, #-1)" <- [%n.addr.0] 5 | 1 [%mul] <- "%mul = mpy(%n.addr.0, %res.0)" <- [%n.addr.0, %res.0] 6 | 248 for.inc: 7 | 256 for.cond: 8 | 0 [%res.0] <- "PHI (%n, entry) (%mul, for.body)" <- [%n, %mul] 9 | 0 [%n.addr.0] <- "PHI (%n, entry) (%dec, for.body)" <- [%n, %dec] 10 | 1 [%cmp] <- "%cmp = cmp.gt(%n.addr.0, ##1)" <- [%n.addr.0] 11 | 1 [] <- "if (%cmp) jump for.body" <- [%cmp] 12 | 8 for.end: 13 | 1 [] <- "return %res.0" <- [%res.0] 14 | -------------------------------------------------------------------------------- /hlib/instr-sel/Language/InstrSel/Utils.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module Language.InstrSel.Utils 13 | ( module Language.InstrSel.Utils.Base 14 | , module Language.InstrSel.Utils.Natural 15 | , module Language.InstrSel.Utils.Range 16 | ) 17 | where 18 | 19 | import Language.InstrSel.Utils.Base 20 | import Language.InstrSel.Utils.Natural 21 | import Language.InstrSel.Utils.Range 22 | -------------------------------------------------------------------------------- /testing/regression/mips32/fact.s.1: -------------------------------------------------------------------------------- 1 | 8 entry: 2 | 1 [%1.copy.1] <- "ADDiu %1.copy.1, $0, 1" <- [] 3 | 1 [] <- "B for.cond" <- [] 4 | 248 for.body: 5 | 1 [%dec] <- "ADDI $%dec, $%n.addr.0, -1" <- [%n.addr.0] 6 | 17 [%mul] <- "MUL $%mul, $%n.addr.0, $%res.0" <- [%n.addr.0, %res.0] 7 | 248 for.inc: 8 | 256 for.cond: 9 | 0 [%res.0] <- "PHI (%n, entry) (%mul, for.body)" <- [%n, %mul] 10 | 0 [%n.addr.0] <- "PHI (%n, entry) (%dec, for.body)" <- [%n, %dec] 11 | 1 [] <- "BGT $%n.addr.0, $%1.copy.1, for.body" <- [%n.addr.0, %1.copy.1] 12 | 8 for.end: 13 | 0 [] <- "RetRA %res.0" <- [%res.0] 14 | -------------------------------------------------------------------------------- /testing/regression/mips32/phi-dual-use.s.1: -------------------------------------------------------------------------------- 1 | 16 entry: 2 | 1 [%1.copy.1] <- "ADDiu %1.copy.1, $0, 1" <- [] 3 | 1 [%x] <- "ADDI $%x, $%n, 10" <- [%n] 4 | 1 [] <- "BGT $%n, $%1.copy.1, bb1" <- [%n, %1.copy.1] 5 | 16 bb2: 6 | 0 [%y] <- "PHI (%0.copy.1, bb1) (%x, entry)" <- [%0.copy.1, %x] 7 | 0 [%z] <- "PHI (%0.copy.1, bb1) (%x, entry)" <- [%0.copy.1, %x] 8 | 1 [%bla] <- "ADDU $%bla, $%z, $%y" <- [%z, %y] 9 | 0 [] <- "RetRA %bla" <- [%bla] 10 | 8 bb1: 11 | 1 [%0.copy.1] <- "ADDiu %0.copy.1, $0, 0" <- [] 12 | 1 [%0.copy.2] <- "ADDiu %0.copy.2, $0, 0" <- [] 13 | 1 [] <- "B bb2" <- [] 14 | -------------------------------------------------------------------------------- /hlib/instr-sel/Language/InstrSel/Graphs.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module Language.InstrSel.Graphs 13 | ( module Language.InstrSel.Graphs.Base 14 | , module Language.InstrSel.Graphs.IDs 15 | , module Language.InstrSel.Functions.IDs 16 | ) 17 | where 18 | 19 | import Language.InstrSel.Graphs.Base 20 | import Language.InstrSel.Graphs.IDs 21 | import Language.InstrSel.Functions.IDs 22 | ( BlockName (..) ) 23 | -------------------------------------------------------------------------------- /TODO.org: -------------------------------------------------------------------------------- 1 | * TASKS 2 | ** DONE Fix how setreg is handled 3 | ** DONE Handle pointers 4 | ** DONE Lower pointers to integers 5 | ** DONE Implement a graph invariant checker 6 | ** DONE Fix bug when processing ghostscript test case 7 | ** DONE Handle indirect function calls 8 | ** DONE Fix exponential explosion bug in alternative extender 9 | ** DONE Fix exponential explosion in pattern matcher due to alternative edges 10 | ** DONE Fix faculty explosion in pattern matcher when dealing with SIMDs 11 | ** DONE Combine constants in patterns 12 | ** DONE Get upper bound from LLVM 13 | ** DONE Investigate presolving technique (see Mats' email) 14 | ** DONE Fix uni-targen bug when SETREG assignes an immediate to a register 15 | ** DONE Branch-extend patterns 16 | ** TODO Add support for CI 17 | ** TODO Fix and extend README 18 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_abs.s.1: -------------------------------------------------------------------------------- 1 | 42 0: 2 | 0 [%1] <- "ADD %1, $0, %a" <- [%a] 3 | 0 [%2] <- "SLTI $%2, $%a, 0" <- [%a] 4 | 1 [] <- "BNE $0, $%2, 3" <- [%2] 5 | 42 6: 6 | 0 [%7] <- "PHI (%1, 0) (%., .selectcont)" <- [%1, %.] 7 | 0 [%8] <- "ANDi %8, %7, 32767" <- [%7] 8 | [] <- "SEH %tmp.1, %8" <- [%8] 9 | 0 [] <- "RetRA %tmp.1" <- [] 10 | 16 3: 11 | 1 [%-32768.copy.1] <- "ADDi %-32768.copy.1, $0, -32768" <- [] 12 | 1 [%32767.copy.1] <- "ADDiu %32767.copy.1, $0, 32767" <- [] 13 | 1 [%5] <- "SUBU $%5, $r0, $%1" <- [%0.copy.1, %1] 14 | 1 [] <- "BEQ $%-32768.copy.1, $%a, .selecttrue" <- [%-32768.copy.1, %a] 15 | 8 .selecttrue: 16 | 16 .selectcont: 17 | 0 [%.] <- "PHI (%5, 3) (%32767.copy.1, 3)" <- [%5, %32767.copy.1] 18 | 1 [] <- "B 6" <- [] 19 | -------------------------------------------------------------------------------- /testing/regression/mips32/g721.g711.ulaw2linear.s.1: -------------------------------------------------------------------------------- 1 | 16 0: 2 | 1 [%2] <- "XORI $%2, $%u_val, 255" <- [%u_val] 3 | 1 [%3] <- "SLL $%3, $%2, 3" <- [%2] 4 | 1 [%4] <- "ANDI $%4, $%3, 120" <- [%3] 5 | 1 [%5] <- "ORI $%5, $%4, 132" <- [%4] 6 | 1 [%9] <- "ANDI $%9, $%2, 128" <- [%2] 7 | 1 [%7] <- "EXT %2, 4, 3" <- [%2] 8 | 1 [%8] <- "SLLV $%8, $%5, $%7" <- [%5, %7] 9 | 1 [%12] <- "ADDI $%12, $%8, -132" <- [%8] 10 | 1 [] <- "BNE $r0, $%9, .selecttrue" <- [%0.copy.1, %9] 11 | 16 .selectcont: 12 | 0 [%13] <- "PHI (%11, .selecttrue) (%12, 0)" <- [%11, %12] 13 | 0 [] <- "RetRA %13" <- [%13] 14 | 8 .selecttrue: 15 | 1 [%132.copy.1] <- "ADDiu %132.copy.1, $0, 132" <- [] 16 | 1 [%11] <- "SUBU $%11, $%132.copy.1, $%8" <- [%132.copy.1, %8] 17 | 1 [] <- "B .selectcont" <- [] 18 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_mult.s.1: -------------------------------------------------------------------------------- 1 | 16 0: 2 | 1 [%32767.copy.1] <- "ADDi %32767.copy.1, $0, 32767" <- [] 3 | [] <- "XORi %tmp.1 %b, -32768" <- [%b] 4 | 2 [%2] <- "SLTiu %2, %tmp.1, 1" <- [] 5 | [] <- "XORi %tmp.2 %a, -32768" <- [%a] 6 | 2 [%1] <- "SLTiu %1, %tmp.2, 1" <- [] 7 | 1 [%or.cond] <- "AND $%or.cond, $%2, $%1" <- [%2, %1] 8 | 1 [] <- "BNE $0, $%or.cond, 9" <- [%or.cond] 9 | 8 3: 10 | 0 [%4] <- "ADD %4, $0, %a" <- [%a] 11 | 0 [%5] <- "ADD %5, $0, %b" <- [%b] 12 | 17 [%6] <- "MUL $%6, $%5, $%4" <- [%5, %4] 13 | 1 [%7] <- "SRL $%7, $%6, 15" <- [%6] 14 | 0 [%8] <- "ANDi %8, %7, 32767" <- [%7] 15 | 16 9: 16 | 0 [%.0] <- "PHI (%8, 3) (%32767.copy.1, 0)" <- [%8, %32767.copy.1] 17 | [] <- "SEH %tmp.3, %.0" <- [%.0] 18 | 0 [] <- "RetRA %tmp.3" <- [] 19 | -------------------------------------------------------------------------------- /hlib/instr-sel/Language/InstrSel/Utils/Set.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module Language.InstrSel.Utils.Set 13 | ( module Data.Set 14 | , intersections 15 | ) 16 | where 17 | 18 | import Data.Set 19 | import Prelude hiding 20 | ( foldr ) 21 | import qualified Prelude as P 22 | ( foldr ) 23 | 24 | 25 | 26 | ------------- 27 | -- Functions 28 | ------------- 29 | 30 | -- | Returns the intersection of all 'Set's in the given list. 31 | intersections :: (Ord a) => [Set a] -> Set a 32 | intersections [] = empty 33 | intersections ss = 34 | P.foldr (\s1 s2 -> s1 `intersection` s2) 35 | (head ss) 36 | (tail ss) 37 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_L_asr.s.1: -------------------------------------------------------------------------------- 1 | 85 0: 2 | 1 [%1] <- "%1 = cmp.gt(%n, ##31)" <- [%n] 3 | 1 [] <- "if (%1) jump 2" <- [%1] 4 | 42 4: 5 | 1 [%0.copy.3] <- "%0.copy.3 = ##0" <- [] 6 | 1 [%5] <- "%5 = !cmp.gt(%n, ##<-31 - 1>)" <- [%n] 7 | 1 [] <- "if (%5) jump 13" <- [%5] 8 | 21 6: 9 | 1 [%7] <- "%7 = cmp.gt(%0.copy.3, %n)" <- [%0.copy.3, %n] 10 | 1 [%12] <- "%12 = asr(%a, %n)" <- [%a, %n] 11 | 1 [] <- "if (!%7) jump 11" <- [%7] 12 | 8 8: 13 | 1 [%9] <- "%9 = sub(%0.copy.3, %n)" <- [%0.copy.3, %n] 14 | 1 [%10] <- "%10 = asl(%a, %9)" <- [%a, %9] 15 | 1 [] <- "jump 13" <- [] 16 | 42 2: 17 | 1 [%3] <- "%3 = asr(%a, #31)" <- [%a] 18 | 13 11: 19 | 85 13: 20 | 0 [%.0] <- "PHI (%3, 2) (%10, 8) (%12, 6) (%0.copy.3, 4)" <- [%3, %10, %12, %0.copy.3] 21 | 1 [] <- "return %.0" <- [%.0] 22 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_add.s.1: -------------------------------------------------------------------------------- 1 | 32 0: 2 | 1 [%-32768.copy.1] <- "%-32768.copy.1 = #-32768" <- [] 3 | 1 [%2] <- "%2 = sxth(%b)" <- [%b] 4 | 1 [%1] <- "%1 = sxth(%a)" <- [%a] 5 | 1 [%3] <- "%3 = add(%2, %1)" <- [%2, %1] 6 | 1 [%4] <- "%4 = !cmp.gt(%3, ##<-32768 - 1>)" <- [%3] 7 | 1 [] <- "if (%4) jump 8" <- [%4] 8 | 16 5: 9 | 1 [%6] <- "%6 = cmp.gt(%3, ##32767)" <- [%3] 10 | 1 [] <- "if (!%6) jump .selectcont" <- [%6] 11 | 8 .selecttrue: 12 | 1 [%32767.copy.1] <- "%32767.copy.1 = ##32767" <- [] 13 | 16 .selectcont: 14 | 0 [%7] <- "PHI (%3, 0) (%32767.copy.1, .selecttrue)" <- [%3, %32767.copy.1] 15 | 1 [%phitmp] <- "%phitmp = and(%7, #-32768)" <- [%7] 16 | 32 8: 17 | 0 [%9] <- "PHI (%phitmp, .selectcont) (%-32768.copy.1, 0)" <- [%phitmp, %-32768.copy.1] 18 | 1 [] <- "return %9" <- [%9] 19 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_sub.s.1: -------------------------------------------------------------------------------- 1 | 32 0: 2 | 1 [%-32768.copy.1] <- "%-32768.copy.1 = #-32768" <- [] 3 | 1 [%2] <- "%2 = sxth(%b)" <- [%b] 4 | 1 [%1] <- "%1 = sxth(%a)" <- [%a] 5 | 1 [%3] <- "%3 = sub(%1, %2)" <- [%1, %2] 6 | 1 [%4] <- "%4 = !cmp.gt(%3, ##<-32768 - 1>)" <- [%3] 7 | 1 [] <- "if (%4) jump 8" <- [%4] 8 | 16 5: 9 | 1 [%6] <- "%6 = cmp.gt(%3, ##32767)" <- [%3] 10 | 1 [] <- "if (!%6) jump .selectcont" <- [%6] 11 | 8 .selecttrue: 12 | 1 [%32767.copy.1] <- "%32767.copy.1 = ##32767" <- [] 13 | 16 .selectcont: 14 | 0 [%7] <- "PHI (%3, 0) (%32767.copy.1, .selecttrue)" <- [%3, %32767.copy.1] 15 | 1 [%phitmp] <- "%phitmp = and(%7, #-32768)" <- [%7] 16 | 32 8: 17 | 0 [%9] <- "PHI (%phitmp, .selectcont) (%-32768.copy.1, 0)" <- [%phitmp, %-32768.copy.1] 18 | 1 [] <- "return %9" <- [%9] 19 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/g721.g711.ulaw2linear.s.1: -------------------------------------------------------------------------------- 1 | 16 0: 2 | 1 [%255.copy.1] <- "%255.copy.1 = ##255" <- [] 3 | 1 [%2] <- "%2 = xor(%255.copy.1, %u_val)" <- [%255.copy.1, %u_val] 4 | 1 [%6] <- "%6 = lsr(%2, #4)" <- [%2] 5 | 1 [%7] <- "%7 = and(%6, #7)" <- [%6] 6 | 1 [%3] <- "%3 = asl(%2, #3)" <- [%2] 7 | 1 [%4] <- "%4 = and(%3, #120)" <- [%3] 8 | 1 [%5] <- "%5 = or(%4, #132)" <- [%4] 9 | 1 [%8] <- "%8 = asl(%5, %7)" <- [%5, %7] 10 | 1 [%12] <- "%12 = add(%8, #-132)" <- [%8] 11 | 1 [%9] <- "%9 = and(%2, #128)" <- [%2] 12 | 1 [%10] <- "%10 = !cmp.eq(%9, ##0)" <- [%9] 13 | 1 [] <- "if (!%10) jump .selectcont" <- [%10] 14 | 8 .selecttrue: 15 | 1 [%11] <- "%11 = sub(#132, %8)" <- [%8] 16 | 16 .selectcont: 17 | 0 [%13] <- "PHI (%11, .selecttrue) (%12, 0)" <- [%11, %12] 18 | 1 [] <- "return %13" <- [%13] 19 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_add.s.1: -------------------------------------------------------------------------------- 1 | 32 0: 2 | 1 [%-32768.copy.1] <- "ADDi %-32768.copy.1, $0, -32768" <- [] 3 | 0 [%1] <- "ADD %1, $0, %a" <- [%a] 4 | 0 [%2] <- "ADD %2, $0, %b" <- [%b] 5 | 1 [%3] <- "ADDU $%3, $%2, $%1" <- [%2, %1] 6 | 0 [%4] <- "SLTI $%4, $%3, -32768" <- [%3] 7 | 1 [] <- "BNE $0, $%4, 8" <- [%4] 8 | 16 5: 9 | 1 [%32767.copy.2] <- "ADDiu %32767.copy.2, $0, 32767" <- [] 10 | 1 [] <- "BGT $%3, $%32767.copy.2, .selecttrue" <- [%3, %32767.copy.2] 11 | 8 .selecttrue: 12 | 16 .selectcont: 13 | 0 [%7] <- "PHI (%3, 0) (%32767.copy.2, 5)" <- [%3, %32767.copy.2] 14 | 0 [%phitmp] <- "ANDi %phitmp, %7, 32767" <- [%7] 15 | 32 8: 16 | 0 [%9] <- "PHI (%phitmp, .selectcont) (%-32768.copy.1, 0)" <- [%phitmp, %-32768.copy.1] 17 | [] <- "SEH %tmp.1, %9" <- [%9] 18 | 0 [] <- "RetRA %tmp.1" <- [] 19 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_sub.s.1: -------------------------------------------------------------------------------- 1 | 32 0: 2 | 1 [%-32768.copy.1] <- "ADDi %-32768.copy.1, $0, -32768" <- [] 3 | 0 [%1] <- "ADD %1, $0, %a" <- [%a] 4 | 0 [%2] <- "ADD %2, $0, %b" <- [%b] 5 | 1 [%3] <- "SUBU $%3, $%1, $%2" <- [%1, %2] 6 | 0 [%4] <- "SLTI $%4, $%3, -32768" <- [%3] 7 | 1 [] <- "BNE $0, $%4, 8" <- [%4] 8 | 16 5: 9 | 1 [%32767.copy.2] <- "ADDiu %32767.copy.2, $0, 32767" <- [] 10 | 1 [] <- "BGT $%3, $%32767.copy.2, .selecttrue" <- [%3, %32767.copy.2] 11 | 8 .selecttrue: 12 | 16 .selectcont: 13 | 0 [%7] <- "PHI (%3, 0) (%32767.copy.2, 5)" <- [%3, %32767.copy.2] 14 | 0 [%phitmp] <- "ANDi %phitmp, %7, 32767" <- [%7] 15 | 32 8: 16 | 0 [%9] <- "PHI (%phitmp, .selectcont) (%-32768.copy.1, 0)" <- [%phitmp, %-32768.copy.1] 17 | [] <- "SEH %tmp.1, %9" <- [%9] 18 | 0 [] <- "RetRA %tmp.1" <- [] 19 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_L_asr.s.1: -------------------------------------------------------------------------------- 1 | 85 0: 2 | 1 [%31.copy.2] <- "ADDiu %31.copy.2, $0, 31" <- [] 3 | 1 [] <- "BGT $%n, $%31.copy.2, 2" <- [%n, %31.copy.2] 4 | 42 4: 5 | 1 [%0.copy.1.copy.1] <- "MOV %0.copy.1.copy.1, r0" <- [%0.copy.2] 6 | 0 [%5] <- "SLTI $%5, $%n, -31" <- [%n] 7 | 1 [] <- "BNE $0, $%5, 13" <- [%5] 8 | 21 6: 9 | 1 [] <- "BLTZ %n, 8" <- [%n] 10 | 13 11: 11 | 1 [%12] <- "SRAV $%12, $%a, $%n" <- [%a, %n] 12 | 1 [] <- "B 13" <- [] 13 | 42 2: 14 | 1 [%3] <- "SRAV $%3, $%a, $%31.copy.2" <- [%a, %31.copy.2] 15 | 85 13: 16 | 0 [%.0] <- "PHI (%3, 2) (%10, 8) (%12, 11) (%0.copy.1.copy.1, 4)" <- [%3, %10, %12, %0.copy.1.copy.1] 17 | 0 [] <- "RetRA %.0" <- [%.0] 18 | 8 8: 19 | 1 [%9] <- "SUBU $%9, $r0, $%n" <- [%0.copy.1, %n] 20 | 1 [%10] <- "SLLV $%10, $%a, $%9" <- [%a, %9] 21 | 1 [] <- "B 13" <- [] 22 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_mult_r.s.1: -------------------------------------------------------------------------------- 1 | 16 0: 2 | 1 [%32767.copy.1] <- "ADDi %32767.copy.1, $0, 32767" <- [] 3 | [] <- "XORi %tmp.1 %b, -32768" <- [%b] 4 | 2 [%1] <- "SLTiu %1, %tmp.1, 1" <- [] 5 | [] <- "XORi %tmp.2 %a, -32768" <- [%a] 6 | 2 [%2] <- "SLTiu %2, %tmp.2, 1" <- [] 7 | 1 [%or.cond] <- "AND $%or.cond, $%2, $%1" <- [%2, %1] 8 | 1 [] <- "BNE $0, $%or.cond, 10" <- [%or.cond] 9 | 8 3: 10 | 0 [%4] <- "ADD %4, $0, %b" <- [%b] 11 | 0 [%5] <- "ADD %5, $0, %a" <- [%a] 12 | 17 [%6] <- "MUL $%6, $%5, $%4" <- [%5, %4] 13 | 1 [%7] <- "ADDI $%7, $%6, 16384" <- [%6] 14 | 1 [%8] <- "SRL $%8, $%7, 15" <- [%7] 15 | 0 [%9] <- "ANDi %9, %8, 32767" <- [%8] 16 | 16 10: 17 | 0 [%.0] <- "PHI (%9, 3) (%32767.copy.1, 0)" <- [%9, %32767.copy.1] 18 | [] <- "SEH %tmp.3, %.0" <- [%.0] 19 | 0 [] <- "RetRA %tmp.3" <- [] 20 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_L_asl.s.1: -------------------------------------------------------------------------------- 1 | 85 0: 2 | 1 [%0.copy.3] <- "%0.copy.3 = ##0" <- [] 3 | 1 [%1] <- "%1 = cmp.gt(%n, ##31)" <- [%n] 4 | 1 [] <- "if (%1) jump gsm_L_asr.exit" <- [%1] 5 | 42 2: 6 | 1 [%3] <- "%3 = !cmp.gt(%n, ##<-31 - 1>)" <- [%n] 7 | 1 [] <- "if (%3) jump 4" <- [%3] 8 | 21 6: 9 | 1 [%7] <- "%7 = cmp.gt(%0.copy.3, %n)" <- [%0.copy.3, %n] 10 | 1 [%12] <- "%12 = asl(%a, %n)" <- [%a, %n] 11 | 1 [] <- "if (!%7) jump 11" <- [%7] 12 | 8 8: 13 | 1 [%9] <- "%9 = sub(%0.copy.3, %n)" <- [%0.copy.3, %n] 14 | 1 [%10] <- "%10 = asr(%a, %9)" <- [%a, %9] 15 | 1 [] <- "jump gsm_L_asr.exit" <- [] 16 | 21 4: 17 | 1 [%5] <- "%5 = asr(%a, #31)" <- [%a] 18 | 13 11: 19 | 85 gsm_L_asr.exit: 20 | 0 [%.0] <- "PHI (%5, 4) (%10, 8) (%12, 6) (%0.copy.3, 0)" <- [%5, %10, %12, %0.copy.3] 21 | 1 [] <- "return %.0" <- [%.0] 22 | -------------------------------------------------------------------------------- /testing/regression/reuse.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = 'reuse.ll' 2 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 3 | target triple = "x86_64-unknown-linux-gnu" 4 | 5 | ; Function Attrs: nounwind uwtable 6 | define i32 @func(i32 %a) #0 { 7 | entry: 8 | %b = add nsw i32 %a, 100000 9 | %c = add nsw i32 %b, 100000 10 | ret i32 %c 11 | } 12 | 13 | attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } 14 | 15 | !llvm.ident = !{!0} 16 | 17 | !0 = !{!"clang version 3.8.0 (/home/ghb/programs/clang/ 07a6361e0f32f699d47c124106e7911b584974d4) (ssh://git@luggage.sics.se/zapbar-llvm-int.git 3489288de822323d56f1806b977ebf039698ec82)"} 18 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_abs.s.1: -------------------------------------------------------------------------------- 1 | 42 0: 2 | [] <- "%tmp.1 = zxth %a" <- [%a] 3 | 2 [%2] <- "%2 = !cmp.gt(%tmp.1, ##<0 - 1>)" <- [] 4 | 1 [%1] <- "%1 = sxth(%a)" <- [%a] 5 | 1 [] <- "if (!%2) jump 6" <- [%2] 6 | 16 3: 7 | 1 [%-32768.copy.1] <- "%-32768.copy.1 = #-32768" <- [] 8 | 1 [%5] <- "%5 = sub(#0, %1)" <- [%1] 9 | [] <- "%tmp.2 = zxth %a" <- [%-32768.copy.1, %a] 10 | [] <- "%tmp.3 = zxth %-32768.copy.1" <- [] 11 | 3 [%4] <- "%4 = cmp.eq(%tmp.2, %tmp.3)" <- [] 12 | 1 [] <- "if (!%4) jump .selectcont" <- [%4] 13 | 8 .selecttrue: 14 | 1 [%32767.copy.1] <- "%32767.copy.1 = ##32767" <- [] 15 | 16 .selectcont: 16 | 0 [%.] <- "PHI (%5, 3) (%32767.copy.1, .selecttrue)" <- [%5, %32767.copy.1] 17 | 42 6: 18 | 0 [%7] <- "PHI (%1, 0) (%., .selectcont)" <- [%1, %.] 19 | 1 [%8] <- "%8 = and(%7, #-32768)" <- [%7] 20 | 1 [] <- "return %8" <- [%8] 21 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_L_asl.s.1: -------------------------------------------------------------------------------- 1 | 85 0: 2 | 1 [%31.copy.2] <- "ADDiu %31.copy.2, $0, 31" <- [] 3 | 1 [%0.copy.1.copy.1] <- "MOV %0.copy.1.copy.1, r0" <- [%0.copy.2] 4 | 1 [] <- "BGT $%n, $%31.copy.2, gsm_L_asr.exit" <- [%n, %31.copy.2] 5 | 42 2: 6 | 0 [%3] <- "SLTI $%3, $%n, -31" <- [%n] 7 | 1 [] <- "BNE $0, $%3, 4" <- [%3] 8 | 21 6: 9 | 1 [] <- "BLTZ %n, 8" <- [%n] 10 | 13 11: 11 | 1 [%12] <- "SLLV $%12, $%a, $%n" <- [%a, %n] 12 | 1 [] <- "B gsm_L_asr.exit" <- [] 13 | 21 4: 14 | 1 [%5] <- "SRAV $%5, $%a, $%31.copy.2" <- [%a, %31.copy.2] 15 | 85 gsm_L_asr.exit: 16 | 0 [%.0] <- "PHI (%5, 4) (%10, 8) (%12, 11) (%0.copy.1.copy.1, 0)" <- [%5, %10, %12, %0.copy.1.copy.1] 17 | 0 [] <- "RetRA %.0" <- [%.0] 18 | 8 8: 19 | 1 [%9] <- "SUBU $%9, $r0, $%n" <- [%0.copy.1, %n] 20 | 1 [%10] <- "SRAV $%10, $%a, $%9" <- [%a, %9] 21 | 1 [] <- "B gsm_L_asr.exit" <- [] 22 | -------------------------------------------------------------------------------- /testing/regression/mem.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = 'mem.ll' 2 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 3 | target triple = "x86_64-unknown-linux-gnu" 4 | 5 | ; Function Attrs: nounwind uwtable 6 | define i32 @func(i32* %a) #0 { 7 | entry: 8 | %0 = load i32, i32* %a, align 4 9 | %add = add nsw i32 %0, 1 10 | store i32 %add, i32* %a, align 4 11 | ret i32 %add 12 | } 13 | 14 | attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } 15 | 16 | !llvm.ident = !{!0} 17 | 18 | !0 = !{!"clang version 3.8.0 (/home/ghb/programs/clang/ 07a6361e0f32f699d47c124106e7911b584974d4) (ssh://git@luggage.sics.se/zapbar-llvm-int.git 3489288de822323d56f1806b977ebf039698ec82)"} 19 | -------------------------------------------------------------------------------- /testing/regression/jpeg.jutils.jround_up.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = 'jpeg.jutils.jround_up.ll' 2 | target datalayout = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64" 3 | target triple = "mips--linux-gnu" 4 | 5 | ; Function Attrs: norecurse nounwind readnone 6 | define i32 @jround_up(i32 signext %a, i32 signext %b) #0 { 7 | %1 = add i32 %a, -1 8 | %2 = add i32 %1, %b 9 | %3 = srem i32 %2, %b 10 | %4 = sub nsw i32 %2, %3 11 | ret i32 %4 12 | } 13 | 14 | attributes #0 = { norecurse nounwind readnone "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="mips32r2" "target-features"="+mips32r2" "unsafe-fp-math"="false" "use-soft-float"="false" } 15 | 16 | !llvm.ident = !{!0} 17 | 18 | !0 = !{!"clang version 3.8.0 (http://llvm.org/git/clang.git 2d49f0a0ae8366964a93e3b7b26e29679bee7160) (http://llvm.org/git/llvm.git 60bc66b44837125843b58ed3e0fd2e6bb948d839)"} 19 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_mult.s.1: -------------------------------------------------------------------------------- 1 | 16 0: 2 | 1 [%32767.copy.1] <- "%32767.copy.1 = #32767" <- [] 3 | 1 [%-32768.copy.1] <- "%-32768.copy.1 = #-32768" <- [] 4 | [] <- "%tmp.1 = zxth %b" <- [%-32768.copy.1, %b] 5 | [] <- "%tmp.2 = zxth %-32768.copy.1" <- [] 6 | 3 [%2] <- "%2 = cmp.eq(%tmp.1, %tmp.2)" <- [] 7 | [] <- "%tmp.3 = zxth %a" <- [%-32768.copy.1, %a] 8 | [] <- "%tmp.4 = zxth %-32768.copy.1" <- [] 9 | 3 [%1] <- "%1 = cmp.eq(%tmp.3, %tmp.4)" <- [] 10 | 1 [%or.cond] <- "%or.cond = and(%2, %1)" <- [%2, %1] 11 | 1 [] <- "if (%or.cond) jump 9" <- [%or.cond] 12 | 8 3: 13 | 1 [%5] <- "%5 = sxth(%b)" <- [%b] 14 | 1 [%4] <- "%4 = sxth(%a)" <- [%a] 15 | 1 [%6] <- "%6 = mpy(%5, %4)" <- [%5, %4] 16 | 1 [%7] <- "%7 = lsr(%6, #15)" <- [%6] 17 | 1 [%8] <- "%8 = and(%7, #-32768)" <- [%7] 18 | 16 9: 19 | 0 [%.0] <- "PHI (%8, 3) (%32767.copy.1, 0)" <- [%8, %32767.copy.1] 20 | 1 [] <- "return %.0" <- [%.0] 21 | -------------------------------------------------------------------------------- /testing/regression/phi.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = 'phi.ll' 2 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 3 | target triple = "x86_64-unknown-linux-gnu" 4 | 5 | ; Function Attrs: nounwind uwtable 6 | define i32 @func(i32 %n) #0 { 7 | entry: 8 | %cmp = icmp sgt i32 %n, 1 9 | %x = add i32 %n, 10 10 | br i1 %cmp, label %bb1, label %bb2 11 | bb1: 12 | br label %bb2 13 | bb2: 14 | %y = phi i32 [ %x, %entry ], [ %x, %bb1 ] 15 | ret i32 %y 16 | } 17 | 18 | attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } 19 | 20 | !llvm.ident = !{!0} 21 | 22 | !0 = !{!"clang version 3.8.0 (/home/ghb/programs/clang/ 07a6361e0f32f699d47c124106e7911b584974d4) (ssh://git@luggage.sics.se/zapbar-llvm-int.git 3489288de822323d56f1806b977ebf039698ec82)"} 23 | -------------------------------------------------------------------------------- /uni-is-llvm/uni-is-llvm.cabal: -------------------------------------------------------------------------------- 1 | -- Initial instr-sel.cabal generated by cabal init. For further 2 | -- documentation, see http://haskell.org/cabal/users-guide/ 3 | 4 | name: uni-is-llvm 5 | version: 0.1.0.0 6 | --synopsis: 7 | --description: 8 | license: BSD3 9 | license-file: LICENSE 10 | author: Gabriel Hjort Blindell 11 | maintainer: ghb@kth.se 12 | --copyright: 13 | category: Language 14 | build-type: Simple 15 | --extra-source-files: 16 | cabal-version: >=1.10 17 | 18 | executable uni-is-llvm 19 | main-is: UniISLLVM.hs 20 | --other-modules: 21 | other-extensions: DeriveDataTypeable, 22 | GeneralizedNewtypeDeriving 23 | build-depends: base >=4.5, 24 | cmdargs >=0.10, 25 | instr-sel, 26 | llvm-general >= 3.8 && < 3.9, 27 | mtl >= 2.2 28 | hs-source-dirs: . 29 | default-language: Haskell2010 30 | ghc-options: -Wall -O2 31 | -------------------------------------------------------------------------------- /uni-is-targets/uni-is-targets.cabal: -------------------------------------------------------------------------------- 1 | -- Initial uni-is-targets.cabal generated by cabal init. For further 2 | -- documentation, see http://haskell.org/cabal/users-guide/ 3 | 4 | name: uni-is-targets 5 | version: 0.1.0.0 6 | --synopsis: 7 | --description: 8 | license: BSD3 9 | license-file: LICENSE 10 | author: Gabriel Hjort Blindell 11 | maintainer: ghb@kth.se 12 | --copyright: 13 | category: Language 14 | build-type: Simple 15 | --extra-source-files: 16 | cabal-version: >=1.10 17 | 18 | library 19 | exposed-modules: 20 | UniIS.Targets.Mips32 21 | UniIS.Targets.Hexagon5 22 | UniIS.Targets.X86Minus64 23 | other-modules: 24 | UniIS.Targets.X86Minus64sub0 25 | UniIS.Targets.X86Minus64sub1 26 | build-depends: base >=4.5, 27 | containers >= 0.4, 28 | fgl, 29 | instr-sel, 30 | mtl >= 2.2 31 | default-language: Haskell2010 32 | ghc-options: -Wall -O0 33 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_mult_r.s.1: -------------------------------------------------------------------------------- 1 | 16 0: 2 | 1 [%32767.copy.1] <- "%32767.copy.1 = #32767" <- [] 3 | 1 [%-32768.copy.1] <- "%-32768.copy.1 = #-32768" <- [] 4 | [] <- "%tmp.1 = zxth %b" <- [%-32768.copy.1, %b] 5 | [] <- "%tmp.2 = zxth %-32768.copy.1" <- [] 6 | 3 [%1] <- "%1 = cmp.eq(%tmp.1, %tmp.2)" <- [] 7 | [] <- "%tmp.3 = zxth %a" <- [%-32768.copy.1, %a] 8 | [] <- "%tmp.4 = zxth %-32768.copy.1" <- [] 9 | 3 [%2] <- "%2 = cmp.eq(%tmp.3, %tmp.4)" <- [] 10 | 1 [%or.cond] <- "%or.cond = and(%2, %1)" <- [%2, %1] 11 | 1 [] <- "if (%or.cond) jump 10" <- [%or.cond] 12 | 8 3: 13 | 1 [%16384.copy.1] <- "%16384.copy.1 = ##16384" <- [] 14 | 1 [%4] <- "%4 = sxth(%b)" <- [%b] 15 | 1 [%5] <- "%5 = sxth(%a)" <- [%a] 16 | 1 [%7] <- "%16384.copy.1 += mpy(%5, %4)" <- [%16384.copy.1, %5, %4] 17 | 1 [%8] <- "%8 = lsr(%7, #15)" <- [%7] 18 | 1 [%9] <- "%9 = and(%8, #-32768)" <- [%8] 19 | 16 10: 20 | 0 [%.0] <- "PHI (%9, 3) (%32767.copy.1, 0)" <- [%9, %32767.copy.1] 21 | 1 [] <- "return %.0" <- [%.0] 22 | -------------------------------------------------------------------------------- /uni-is-llvm/UniISLLVM/Drivers/Base.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | {-# LANGUAGE DeriveDataTypeable #-} 13 | 14 | module UniISLLVM.Drivers.Base 15 | ( MakeAction (..) 16 | , Options (..) 17 | , module Language.InstrSel.DriverTools 18 | ) 19 | where 20 | 21 | import System.Console.CmdArgs 22 | ( Data 23 | , Typeable 24 | ) 25 | 26 | import Language.InstrSel.DriverTools 27 | 28 | 29 | 30 | -------------- 31 | -- Data types 32 | -------------- 33 | 34 | -- | Options that can be given on the command line. 35 | data Options 36 | = Options 37 | { command :: String 38 | , functionFile :: Maybe String 39 | , outFile :: Maybe String 40 | , makeAction :: MakeAction 41 | } 42 | deriving (Data, Typeable) 43 | 44 | -- | Represents 'make' actions. 45 | data MakeAction 46 | = MakeNothing 47 | | MakeFunctionGraphFromLLVM 48 | deriving (Eq, Typeable, Data) 49 | -------------------------------------------------------------------------------- /testing/regression/phi-dual-use.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = 'phi.ll' 2 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 3 | target triple = "x86_64-unknown-linux-gnu" 4 | 5 | ; Function Attrs: nounwind uwtable 6 | define i32 @func(i32 %n) #0 { 7 | entry: 8 | %cmp = icmp sgt i32 %n, 1 9 | %x = add i32 %n, 10 10 | br i1 %cmp, label %bb1, label %bb2 11 | bb1: 12 | br label %bb2 13 | bb2: 14 | %y = phi i32 [ %x, %entry ], [ 0, %bb1 ] 15 | %z = phi i32 [ %x, %entry ], [ 0, %bb1 ] 16 | %bla = add i32 %y, %z 17 | ret i32 %bla 18 | } 19 | 20 | attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } 21 | 22 | !llvm.ident = !{!0} 23 | 24 | !0 = !{!"clang version 3.8.0 (/home/ghb/programs/clang/ 07a6361e0f32f699d47c124106e7911b584974d4) (ssh://git@luggage.sics.se/zapbar-llvm-int.git 3489288de822323d56f1806b977ebf039698ec82)"} 25 | -------------------------------------------------------------------------------- /uni-is-llvm/UniISLLVM/Drivers/MakeDispatcher.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright : Copyright (c) 2012-2017, Gabriel Hjort Blindell 3 | License : BSD3 (see the LICENSE file) 4 | Maintainer : ghb@kth.se 5 | -} 6 | {- 7 | Main authors: 8 | Gabriel Hjort Blindell 9 | 10 | -} 11 | 12 | module UniISLLVM.Drivers.MakeDispatcher 13 | ( run ) 14 | where 15 | 16 | import UniISLLVM.Drivers.DispatcherTools 17 | import qualified UniISLLVM.Drivers.MakeFunctionFromLLVM as MakeFunctionFromLLVM 18 | 19 | 20 | 21 | ------------- 22 | -- Functions 23 | ------------- 24 | 25 | -- | Function for executing this dispatcher. 26 | run :: Options -> IO [Output] 27 | run opts = dispatch (makeAction opts) opts 28 | 29 | -- | Dispatches execution to the correct driver. 30 | dispatch :: MakeAction -> Options -> IO [Output] 31 | dispatch a opts 32 | | a == MakeNothing = 33 | reportErrorAndExit "No make action provided." 34 | | a `elem` [MakeFunctionGraphFromLLVM] = 35 | do content <- loadFunctionFileContent opts 36 | MakeFunctionFromLLVM.run a content 37 | | otherwise = 38 | reportErrorAndExit "MakeDispatcher: unsupported action" 39 | -------------------------------------------------------------------------------- /testing/regression/pointers.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = 'ptr.ll' 2 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 3 | target triple = "x86_64-unknown-linux-gnu" 4 | 5 | ; Function Attrs: nounwind uwtable 6 | define void @func(i32* %a) #0 { 7 | entry: 8 | %0 = icmp eq i32* %a, null 9 | br i1 %0, label %end, label %load 10 | 11 | load: 12 | %1 = inttoptr i16 255 to i32* 13 | %2 = inttoptr i32 255 to i32* 14 | %3 = load i32, i32* %1, align 4 15 | %4 = load i32, i32* %2, align 4 16 | %5 = add nsw i32 %3, %4 17 | store i32 %5, i32* %a, align 4 18 | br label %end 19 | 20 | end: 21 | ret void 22 | } 23 | 24 | attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } 25 | 26 | !llvm.ident = !{!0} 27 | 28 | !0 = !{!"clang version 3.8.0 (/home/ghb/programs/clang/ 07a6361e0f32f699d47c124106e7911b584974d4) (ssh://git@luggage.sics.se/zapbar-llvm-int.git 3489288de822323d56f1806b977ebf039698ec82)"} 29 | -------------------------------------------------------------------------------- /uni-is/uni-is.cabal: -------------------------------------------------------------------------------- 1 | -- Initial instr-sel.cabal generated by cabal init. For further 2 | -- documentation, see http://haskell.org/cabal/users-guide/ 3 | 4 | name: uni-is 5 | version: 0.1.0.0 6 | --synopsis: 7 | --description: 8 | license: BSD3 9 | license-file: LICENSE 10 | author: Gabriel Hjort Blindell 11 | maintainer: ghb@kth.se 12 | --copyright: 13 | category: Language 14 | build-type: Simple 15 | --extra-source-files: 16 | cabal-version: >=1.10 17 | 18 | executable uni-is 19 | main-is: UniIS.hs 20 | --other-modules: 21 | other-extensions: DeriveDataTypeable, 22 | GeneralizedNewtypeDeriving 23 | build-depends: base >=4.5, 24 | clock >=0.5, 25 | cmdargs >=0.10, 26 | containers >= 0.4, 27 | deepseq >=1.3, 28 | fgl, 29 | graphviz >=2999.18, 30 | instr-sel, 31 | mtl >= 2.2, 32 | uni-is-targets 33 | hs-source-dirs: . 34 | default-language: Haskell2010 35 | ghc-options: -Wall -O2 36 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/pgp.rsaglue2.make_RSA_PUBLIC_KEY.s.1: -------------------------------------------------------------------------------- 1 | 32 0: 2 | 1 [%2048.copy.1] <- "%2048.copy.1 = ##2048" <- [] 3 | 1 [%-3.copy.1] <- "%-3.copy.1 = ##-3" <- [] 4 | 1 [%1] <- "call countbits" <- [%n] 5 | 1 [%3] <- "%3 = cmp.gtu(%1, %2048.copy.1)" <- [%1, %2048.copy.1] 6 | 1 [] <- "memw(%rpk) = %1" <- [%1, %rpk] 7 | 1 [] <- "if (%3) jump reg2rsaref.exit1" <- [%3] 8 | 16 4: 9 | 1 [%0.copy.1] <- "%0.copy.1 = ##0" <- [] 10 | 1 [%6] <- "%6 = memh(#@global_precision)" <- [] 11 | 1 [%7] <- "%7 = sxth(%6)" <- [%6] 12 | 1 [%8] <- "%8 = asl(%7, #1)" <- [%7] 13 | 1 [%9] <- "%9 = !cmp.gt(%8, ##<256 - 1>)" <- [%8] 14 | 1 [] <- "if (!%9) jump 16" <- [%9] 15 | 8 16: 16 | 8 10: 17 | 16 reg2rsaref.exit: 18 | 1 [%21] <- "%21 = memh(#@global_precision)" <- [] 19 | 1 [%22] <- "%22 = sxth(%21)" <- [%21] 20 | 1 [%23] <- "%23 = asl(%22, #1)" <- [%22] 21 | 1 [%24] <- "%24 = !cmp.gt(%23, ##<256 - 1>)" <- [%23] 22 | 1 [] <- "if (!%24) jump 31" <- [%24] 23 | 8 31: 24 | 8 25: 25 | 32 reg2rsaref.exit1: 26 | 0 [%.0] <- "PHI (%-3.copy.1, 0) (%0.copy.1, 4) (%0.copy.1, 4)" <- [%-3.copy.1, %0.copy.1, %0.copy.1] 27 | 1 [] <- "return %.0" <- [%.0] 28 | -------------------------------------------------------------------------------- /testing/regression/hexagon5/gsm.add.gsm_asr.s.1: -------------------------------------------------------------------------------- 1 | 85 0: 2 | 1 [%1] <- "%1 = cmp.gt(%n, ##15)" <- [%n] 3 | 1 [] <- "if (%1) jump 2" <- [%1] 4 | 42 6: 5 | 1 [%0.copy.1] <- "%0.copy.1 = #0" <- [] 6 | 1 [%7] <- "%7 = !cmp.gt(%n, ##<-15 - 1>)" <- [%n] 7 | 1 [] <- "if (%7) jump 18" <- [%7] 8 | 21 8: 9 | 1 [%9] <- "%9 = !cmp.gt(%n, ##<0 - 1>)" <- [%n] 10 | 1 [%10] <- "%10 = sxth(%a)" <- [%a] 11 | 1 [] <- "if (%9) jump 11" <- [%9] 12 | 13 15: 13 | 1 [%16] <- "%16 = asr(%10, %n)" <- [%10, %n] 14 | 1 [%17] <- "%17 = and(%16, #-32768)" <- [%16] 15 | 1 [] <- "jump 18" <- [] 16 | 42 2: 17 | [] <- "%tmp.1 = lsr(%a, #15)" <- [%a] 18 | 2 [%a.lobit] <- "%a.lobit = zxth(%tmp.1)" <- [] 19 | 1 [%3] <- "%3 = zxth %a.lobit" <- [%a.lobit] 20 | 1 [%4] <- "%4 = sub(#0, %3)" <- [%3] 21 | 1 [%5] <- "%5 = and(%4, #-32768)" <- [%4] 22 | 85 18: 23 | 0 [%.0] <- "PHI (%5, 2) (%14, 11) (%17, 15) (%0.copy.1, 6)" <- [%5, %14, %17, %0.copy.1] 24 | 1 [] <- "return %.0" <- [%.0] 25 | 8 11: 26 | 1 [%12] <- "%12 = sub(#0, %n)" <- [%n] 27 | 1 [%13] <- "%13 = asl(%10, %12)" <- [%10, %12] 28 | 1 [%14] <- "%14 = and(%13, #-32768)" <- [%13] 29 | 1 [] <- "jump 18" <- [] 30 | -------------------------------------------------------------------------------- /testing/regression/mips32/gsm.add.gsm_asr.s.1: -------------------------------------------------------------------------------- 1 | 85 0: 2 | 1 [%15.copy.2] <- "ADDiu %15.copy.2, $0, 15" <- [] 3 | 1 [] <- "BGT $%n, $%15.copy.2, 2" <- [%n, %15.copy.2] 4 | 42 6: 5 | 1 [%0.copy.1.copy.1] <- "MOV %0.copy.1.copy.1, r0" <- [%0.copy.1] 6 | 0 [%7] <- "SLTI $%7, $%n, -15" <- [%n] 7 | 1 [] <- "BNE $0, $%7, 18" <- [%7] 8 | 21 8: 9 | 0 [%10] <- "ADD %10, $0, %a" <- [%a] 10 | 1 [] <- "BLTZ %n, 11" <- [%n] 11 | 13 15: 12 | 1 [%16] <- "SRAV $%16, $%10, $%n" <- [%10, %n] 13 | 0 [%17] <- "ANDi %17, %16, 32767" <- [%16] 14 | 1 [] <- "B 18" <- [] 15 | 42 2: 16 | 1 [%a.lobit] <- "SRL $%a.lobit, $%a, 15" <- [%a] 17 | 1 [%3] <- "ANDi %3, %a.lobit, 32767" <- [%a.lobit] 18 | 1 [%4] <- "SUBU $%4, $r0, $%3" <- [%0.copy.4, %3] 19 | 0 [%5] <- "ANDi %5, %4, 32767" <- [%4] 20 | 85 18: 21 | 0 [%.0] <- "PHI (%5, 2) (%14, 11) (%17, 15) (%0.copy.1.copy.1, 6)" <- [%5, %14, %17, %0.copy.1.copy.1] 22 | [] <- "SEH %tmp.1, %.0" <- [%.0] 23 | 0 [] <- "RetRA %tmp.1" <- [] 24 | 8 11: 25 | 1 [%12] <- "SUBU $%12, $r0, $%n" <- [%0.copy.2, %n] 26 | 1 [%13] <- "SLLV $%13, $%10, $%12" <- [%10, %12] 27 | 0 [%14] <- "ANDi %14, %13, 32767" <- [%13] 28 | 1 [] <- "B 18" <- [] 29 | -------------------------------------------------------------------------------- /testing/regression/g721.g711.ulaw2linear.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = 'g721.g711.ulaw2linear.ll' 2 | target datalayout = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64" 3 | target triple = "mips--linux-gnu" 4 | 5 | ; Function Attrs: norecurse nounwind readnone 6 | define i32 @ulaw2linear(i8 zeroext %u_val) #0 { 7 | %1 = zext i8 %u_val to i32 8 | %2 = xor i32 %1, 255 9 | %3 = shl nuw nsw i32 %2, 3 10 | %4 = and i32 %3, 120 11 | %5 = or i32 %4, 132 12 | %6 = lshr i32 %2, 4 13 | %7 = and i32 %6, 7 14 | %8 = shl i32 %5, %7 15 | %9 = and i32 %2, 128 16 | %10 = icmp ne i32 %9, 0 17 | %11 = sub nsw i32 132, %8 18 | %12 = add nsw i32 %8, -132 19 | %13 = select i1 %10, i32 %11, i32 %12 20 | ret i32 %13 21 | } 22 | 23 | attributes #0 = { norecurse nounwind readnone "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="mips32r2" "target-features"="+mips32r2" "unsafe-fp-math"="false" "use-soft-float"="false" } 24 | 25 | !llvm.ident = !{!0} 26 | 27 | !0 = !{!"clang version 3.8.0 (http://llvm.org/git/clang.git 2d49f0a0ae8366964a93e3b7b26e29679bee7160) (http://llvm.org/git/llvm.git 60bc66b44837125843b58ed3e0fd2e6bb948d839)"} 28 | -------------------------------------------------------------------------------- /testing/regression/call.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = 'call.ll' 2 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 3 | target triple = "x86_64-unknown-linux-gnu" 4 | 5 | ; Function Attrs: nounwind uwtable 6 | define i32 @func(i32 %a) #0 { 7 | entry: 8 | %call = call i32 @foo(i32 %a) 9 | ret i32 %call 10 | } 11 | 12 | declare i32 @foo(i32) #1 13 | 14 | attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } 15 | attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } 16 | 17 | !llvm.ident = !{!0} 18 | 19 | !0 = !{!"clang version 3.8.0 (/home/ghb/programs/clang/ 07a6361e0f32f699d47c124106e7911b584974d4) (ssh://git@luggage.sics.se/zapbar-llvm-int.git 3489288de822323d56f1806b977ebf039698ec82)"} 20 | -------------------------------------------------------------------------------- /uni-targen/uni-targen.cabal: -------------------------------------------------------------------------------- 1 | -- Initial instr-sel.cabal generated by cabal init. For further 2 | -- documentation, see http://haskell.org/cabal/users-guide/ 3 | 4 | name: uni-targen 5 | version: 0.1.0.0 6 | --synopsis: 7 | --description: 8 | license: BSD3 9 | license-file: LICENSE 10 | author: Gabriel Hjort Blindell 11 | maintainer: ghb@kth.se 12 | --copyright: 13 | category: Language 14 | build-type: Simple 15 | --extra-source-files: 16 | cabal-version: >=1.10 17 | 18 | executable uni-targen 19 | main-is: UniTarGen.hs 20 | --other-modules: 21 | other-extensions: DeriveDataTypeable 22 | build-depends: base >=4.5, 23 | cmdargs >=0.10, 24 | directory >=1.2, 25 | instr-sel, 26 | llvm-general >= 3.8 && < 3.9, 27 | llvm-general-pure >= 3.8 && < 3.9, 28 | mtl >= 2.2 29 | hs-source-dirs: . 30 | default-language: Haskell2010 31 | ghc-options: -Wall -O2 32 | -- In order to pretty-print the generated Haskell code, 33 | -- we must increase the stack space 34 | "-with-rtsopts=-K128m" 35 | -------------------------------------------------------------------------------- /testing/regression/gsm.add.gsm_abs.ll: -------------------------------------------------------------------------------- 1 | ; ModuleID = 'gsm.add.gsm_abs.ll' 2 | target datalayout = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64" 3 | target triple = "mips--linux-gnu" 4 | 5 | ; Function Attrs: norecurse nounwind readnone 6 | define signext i16 @gsm_abs(i16 signext %a) #0 { 7 | %1 = sext i16 %a to i32 8 | %2 = icmp slt i16 %a, 0 9 | br i1 %2, label %3, label %6 10 | 11 | ;