chiark / gitweb /
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 e99a0c2b435838d462603d4903ce68880a250ade..acb0da1a9a3bc2e743ddbb71d6036b7c229b96b9 100644 (file)
@@ -125,6 +125,12 @@ (defmethod emit-inst ((codegen basic-codegen) inst)
 (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 743c89f07a944c5f2e7216224d8680bddba5a53c..f6cd4bdafeccfe72301d921c270b7671d70602fb 100644 (file)
@@ -261,6 +261,14 @@ (defgeneric emit-insts (codegen insts)
   (: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