diff --git a/basis/compiler/cfg/def-use/def-use.factor b/basis/compiler/cfg/def-use/def-use.factor index 825ff71b9b..54cff2ccaa 100644 --- a/basis/compiler/cfg/def-use/def-use.factor +++ b/basis/compiler/cfg/def-use/def-use.factor @@ -11,6 +11,10 @@ GENERIC: defs-vreg ( insn -- vreg/f ) GENERIC: temp-vregs ( insn -- seq ) GENERIC: uses-vregs ( insn -- seq ) +M: insn defs-vreg drop f ; +M: insn temp-vregs drop { } ; +M: insn uses-vregs drop { } ; + M: ##phi uses-vregs inputs>> values ; > values ; } case ; : define-defs-vreg-method ( insn -- ) - [ \ defs-vreg create-method ] - [ insn-def-slot [ name>> reader-word 1quotation ] [ [ drop f ] ] if* ] bi - define ; + dup insn-def-slot dup [ + [ \ defs-vreg create-method ] + [ name>> reader-word 1quotation ] bi* + define + ] [ 2drop ] if ; : define-uses-vregs-method ( insn -- ) - [ \ uses-vregs create-method ] - [ insn-use-slots [ name>> ] map slot-array-quot ] bi - define ; + dup insn-use-slots [ drop ] [ + [ \ uses-vregs create-method ] + [ [ name>> ] map slot-array-quot ] bi* + define + ] if-empty ; : define-temp-vregs-method ( insn -- ) - [ \ temp-vregs create-method ] - [ insn-temp-slots [ name>> ] map slot-array-quot ] bi - define ; + dup insn-temp-slots [ drop ] [ + [ \ temp-vregs create-method ] + [ [ name>> ] map slot-array-quot ] bi* + define + ] if-empty ; PRIVATE> diff --git a/basis/compiler/cfg/renaming/functor/functor.factor b/basis/compiler/cfg/renaming/functor/functor.factor index 2af68e9175..261aab6c54 100644 --- a/basis/compiler/cfg/renaming/functor/functor.factor +++ b/basis/compiler/cfg/renaming/functor/functor.factor @@ -20,15 +20,19 @@ WHERE GENERIC: rename-insn-defs ( insn -- ) -insn-classes get [ +M: insn rename-insn-defs drop ; + +insn-classes get [ insn-def-slot ] filter [ [ \ rename-insn-defs create-method-in ] - [ insn-def-slot dup [ name>> 1array ] when DEF-QUOT slot-change-quot ] bi + [ insn-def-slot name>> 1array DEF-QUOT slot-change-quot ] bi define ] each GENERIC: rename-insn-uses ( insn -- ) -insn-classes get { ##phi } diff [ +M: insn rename-insn-uses drop ; + +insn-classes get { ##phi } diff [ insn-use-slots empty? not ] filter [ [ \ rename-insn-uses create-method-in ] [ insn-use-slots [ name>> ] map USE-QUOT slot-change-quot ] bi define @@ -39,7 +43,9 @@ M: ##phi rename-insn-uses GENERIC: rename-insn-temps ( insn -- ) -insn-classes get [ +M: insn rename-insn-temps drop ; + +insn-classes get [ insn-temp-slots empty? not ] filter [ [ \ rename-insn-temps create-method-in ] [ insn-temp-slots [ name>> ] map TEMP-QUOT slot-change-quot ] bi define diff --git a/basis/compiler/cfg/representations/preferred/preferred.factor b/basis/compiler/cfg/representations/preferred/preferred.factor index 1e07e56b35..726521cfe1 100644 --- a/basis/compiler/cfg/representations/preferred/preferred.factor +++ b/basis/compiler/cfg/representations/preferred/preferred.factor @@ -11,6 +11,10 @@ GENERIC: defs-vreg-rep ( insn -- rep/f ) GENERIC: temp-vreg-reps ( insn -- reps ) GENERIC: uses-vreg-reps ( insn -- reps ) +M: insn defs-vreg-rep drop f ; +M: insn temp-vreg-reps drop { } ; +M: insn uses-vreg-reps drop { } ; + > rep-getter-quot ] [ [ drop f ] ] if* ] - bi define ; + dup insn-def-slot dup [ + [ \ defs-vreg-rep create-method ] + [ rep>> rep-getter-quot ] + bi* define + ] [ 2drop ] if ; : reps-getter-quot ( reps -- quot ) dup [ rep>> { f scalar-rep } member-eq? not ] all? [ @@ -38,14 +44,18 @@ GENERIC: uses-vreg-reps ( insn -- reps ) ] if ; : define-uses-vreg-reps-method ( insn -- ) - [ \ uses-vreg-reps create-method ] - [ insn-use-slots reps-getter-quot ] - bi define ; + dup insn-use-slots [ drop ] [ + [ \ uses-vreg-reps create-method ] + [ reps-getter-quot ] + bi* define + ] if-empty ; : define-temp-vreg-reps-method ( insn -- ) - [ \ temp-vreg-reps create-method ] - [ insn-temp-slots reps-getter-quot ] - bi define ; + dup insn-temp-slots [ drop ] [ + [ \ temp-vreg-reps create-method ] + [ reps-getter-quot ] + bi* define + ] if-empty ; PRIVATE>