File tree Expand file tree Collapse file tree 9 files changed +0
-81
lines changed
Expand file tree Collapse file tree 9 files changed +0
-81
lines changed Original file line number Diff line number Diff line change 4242
4343(ast :define-children base-foreign-call-ast argument-asts)
4444
45- ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
46- ; ;;
47- ; ;; Class MULTIPLE-VALUE-FOREIGN-CALL-AST
48- ; ;;
49- ; ;; This AST is used to represent a call to an intrinsic function inserted into the generated code.
50-
51- (defclass multiple-value-foreign-call-ast (base-foreign-call-ast)
52- ((%function-name :initarg :function-name :accessor function-name)))
53-
54- (cleavir-io :define-save-info multiple-value-foreign-call-ast
55- (:function-name function-name))
56-
57- (defmethod cleavir-ast-graphviz ::label ((ast multiple-value-foreign-call-ast))
58- (with-output-to-string (s)
59- (format s " multiple-value-foreign-call (~a )" (function-name ast))))
60-
6145; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6246; ;;
6347; ;; Class foreign-call-pointer-AST
Original file line number Diff line number Diff line change 11(in-package # :cc-bir)
22
3- (defclass mv-foreign-call (bir :one-output bir :instruction)
4- ((%function-name :initarg :function-name :reader function-name)))
5-
6- (defmethod ast-to-bir :compile-ast
7- ((ast cc-ast :multiple-value-foreign-call-ast) inserter system)
8- (ast-to-bir :with-compiled-arguments (args (cc-ast :argument-asts ast)
9- inserter system)
10- (let ((output (make-instance ' bir:output)))
11- (build :insert inserter ' mv-foreign-call
12- :function-name (cc-ast :function-name ast)
13- :inputs args :outputs (list output))
14- (list output))))
15-
163(defclass foreign-call-pointer (bir :one-output bir :instruction)
174 ((%foreign-types :initarg :foreign-types :accessor foreign-types)))
185
Original file line number Diff line number Diff line change 238238 env system)
239239 :origin origin :policy policy))))))))
240240
241- ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
242- ; ;;
243- ; ;; Converting CORE:multiple-value-foreign-CALL
244- ; ;;
245- ; ;; This is converted into an intrinsic call
246- ; ;;
247-
248- (defmethod cst-to-ast :convert-special
249- ((symbol (eql ' core:multiple-value-foreign-call)) cst environment
250- (system clasp-cleavir :clasp))
251- (assert (stringp (cst :raw (cst :second cst))))
252- (make-instance ' clasp-cleavir-ast:multiple-value-foreign-call-ast
253- :function-name (cst :raw (cst :second cst))
254- :argument-asts (cst-to-ast ::convert-sequence (cst :rest (cst :rest cst)) environment system)
255- :origin cst))
256-
257241; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
258242; ;;
259243; ;; Converting CORE:foreign-call-pointer
Original file line number Diff line number Diff line change @@ -170,22 +170,6 @@ And convert everything to JIT constants."
170170 cmp ::*current-unwind-landing-pad-dest*
171171 label)))
172172
173- (defun unsafe-multiple-value-foreign-call (intrinsic-name args abi
174- &key (label " " ))
175- (declare (ignore abi))
176- (let* ((func (or (llvm-sys :get-function cmp :*the-module* intrinsic-name)
177- (let ((arg-types (make-list (length args) :initial-element cmp :%t*%))
178- (varargs nil ))
179- (cmp :irc-function-create
180- (llvm-sys :function-type-get cmp :%return-type% arg-types varargs)
181- ' llvm-sys::external-linkage
182- intrinsic-name
183- cmp :*the-module* ))))
184- (function-type (llvm-sys :get-function-type func)))
185- (cmp ::irc-call-or-invoke function-type func args
186- cmp ::*current-unwind-landing-pad-dest*
187- label)))
188-
189173(defun unsafe-foreign-call (call-or-invoke foreign-types foreign-name args abi &key (label " " ))
190174 (declare (ignore call-or-invoke abi label))
191175 ; ; Write excess arguments into the multiple-value array
Original file line number Diff line number Diff line change 2424 # :*debug-cleavir*
2525 # :*debug-cleavir-literals*
2626 #+ stealth-gids :instruction-gid
27- # :unsafe-multiple-value-foreign-call
2827 # :unsafe-foreign-call
2928 # :unsafe-foreign-call-pointer
3029 # :datum-gid
4645 (:local-nicknames (# :ast # :cleavir-ast))
4746 (:use # :common-lisp)
4847 (:export
49- # :multiple-value-foreign-call-ast
5048 # :foreign-call-ast
5149 # :foreign-call-pointer-ast
5250 # :argument-asts
53- # :function-name
5451 # :foreign-types
5552 # :make-throw-ast
5653 # :throw-ast
6764 (# :build # :cleavir-bir-builder))
6865 (:export # :header-stamp-case
6966 # :foreign-call-pointer # :foreign-types
70- # :mv-foreign-call # :function-name
7167 # :atomic # :order))
7268
7369(defpackage #:cc-bir-to-bmir
Original file line number Diff line number Diff line change 112112 ' (:vaslist ))
113113(defmethod %definition-rtype ((inst cc-vaslist :butlast) (datum bir :datum))
114114 ' (:vaslist ))
115- (defmethod %definition-rtype ((inst cc-bir :mv-foreign-call) (datum bir :datum))
116- :multiple-values )
117115(defmethod %definition-rtype ((inst bir :thei) (datum bir :datum))
118116 ; ; THEI really throws a wrench in some stuff.
119117 (definition-rtype (bir :input inst)))
709707 (maybe-cast-before instruction args target))
710708 (t (insert-mtf-before instruction args target))))
711709 (cast-local-call-output instruction))
712- (defmethod insert-casts ((instruction cc-bir :mv-foreign-call))
713- (object-inputs instruction)
714- (cast-output instruction :multiple-values ))
715710(defmethod insert-casts ((instruction bir :values-save))
716711 (let* ((input (bir :input instruction)) (output (bir :output instruction))
717712 (inputrt (cc-bmir :rtype input)) (outputrt (cc-bmir :rtype output)))
Original file line number Diff line number Diff line change 1010 # :multiple-value-funcall
1111 # :multiple-value-prog1-function
1212 # :debug-message
13- # :multiple-value-foreign-call
1413 # :foreign-call
1514 # :foreign-call-pointer
1615 # :catch-function
Original file line number Diff line number Diff line change 185185 ; ; with macros.
186186 ((member name ' (catch throw progv)) nil )
187187 ((special-operator-p name) t )
188- ((eq name ' core:multiple-value-foreign-call) t ) ; ; Call intrinsic functions
189188 ((eq name ' core:foreign-call-pointer) t ) ; ; Call function pointers
190189 ((eq name ' core::primop) t )
191190 ((eq (symbol-package name) (find-package :cleavir-primop )) t )
Original file line number Diff line number Diff line change 10761076 (closure-call-or-invoke fun rargs :label label)
10771077 output)))
10781078
1079- (defmethod translate-simple-instruction ((instruction cc-bir :mv-foreign-call)
1080- abi)
1081- (let ((output (bir :output instruction)))
1082- (out (unsafe-multiple-value-foreign-call
1083- (cc-bir :function-name instruction)
1084- (mapcar #' in (bir :inputs instruction)) abi
1085- :label (datum-name-as-string output))
1086- output)))
1087-
10881079(defmethod translate-simple-instruction
10891080 ((instruction cc-bir :foreign-call-pointer) abi)
10901081 (let ((inputs (bir :inputs instruction)))
You can’t perform that action at this time.
0 commit comments