]> gitweb.factorcode.org Git - factor-unmaintained.git/blobdiff - cpu/arm/arm.factor
arm: move to cpu.arm.
[factor-unmaintained.git] / cpu / arm / arm.factor
diff --git a/cpu/arm/arm.factor b/cpu/arm/arm.factor
new file mode 100644 (file)
index 0000000..641beee
--- /dev/null
@@ -0,0 +1,56 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types kernel math namespaces
+cpu.architecture cpu.arm.architecture cpu.arm.assembler
+cpu.arm.intrinsics generator generator.registers continuations
+compiler io vocabs sequences system ;
+
+! EABI passes floats in integer registers.
+[ alien-float ]
+[ >r >r >float r> r> set-alien-float ]
+4
+"box_float"
+"to_float" <primitive-type>
+"float" define-primitive-type
+
+[ >float ] "float" c-type set-c-type-prep
+
+[ alien-double ]
+[ >r >r >float r> r> set-alien-double ]
+8
+"box_double"
+"to_double" <primitive-type> <long-long-type>
+"double" define-primitive-type
+
+[ >float ] "double" c-type set-c-type-prep
+
+T{ arm-backend } compiler-backend set-global
+
+! We don't auto-detect since that would require us to support
+! illegal instruction traps. This works on Linux but not on
+! Windows CE.
+
+"arm-variant" get [
+    "ARM variant: " write "arm-variant" get print
+] [
+    "==========" print
+    "You should specify the -arm-variant=<variant> switch." print
+    "<variant> can be one of arm3, arm4, arm4t, or arm5." print
+    "Assuming arm3." print
+    "==========" print
+    "arm3" "arm-variant" set-global
+] if
+
+"arm-variant" get { "arm4" "arm4t" "arm5" } member? [
+    "cpu.arm.4" require
+] when
+
+"arm-variant" get { "arm4t" "arm5" } member? [
+    t have-BX? set-global
+] when
+
+"arm-variant" get "arm5" = [
+    t have-BLX? set-global
+] when
+
+7 cells profiler-prologues set-global