]> gitweb.factorcode.org Git - factor.git/commitdiff
compiler.cfg: nuke ##bignum>integer and ##integer>bignum since they were unused
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 28 Sep 2009 01:36:05 +0000 (20:36 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 28 Sep 2009 01:36:05 +0000 (20:36 -0500)
basis/compiler/cfg/instructions/instructions.factor
basis/compiler/cfg/intrinsics/fixnum/fixnum.factor
basis/compiler/codegen/codegen.factor
basis/compiler/compiler.factor
basis/compiler/tests/low-level-ir.factor
basis/cpu/architecture/architecture.factor
basis/cpu/ppc/ppc.factor
basis/cpu/x86/x86.factor

index cd84ed39baefa3b26a8ae4b9cf9c3fbf8466d1ba..f06d31b9df285d9480ac14d98e139563bb6c42b9 100644 (file)
@@ -190,17 +190,6 @@ PURE-INSN: ##log2
 def: dst/int-rep
 use: src/int-rep ;
 
-! Bignum/integer conversion
-PURE-INSN: ##integer>bignum
-def: dst/int-rep
-use: src/int-rep
-temp: temp/int-rep ;
-
-PURE-INSN: ##bignum>integer
-def: dst/int-rep
-use: src/int-rep
-temp: temp/int-rep ;
-
 ! Float arithmetic
 PURE-INSN: ##unbox-float
 def: dst/double-rep
@@ -682,8 +671,7 @@ UNION: ##allocation
 ##box-float
 ##box-vector
 ##box-alien
-##box-displaced-alien
-##integer>bignum ;
+##box-displaced-alien ;
 
 ! For alias analysis
 UNION: ##read ##slot ##slot-imm ;
@@ -706,8 +694,6 @@ UNION: kill-vreg-insn
 ! Instructions that have complex expansions and require that the
 ! output registers are not equal to any of the input registers
 UNION: def-is-use-insn
-##integer>bignum
-##bignum>integer
 ##box-alien
 ##box-displaced-alien
 ##string-nth
index 2e2bfd5f099713a217b17f4b86f3fbb041ad81b4..8ead484cf1ac26e9dac7861723c7213f4bfcfcf7 100644 (file)
@@ -57,12 +57,6 @@ IN: compiler.cfg.intrinsics.fixnum
 : emit-fixnum-comparison ( cc -- )
     '[ _ ^^compare ] emit-fixnum-op ;
 
-: emit-bignum>fixnum ( -- )
-    ds-pop ^^bignum>integer ^^tag-fixnum ds-push ;
-
-: emit-fixnum>bignum ( -- )
-    ds-pop ^^untag-fixnum ^^integer>bignum ds-push ;
-
 : emit-no-overflow-case ( dst -- final-bb )
     [ ds-drop ds-drop ds-push ] with-branch ;
 
index 76c47d2ef25e474297ec840e2336a27c3f5c4195..0fd4e63e027f14f12df941d69fbbe9b63fe64e98 100755 (executable)
@@ -144,8 +144,6 @@ CODEGEN: ##max %max
 CODEGEN: ##not %not
 CODEGEN: ##log2 %log2
 CODEGEN: ##copy %copy
-CODEGEN: ##integer>bignum %integer>bignum
-CODEGEN: ##bignum>integer %bignum>integer
 CODEGEN: ##unbox-float %unbox-float
 CODEGEN: ##box-float %box-float
 CODEGEN: ##add-float %add-float
index 504acc74b0997087314173d25e88d3111ca40c34..626ab678c0659cd95bcdbd8fbad682ae8d67448f 100755 (executable)
@@ -44,8 +44,11 @@ SYMBOL: compiled
     dup recompile-callers?
     [ compiled-usage keys [ queue-compile ] each ] [ drop ] if ;
 
+: compiler-message ( string -- )
+    "trace-compilation" get [ global [ print flush ] bind ] [ drop ] if ;
+
 : start ( word -- )
-    "trace-compilation" get [ dup name>> print flush ] when
+    dup name>> compiler-message
     H{ } clone dependencies set
     H{ } clone generic-dependencies set
     clear-compiler-error ;
@@ -194,7 +197,7 @@ M: optimizing-compiler recompile ( words -- alist )
         compile-queue get compile-loop
         compiled get >alist
     ] with-scope
-    "trace-compilation" get [ "--- compile done" print flush ] when ;
+    "--- compile done" compiler-message ;
 
 : with-optimizer ( quot -- )
     [ optimizing-compiler compiler-impl ] dip with-variable ; inline
index 5df04a4d9d2bcafb8872c3a063b6dc39646deeab..0b2da6463660f77b532c9df06484d7b9c8f6671b 100644 (file)
@@ -132,24 +132,3 @@ IN: compiler.tests.low-level-ir
         T{ ##add-imm f 0 0 -8 }
     } compile-test-bb
 ] unit-test
-
-! These are def-is-use-insns
-USE: multiline
-
-/*
-
-[ 100 ] [
-    V{
-        T{ ##load-immediate f 0 100 }
-        T{ ##integer>bignum f 0 0 1 }
-    } compile-test-bb
-] unit-test
-
-[ 1 ] [
-    V{
-        T{ ##load-reference f 0 ALIEN: 8 }
-        T{ ##unbox-any-c-ptr f 0 0 1 }
-    } compile-test-bb
-] unit-test
-
-*/
index 4bd95a38a4754fbe9e9d8b95b5f11126fb4a9214..78525e6d009468f336bb633242b31927da363d7e 100644 (file)
@@ -188,9 +188,6 @@ HOOK: %fixnum-add cpu ( label dst src1 src2 -- )
 HOOK: %fixnum-sub cpu ( label dst src1 src2 -- )
 HOOK: %fixnum-mul cpu ( label dst src1 src2 -- )
 
