diff --git a/basis/cpu/x86/assembler/operands/operands.factor b/basis/cpu/x86/assembler/operands/operands.factor index 733c57689b..b931fcfd87 100644 --- a/basis/cpu/x86/assembler/operands/operands.factor +++ b/basis/cpu/x86/assembler/operands/operands.factor @@ -1,6 +1,7 @@ ! Copyright (C) 2008, 2009 Slava Pestov, Joe Groff. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel words math accessors sequences cpu.x86.assembler.syntax ; +USING: kernel words math accessors sequences namespaces +assocs layouts cpu.x86.assembler.syntax ; IN: cpu.x86.assembler.operands ! In 32-bit mode, { 1234 } is absolute indirect addressing. @@ -101,16 +102,12 @@ TUPLE: byte value ; C: byte - - : 8-bit-version-of ( register -- register' ) 8 n-bit-version-of ; : 16-bit-version-of ( register -- register' ) 16 n-bit-version-of ; : 32-bit-version-of ( register -- register' ) 32 n-bit-version-of ; diff --git a/basis/cpu/x86/x86.factor b/basis/cpu/x86/x86.factor index 337232c259..5dc3ef2e0a 100644 --- a/basis/cpu/x86/x86.factor +++ b/basis/cpu/x86/x86.factor @@ -264,18 +264,13 @@ M:: x86 %box-alien ( dst src temp -- ) "end" resolve-label ] with-scope ; -HOOK: small-regs cpu ( -- regs ) +HOOK: small-reg? cpu ( reg -- regs ) -M: x86.32 small-regs { EAX ECX EDX EBX } ; -M: x86.64 small-regs { RAX RCX RDX RBX } ; - -HOOK: small-reg-native cpu ( reg -- reg' ) - -M: x86.32 small-reg-native small-reg-4 ; -M: x86.64 small-reg-native small-reg-8 ; +M: x86.32 small-reg? { EAX ECX EDX EBX } memq? ; +M: x86.64 small-reg? drop t ; : small-reg-that-isn't ( exclude -- reg' ) - small-regs swap [ native-version-of ] map '[ _ memq? not ] find nip ; + [ native-version-of ] map [ small-reg? not ] find nip ; : with-save/restore ( reg quot -- ) [ drop PUSH ] [ call ] [ drop POP ] 2tri ; inline @@ -285,7 +280,7 @@ M: x86.64 small-reg-native small-reg-8 ; #! call the quot with that. Otherwise, we find a small #! register that is not in exclude, and call quot, saving #! and restoring the small register. - dst small-regs memq? [ dst quot call ] [ + dst small-reg? [ dst quot call ] [ exclude small-reg-that-isn't [ quot call ] with-save/restore ] if ; inline