comparison nworker.rhope @ 91:bcdc326b3d6e

Added basic support for list literals in compiler. Updated todo list.
author Mike Pavone <pavone@retrodev.com>
date Sat, 31 Jul 2010 17:17:23 -0400
parents 5a195ee08eac
children e73a93fb5de1
comparison
equal deleted inserted replaced
90:c25d75c2440b 91:bcdc326b3d6e
630 { 630 {
631 no deps <- [worker]No Dependencies 631 no deps <- [worker]No Dependencies
632 out <- [worker]_Dependency Groups[no deps, no deps, [()]Append[no deps]] 632 out <- [worker]_Dependency Groups[no deps, no deps, [()]Append[no deps]]
633 } 633 }
634 634
635 Const Name[val,node index,worker name:out]
636 {
637 If[[Type Of[val]] = ["Type Instance"]]
638 {
639 //TODO: Support parametric types
640 datstring <- [val]Name >>
641 }{
642 If[[Type Of[val]] = ["Machine Integer"]]
643 {
644 If[[val]Signed? >>]
645 { s <- "i" }
646 { s <- "u" }
647 datstring <- [[[val]Value >>]Append[s]]Append[[val]Size >>]
648 }{
649 If[[Type Of[val]] = ["Worker Literal"]]
650 {
651 If[[[[val]Args >>]Length] > [0]]
652 {
653 datstring <- [[["Arg "]Append[node index]]Append[" "]]Append[worker name]
654 }{
655 datstring <- [val]Name >>
656 }
657 }{
658 If[[Type Of[val]] = ["List"]]
659 {
660 If[[[val]Length] > [0]]
661 {
662 datstring <- [[["Arg "]Append[node index]]Append[" "]]Append[worker name]
663 }{
664 datstring <- "Empty"
665 }
666 }{
667 datstring <- val
668 }
669 }
670 }
671 }
672 out <- [[Type Of[val]]Append["_"]]Append[datstring]
673 }
674
635 Format Input@NWorker[worker,noderef:out] 675 Format Input@NWorker[worker,noderef:out]
636 { 676 {
637 node <- [[worker]Nodes >>]Index[[noderef]Index >>] 677 node <- [[worker]Nodes >>]Index[[noderef]Index >>]
638 678
639 [("call","getfield","setfield")]Find[[node]Type >>] 679 [("call","getfield","setfield")]Find[[node]Type >>]
656 { 696 {
657 [conditions]For Backend 697 [conditions]For Backend
658 { 698 {
659 out <- AddRef[ [[["__result_"]Append[[noderef]Index >>]]Append["_"]]Append[[noderef]IO Num >>] ] 699 out <- AddRef[ [[["__result_"]Append[[noderef]Index >>]]Append["_"]]Append[[noderef]IO Num >>] ]
660 }{ 700 }{
661 If[[Type Of[[node]Data >>]] = ["Type Instance"]] 701 out <- Constant[Const Name[[node]Data >>, [noderef]Index >>, [worker]Name >>]]
662 {
663 //TODO: Support parametric types
664 datstring <- [[node]Data >>]Name >>
665 }{
666 If[[Type Of[[node]Data >>]] = ["Machine Integer"]]
667 {
668 If[[[node]Data >>]Signed? >>]
669 { s <- "i" }
670 { s <- "u" }
671 datstring <- [[[[node]Data >>]Value >>]Append[s]]Append[[[node]Data >>]Size >>]
672 }{
673 If[[Type Of[[node]Data >>]] = ["Worker Literal"]]
674 {
675 If[[[[[node]Data >>]Args >>]Length] > [0]]
676 {
677 datstring <- [[["Arg "]Append[[noderef]Index >>]]Append[" "]]Append[[worker]Name >>]
678 }{
679 datstring <- [[node]Data >>]Name >>
680 }
681 }{
682 datstring <- [node]Data >>
683 }
684 }
685 }
686 out <- Constant[[[Type Of[[node]Data >>]]Append["_"]]Append[datstring]]
687 } 702 }
688 } 703 }
689 } 704 }
690 } 705 }
691 } 706 }
835 } 850 }
836 nstream <- [stream]Move[[inputs]Index[0], [[worker]Outputs >>]Index[ [node]Data >> ] ] 851 nstream <- [stream]Move[[inputs]Index[0], [[worker]Outputs >>]Index[ [node]Data >> ] ]
837 }{ 852 }{
838 If[[[node]Type >>] = ["const"]] 853 If[[[node]Type >>] = ["const"]]
839 { 854 {
840 //TODO: Handle list constants 855 constname <- Const Name[[node]Data >>, node index, [worker]Name >>]
841 If[[Type Of[[node]Data >>]] = ["Type Instance"]]
842 {
843 //TODO: Support parametric types
844 datstring <- [[node]Data >>]Name >>
845 }{
846 If[[Type Of[[node]Data >>]] = ["Machine Integer"]]
847 {
848 If[[[node]Data >>]Signed? >>]
849 { s <- "i" }
850 { s <- "u" }
851 datstring <- [[[[node]Data >>]Value >>]Append[s]]Append[[[node]Data >>]Size >>]
852 }{
853 If[[Type Of[[node]Data >>]] = ["Worker Literal"]]
854 {
855 If[[[[[node]Data >>]Args >>]Length] > [0]]
856 {
857 datstring <- [[["Arg "]Append[node index]]Append[" "]]Append[[worker]Name >>]
858 }{
859 datstring <- [[node]Data >>]Name >>
860 }
861 }{
862 datstring <- [node]Data >>
863 }
864 }
865 }
866 constname <- [[Type Of[[node]Data >>]]Append["_"]]Append[datstring]
867 withconst <- [func]Register Constant[constname, [node]Data >>] 856 withconst <- [func]Register Constant[constname, [node]Data >>]
868 [conditions]For Backend 857 [conditions]For Backend
869 { 858 {
870 stream <- [[withconst]Instruction Stream 859 stream <- [[withconst]Instruction Stream
871 ]Move[Constant[constname], [[["__result_"]Append[node index]]Append["_"]]Append[0]] 860 ]Move[Constant[constname], [[["__result_"]Append[node index]]Append["_"]]Append[0]]