aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Corallo2019-07-08 17:04:33 +0200
committerAndrea Corallo2020-01-01 11:33:51 +0100
commita59ef0747f855fb30d66ff98c739965fafdfe0c7 (patch)
treec1d5096420fb40bcfe3b9e97701a1cd10efd1fc6
parentc51b7fe2c881335c9958f75d205859d434cc6de4 (diff)
downloademacs-a59ef0747f855fb30d66ff98c739965fafdfe0c7.tar.gz
emacs-a59ef0747f855fb30d66ff98c739965fafdfe0c7.zip
block list in limple
-rw-r--r--lisp/emacs-lisp/comp.el22
-rw-r--r--src/comp.c7
2 files changed, 22 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 963c22dc590..17de79bc470 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -72,6 +72,8 @@ To be used when ncall-conv is nil.")
72 :documentation "Current intermediate rappresentation") 72 :documentation "Current intermediate rappresentation")
73 (args nil :type 'comp-args) 73 (args nil :type 'comp-args)
74 (frame-size nil :type 'number) 74 (frame-size nil :type 'number)
75 (blocks () :type list
76 :documentation "List of basic block")
75 (limple-cnt -1 :type 'number 77 (limple-cnt -1 :type 'number
76 :documentation "Counter to create ssa limple vars")) 78 :documentation "Counter to create ssa limple vars"))
77 79
@@ -198,10 +200,16 @@ To be used when ncall-conv is nil.")
198 "Push VAL into frame. 200 "Push VAL into frame.
199VAL is known at compile time." 201VAL is known at compile time."
200 (cl-incf (comp-sp)) 202 (cl-incf (comp-sp))
201 (setf (comp-slot) (make-comp-mvar :slot (comp-sp) 203 (let ((const (make-comp-mvar :slot (comp-sp)
202 :const-vld t 204 :const-vld t
203 :constant val)) 205 :constant val)))
204 (push (list '=const (comp-slot) val) comp-limple)) 206 (setf (comp-slot) const)
207 (push (list '=const (comp-slot) const) comp-limple)))
208
209(defun comp-push_block (bblock)
210 "Push basic block BBLOCK."
211 (push bblock (comp-func-blocks comp-func))
212 (push `(block ,bblock) comp-limple))
205 213
206(defun comp-pop (n) 214(defun comp-pop (n)
207 "Pop N elements from the meta-stack." 215 "Pop N elements from the meta-stack."
@@ -262,7 +270,7 @@ VAL is known at compile time."
262 (_ (error "Unexpected LAP op %s" (symbol-name op)))))) 270 (_ (error "Unexpected LAP op %s" (symbol-name op))))))
263 271
264(defun comp-limplify (func) 272(defun comp-limplify (func)
265 "Given FUNC and return LIMPLE." 273 "Given FUNC and return compute its LIMPLE ir."
266 (let* ((frame-size (comp-func-frame-size func)) 274 (let* ((frame-size (comp-func-frame-size func))
267 (comp-func func) 275 (comp-func func)
268 (comp-frame (make-comp-limple-frame 276 (comp-frame (make-comp-limple-frame
@@ -273,12 +281,14 @@ VAL is known at compile time."
273 v))) 281 v)))
274 (comp-limple ())) 282 (comp-limple ()))
275 ;; Prologue 283 ;; Prologue
276 (push '(BLOCK prologue) comp-limple) 284 (comp-push_block 'prologue)
277 (cl-loop for i below (comp-args-mandatory (comp-func-args func)) 285 (cl-loop for i below (comp-args-mandatory (comp-func-args func))
278 do (progn 286 do (progn
279 (cl-incf (comp-sp)) 287 (cl-incf (comp-sp))
280 (push `(=par ,(comp-slot) ,i) comp-limple))) 288 (push `(=par ,(comp-slot) ,i) comp-limple)))
281 (push '(BLOCK body) comp-limple) 289 (push '(jump body) comp-limple)
290 ;; Body
291 (comp-push_block 'body)
282 (mapc #'comp-limplify-lap-inst (comp-func-ir func)) 292 (mapc #'comp-limplify-lap-inst (comp-func-ir func))
283 (setf (comp-func-ir func) (reverse comp-limple)) 293 (setf (comp-func-ir func) (reverse comp-limple))
284 (when comp-debug 294 (when comp-debug
diff --git a/src/comp.c b/src/comp.c
index 6f5863b7f7e..ca741fc9f1d 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -935,6 +935,10 @@ emit_limple_inst (Lisp_Object inst)
935 char *block_name = SDATA (SYMBOL_NAME (arg0)); 935 char *block_name = SDATA (SYMBOL_NAME (arg0));
936 comp.block = gcc_jit_function_new_block (comp.func, block_name); 936 comp.block = gcc_jit_function_new_block (comp.func, block_name);
937 } 937 }
938 else if (EQ (op, Qjump))
939 {
940
941 }
938 else if (EQ (op, Qeqcall)) 942 else if (EQ (op, Qeqcall))
939 { 943 {
940 } 944 }
@@ -1881,7 +1885,8 @@ void
1881syms_of_comp (void) 1885syms_of_comp (void)
1882{ 1886{
1883 /* Limple instruction set. */ 1887 /* Limple instruction set. */
1884 DEFSYM (Qblock, "BLOCK"); 1888 DEFSYM (Qblock, "block");
1889 DEFSYM (Qjump, "jump");
1885 DEFSYM (Qeqcall, "=call"); 1890 DEFSYM (Qeqcall, "=call");
1886 DEFSYM (Qeqconst, "=const"); 1891 DEFSYM (Qeqconst, "=const");
1887 DEFSYM (Qreturn, "return"); 1892 DEFSYM (Qreturn, "return");