(define (load-displaced-address target base offset scale)
(standard-unary target base
(lambda (target base)
- (add-immediate target base (* offset scale)))))
+ (add-immediate target base (* offset scale) general-temporary!))))
(define (load-indexed-address target base offset scale)
(standard-binary target base offset
(MOVK X ,target (LSL (&U ,(chunk16 32)) 32))
(MOVK X ,target (LSL (&U ,(chunk16 48)) 48))))))
\f
-(define (add-immediate target source imm)
+(define (add-immediate target source imm get-temporary)
(define (add addend) (LAP (ADD X ,target ,source ,addend)))
(define (sub addend) (LAP (SUB X ,target ,source ,addend)))
- (immediate-addition imm add sub))
+ (immediate-addition imm add sub get-temporary))
-(define (add-immediate-with-flags target source imm)
+(define (add-immediate-with-flags target source imm get-temporary)
(define (adds addend) (LAP (ADDS X ,target ,source ,addend)))
(define (subs addend) (LAP (SUBS X ,target ,source ,addend)))
- (immediate-addition imm adds subs))
+ (immediate-addition imm adds subs get-temporary))
-(define (cmp-immediate source imm)
+(define (cmp-immediate source imm get-temporary)
;; Same as above but with zero destination.
(define (cmp operand) (LAP (CMP X ,source ,operand)))
(define (cmn operand) (LAP (CMN X ,source ,operand)))
- (immediate-addition imm cmp cmn))
+ (immediate-addition imm cmp cmn get-temporary))
-(define (immediate-addition imm add sub)
+(define (immediate-addition imm add sub get-temporary)
;; XXX Use INST-EA instead of quasiquote? Dunno...
(cond ((fits-in-unsigned-12? imm)
(add `(&U ,imm)))
(zero-test! register)
(begin
(set-equal-branches!)
- (cmp-immediate register immediate))))
+ (cmp-immediate register immediate general-temporary!))))
(define (set-always-branches!)
(set-current-branches!
(STR X ,target ,Free)
,@(register->register-transfer Free target)
,@(add-immediate Free Free
- (* address-units-per-object (+ 1 size))))))
+ (* address-units-per-object (+ 1 size))
+ general-temporary!))))
((1)
(let ((entry (vector-ref entries 0)))
(generate/cons-closure target
;; the next object. We do this because we need to set the
;; last component here, but we do not have negative load/store
;; offsets without pre/post-increment.
- ,@(add-immediate Free Free (* 8 size))
+ ,@(add-immediate Free Free (* 8 size) general-temporary!)
;; Set the last component to be the relocation reference point.
,@(affix-type temp type-code:compiled-entry target general-temporary!)
(STR X ,temp (POST+ ,Free (& 8))))))
;; the next object. We do this because we need to set the
;; last component here, but we do not have negative load/store
;; offsets without pre/post-increment.
- ,@(add-immediate Free Free (* 8 size))
+ ,@(add-immediate Free Free (* 8 size) general-temporary!)
;; Set the last component to be the relocation reference point.
,@(affix-type temp type-code:compiled-entry target general-temporary!)
(STR X ,temp (POST+ ,Free (& 8))))))
;; Set this block's environment.
(STR X ,temp (+ ,arg2 (&U (* 8 ,environment-index))))
;; arg3 := constants address
- ,@(add-immediate arg3 arg2 free-ref-offset)
+ ,@(add-immediate arg3 arg2 free-ref-offset (lambda () temp))
;; arg4 := n sections
,@(load-unsigned-immediate arg4 n-sections)
,@(invoke-interface/call code:compiler-link continuation-label)
(define (fixnum-add-constant target source n overflow?)
(let ((imm (* fixnum-1 n)))
(cond ((not overflow?)
- (add-immediate target source imm))
+ (add-immediate target source imm general-temporary!))
((zero? n)
(set-never-branches!)
(register->register-transfer source target))
(else
(set-overflow-branches!)
- (add-immediate-with-flags target source imm)))))
+ (add-immediate-with-flags target source imm general-temporary!)))))
(define (load-fixnum-constant target n)
(load-signed-immediate target (* n fixnum-1)))