-HOOK: %integer>bignum cpu ( dst src temp -- )
-HOOK: %bignum>integer cpu ( dst src temp -- )
-
 HOOK: %unbox-float cpu ( dst src -- )
 HOOK: %box-float cpu ( dst src temp -- )
 
index 5c96131466f367a740cc993ee33f27232f100fa7..670a9fd69e98554eed42e32f45b593262a436a6b 100644 (file)
@@ -200,59 +200,6 @@ M: ppc %fixnum-sub ( label dst src1 src2 -- )
 M: ppc %fixnum-mul ( label dst src1 src2 -- )
     [ MULLWO. ] overflow-template ;
 
-: bignum@ ( n -- offset ) cells bignum tag-number - ; inline
-
-M:: ppc %integer>bignum ( dst src temp -- )
-    [
-        "end" define-label
-        dst 0 >bignum %load-reference
-        ! Is it zero? Then just go to the end and return this zero
-        0 src 0 CMPI
-        "end" get BEQ
-        ! Allocate a bignum
-        dst 4 cells bignum temp %allot
-        ! Write length
-        2 tag-fixnum temp LI
-        temp dst 1 bignum@ STW
-        ! Compute sign
-        temp src MR
-        temp temp cell-bits 1 - SRAWI
-        temp temp 1 ANDI
-        ! Store sign
-        temp dst 2 bignum@ STW
-        ! Make negative value positive
-        temp temp temp ADD
-        temp temp NEG
-        temp temp 1 ADDI
-        temp src temp MULLW
-        ! Store the bignum
-        temp dst 3 bignum@ STW
-        "end" resolve-label
-    ] with-scope ;
-
-M:: ppc %bignum>integer ( dst src temp -- )
-    [
-        "end" define-label
-        temp src 1 bignum@ LWZ
-        ! if the length is 1, its just the sign and nothing else,
-        ! so output 0
-        0 dst LI
-        0 temp 1 tag-fixnum CMPI
-        "end" get BEQ
-        ! load the value
-        dst src 3 bignum@ LWZ
-        ! load the sign
-        temp src 2 bignum@ LWZ
-        ! branchless arithmetic: we want to turn 0 into 1,
-        ! and 1 into -1
-        temp temp temp ADD
-        temp temp 1 SUBI
-        temp temp NEG
-        ! multiply value by sign
-        dst dst temp MULLW
-        "end" resolve-label
-    ] with-scope ;
-
 M: ppc %add-float FADD ;
 M: ppc %sub-float FSUB ;
 M: ppc %mul-float FMUL ;
index e78519b9e0f389242bd78640176f700e9768d036..bf2f9f1f983c5b94489148d3e6d54677f8282229 100644 (file)
@@ -156,66 +156,6 @@ M: x86 %fixnum-sub ( label dst src1 src2 -- )
 M: x86 %fixnum-mul ( label dst src1 src2 -- )
     int-rep two-operand swap IMUL2 JO ;
 
-: bignum@ ( reg n -- op )
-    cells bignum tag-number - [+] ; inline
-
-M:: x86 %integer>bignum ( dst src temp -- )
-    #! on entry, inreg is a signed 32-bit quantity
-    #! exits with tagged ptr to bignum in outreg
-    #! 1 cell header, 1 cell length, 1 cell sign, + digits
-    #! length is the # of digits + sign
-    [
-        "end" define-label
-        ! Load cached zero value
-        dst 0 >bignum %load-reference
-        src 0 CMP
-        ! Is it zero? Then just go to the end and return this zero
-        "end" get JE
-        ! Allocate a bignum
-        dst 4 cells bignum temp %allot
-        ! Write length
-        dst 1 bignum@ 2 tag-fixnum MOV
-        ! Store value
-        dst 3 bignum@ src MOV
-        ! Compute sign
-        temp src MOV
-        temp cell-bits 1 - SAR
-        temp 1 AND
-        ! Store sign
-        dst 2 bignum@ temp MOV
-        ! Make negative value positive
-        temp temp ADD
-        temp NEG
-        temp 1 ADD
-        src temp IMUL2
-        ! Store the bignum
-        dst 3 bignum@ temp MOV
-        "end" resolve-label
-    ] with-scope ;
-
-M:: x86 %bignum>integer ( dst src temp -- )
-    [
-        "end" define-label
-        ! load length
-        temp src 1 bignum@ MOV
-        ! if the length is 1, its just the sign and nothing else,
-        ! so output 0
-        dst 0 MOV
-        temp 1 tag-fixnum CMP
-        "end" get JE
-        ! load the value
-        dst src 3 bignum@ MOV
-        ! load the sign
-        temp src 2 bignum@ MOV
-        ! convert it into -1 or 1
-        temp temp ADD
-        temp NEG
-        temp 1 ADD
-        ! make dst signed
-        temp dst IMUL2
-        "end" resolve-label
-    ] with-scope ;
-
 M: x86 %add-float double-rep two-operand ADDSD ;
 M: x86 %sub-float double-rep two-operand SUBSD ;
 M: x86 %mul-float double-rep two-operand MULSD ;