]> git.eshelyaron.com Git - emacs.git/commitdiff
block list in limple
authorAndrea Corallo <andrea_corallo@yahoo.it>
Mon, 8 Jul 2019 15:04:33 +0000 (17:04 +0200)
committerAndrea Corallo <akrl@sdf.org>
Wed, 1 Jan 2020 10:33:51 +0000 (11:33 +0100)
lisp/emacs-lisp/comp.el
src/comp.c

index 963c22dc5902d761992552ddb3d4d2146133de21..17de79bc4701b716e6a5196b8154ab07c4526317 100644 (file)
@@ -72,6 +72,8 @@ To be used when ncall-conv is nil.")
       :documentation "Current intermediate rappresentation")
   (args nil :type 'comp-args)
   (frame-size nil :type 'number)
+  (blocks () :type list
+          :documentation "List of basic block")
   (limple-cnt -1 :type 'number
               :documentation "Counter to create ssa limple vars"))
 
@@ -198,10 +200,16 @@ To be used when ncall-conv is nil.")
   "Push VAL into frame.
 VAL is known at compile time."
   (cl-incf (comp-sp))
-  (setf (comp-slot) (make-comp-mvar :slot (comp-sp)
+  (let ((const (make-comp-mvar :slot (comp-sp)
                                     :const-vld t
-                                    :constant val))
-  (push (list '=const (comp-slot) val) comp-limple))
+                                    :constant val)))
+    (setf (comp-slot) const)
+    (push (list '=const (comp-slot) const) comp-limple)))
+
+(defun comp-push_block (bblock)
+  "Push basic block BBLOCK."
+  (push bblock (comp-func-blocks comp-func))
+  (push `(block ,bblock) comp-limple))
 
 (defun comp-pop (n)
   "Pop N elements from the meta-stack."
@@ -262,7 +270,7 @@ VAL is known at compile time."
       (_ (error "Unexpected LAP op %s" (symbol-name op))))))
 
 (defun comp-limplify (func)
-  "Given FUNC and return LIMPLE."
+  "Given FUNC and return compute its LIMPLE ir."
   (let* ((frame-size (comp-func-frame-size func))
          (comp-func func)
          (comp-frame (make-comp-limple-frame
@@ -273,12 +281,14 @@ VAL is known at compile time."
                                v)))
          (comp-limple ()))
     ;; Prologue
-    (push '(BLOCK prologue) comp-limple)
+    (comp-push_block 'prologue)
     (cl-loop for i below (comp-args-mandatory (comp-func-args func))
              do (progn
                   (cl-incf (comp-sp))
                   (push `(=par ,(comp-slot) ,i) comp-limple)))
-    (push '(BLOCK body) comp-limple)
+    (push '(jump body) comp-limple)
+    ;; Body
+    (comp-push_block 'body)
     (mapc #'comp-limplify-lap-inst (comp-func-ir func))
     (setf (comp-func-ir func) (reverse comp-limple))
     (when comp-debug
index 6f5863b7f7e4628e766d4919f33ce5e1c13c1bb2..ca741fc9f1d54d4f95c9926746daa734f2899390 100644 (file)
@@ -935,6 +935,10 @@ emit_limple_inst (Lisp_Object inst)
       char *block_name = SDATA (SYMBOL_NAME (arg0));
       comp.block = gcc_jit_function_new_block (comp.func, block_name);
     }
+  else if (EQ (op, Qjump))
+    {
+
+    }
   else if (EQ (op, Qeqcall))
     {
     }
@@ -1881,7 +1885,8 @@ void
 syms_of_comp (void)
 {
   /* Limple instruction set.  */
-  DEFSYM (Qblock, "BLOCK");
+  DEFSYM (Qblock, "block");
+  DEFSYM (Qjump, "jump");
   DEFSYM (Qeqcall, "=call");
   DEFSYM (Qeqconst, "=const");
   DEFSYM (Qreturn, "return");