From 330bd01053704f57a8a56667c2b76568726aa329 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Sun, 5 Feb 2012 15:46:25 -0700 Subject: [PATCH] svm: Added compiler temporaries, for now, with warnings. --- src/compiler/machines/svm/lapgen.scm | 33 +++++++++++++-------------- src/compiler/machines/svm/machine.scm | 4 +++- src/microcode/cmpintmd/svm1.h | 4 +++- src/microcode/svm1-interp.c | 4 ++++ 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/compiler/machines/svm/lapgen.scm b/src/compiler/machines/svm/lapgen.scm index 7f532932f..24ce0ddbf 100644 --- a/src/compiler/machines/svm/lapgen.scm +++ b/src/compiler/machines/svm/lapgen.scm @@ -61,27 +61,26 @@ USA. (error:bad-range-argument source #f)))) (define (home->register-transfer source target) - ;; Not sure why this started happening after 9.1.1 during the - ;; compilation of runtime/poplat.scm... - (warn "Ignoring unspill:" source "->" target) - (LAP)) + (warn "Unspilled:" source "->" target) + (LAP ,@(inst:load (register-type source) + (register-reference target) + (home source)))) (define (register->home-transfer source target) - ;; Not sure why this started happening after 9.1.1 during the - ;; compilation of runtime/poplat.scm... - (warn "Ignoring spill:" source "->" target) - (LAP)) + (warn "Spilled:" source "->" target) + (LAP ,@(inst:store (register-type target) + (register-reference source) + (home target)))) (define (pseudo-register-home register) - ;; With 256 registers, pseudo registers should not need "homes". - ;; Before 9.1.1 this was true. Lately runtime/poplat.scm gets the - ;; no-reuse-possible optimization in standard-register-reference, - ;; which assumes a home. - - ;; That optimization in standard-register-reference is the only use - ;; of pseudo-register-home in the machine-independent compiler, so - ;; this definition just aims to defeat it for now. - (reference-alias-register! register (register-type register))) + (warn "Needed home:" register) + (home register)) + +(define-integrable (home register) + (ea:offset rref:interpreter-register-block + (+ number-of-fixed-interpreter-registers + (* words-per-compiler-temporary (register-renumber register))) + 'WORD)) ;;;; Linearizer interface diff --git a/src/compiler/machines/svm/machine.scm b/src/compiler/machines/svm/machine.scm index d8194a78e..b341b66b1 100644 --- a/src/compiler/machines/svm/machine.scm +++ b/src/compiler/machines/svm/machine.scm @@ -280,7 +280,9 @@ USA. ;;;; Machine registers, register references. (define-integrable number-of-machine-registers 512) -(define-integrable number-of-temporary-registers 512) +(define-integrable number-of-temporary-registers 256) +(define-integrable number-of-fixed-interpreter-registers 14) +(define-integrable words-per-compiler-temporary 2) (define register-reference (let ((references (make-vector number-of-machine-registers))) diff --git a/src/microcode/cmpintmd/svm1.h b/src/microcode/cmpintmd/svm1.h index 5c77d3e43..332e754a2 100644 --- a/src/microcode/cmpintmd/svm1.h +++ b/src/microcode/cmpintmd/svm1.h @@ -31,7 +31,9 @@ USA. #define ASM_RESET_HOOK initialize_svm1 -#define COMPILER_REGBLOCK_N_FIXED 512 +#define COMPILER_REGBLOCK_N_TEMPS 256 +#define COMPILER_TEMP_SIZE ((sizeof (double)) / (sizeof (SCHEME_OBJECT))) +#define COMPILER_REGBLOCK_N_FIXED REGBLOCK_MINIMUM_LENGTH typedef byte_t insn_t; diff --git a/src/microcode/svm1-interp.c b/src/microcode/svm1-interp.c index 28a1cf7cb..4b25452f1 100644 --- a/src/microcode/svm1-interp.c +++ b/src/microcode/svm1-interp.c @@ -180,6 +180,10 @@ initialize_svm1 (void) for (i = 0; (i < N_FLOAT_REGISTERS); i += 1) FREG_SET (i, 0.0); WREG_SET (SVM1_REG_INTERPRETER_REGISTER_BLOCK, ((word_t)Registers)); + + /* These are hard-coded into compiler/machines/svm/machine.scm. */ + assert (COMPILER_TEMP_SIZE == 2); + assert (COMPILER_REGBLOCK_N_FIXED == 14); } #define IMPORT_REGS() do \ -- 2.25.1