Skip to content
Snippets Groups Projects
Commit 4813e528 authored by wlott's avatar wlott
Browse files

Wrote ERROR-CALL and GENERATE-ERROR-CODE macros.

parent 83eb549e
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
;;; Scott Fahlman (FAHLMAN@CMUC). ;;; Scott Fahlman (FAHLMAN@CMUC).
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/mips/macros.lisp,v 1.2 1990/02/03 19:33:02 wlott Exp $
;;;
;;; This file contains various useful macros for generating MIPS code. ;;; This file contains various useful macros for generating MIPS code.
;;; ;;;
;;; Written by William Lott. ;;; Written by William Lott.
...@@ -16,7 +18,6 @@ ...@@ -16,7 +18,6 @@
(defmacro nop () (defmacro nop ()
"Emit a nop." "Emit a nop."
'(inst or zero-tn zero-tn zero-tn)) '(inst or zero-tn zero-tn zero-tn))
...@@ -81,3 +82,31 @@ ...@@ -81,3 +82,31 @@
(sc-case ,n-stack (sc-case ,n-stack
((control-stack number-stack string-char-stack sap-stack) ((control-stack number-stack string-char-stack sap-stack)
(storew ,n-reg cont-tn (tn-offset ,n-stack)))))))) (storew ,n-reg cont-tn (tn-offset ,n-stack))))))))
;;; Error stuff.
;;;
(defmacro error-call (error-code &rest values)
(once-only ((n-error-code error-code))
`(progn
,@(collect ((args))
(do ((vals values (cdr vals))
(regs register-argument-tns (cdr regs)))
((or (null vals) (null regs))
(if (null vals)
(args)
(error "Can't use ERROR-CALL with ~D values"
(length values))))
(args `(move ,(car regs) ,(car vals)))))
(inst break ,error-code))))
(defmacro generate-error-code (node error-code &rest values)
"Generate-Error-Code Node Error-code Value*
Emit code for an error with the specified Error-Code and context Values.
Node is used for source context."
`(unassemble
(assemble-elsewhere ,node
(let ((start-lab (gen-label)))
(emit-label start-lab)
(error-call ,error-code ,@values)
start-lab))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment