1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-16 11:01:11 -07:00

block list in limple

This commit is contained in:
Andrea Corallo 2019-07-08 17:04:33 +02:00 committed by Andrea Corallo
parent c51b7fe2c8
commit a59ef0747f
2 changed files with 22 additions and 7 deletions

View 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

View 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");