src/codegen-{proto,impl}.lisp: Protocol for emitting custom declarations.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 30 Aug 2015 09:58:38 +0000 (10:58 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 30 Aug 2015 17:11:38 +0000 (18:11 +0100)
src/codegen-impl.lisp
src/codegen-proto.lisp

index e99a0c2..acb0da1 100644 (file)
 (defmethod emit-insts ((codegen basic-codegen) insts)
   (asetf (codegen-insts codegen) (revappend insts it)))
 
+(defmethod emit-decl ((codegen basic-codegen) inst)
+  (push inst (codegen-vars codegen)))
+
+(defmethod emit-decls ((codegen basic-codegen) insts)
+  (asetf (codegen-vars codegen) (revappend insts it)))
+
 (defmethod ensure-var ((codegen basic-codegen) name type &optional init)
   (let* ((vars (codegen-vars codegen))
         (var (find name
index 743c89f..f6cd4bd 100644 (file)
   (:method (codegen insts)
     (dolist (inst insts) (emit-inst codegen inst))))
 
+(export '(emit-decl emit-decls))
+(defgeneric emit-decl (codegen inst)
+  (:documentation
+   "Add INST to the end of CODEGEN's list of declarations."))
+(defgeneric emit-decls (codegen insts)
+  (:documentation
+   "Add a list of INSTS to the end of CODEGEN's list of declarations."))
+
 (export 'codegen-push)
 (defgeneric codegen-push (codegen)
   (:documentation