Skip to content

Commit

Permalink
Added NON_VOLATILE pragma
Browse files Browse the repository at this point in the history
  • Loading branch information
macrologist committed Apr 12, 2024
1 parent 668b5f5 commit a9952a5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/pragmas.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,19 @@ Expected syntax: PRAGMA REWIRING_SEARCH [\"A*\"|\"GREEDY-QUBIT\"|\"GREEDY-PATH\"
(:display-string
(prin1-to-string (symbol-name swap-search-type))))


(define-pragma "NON_VOLATILE" pragma-non-volatile
(:documentation "PRAGMA indicating that declared memory can be assumed to be non-volatile - it will not be modified outside of the Quil program in which it is declared.
Expected syntax: PRAGMA NON_VOLATILE identifier")
(:global t)
(:slots (memory-name cl-quil::memory-name))
(:words (name string))
(:initialization
(setf memory-name (cl-quil::memory-name name)))
(:display-string
(princ-to-string (cl-quil::memory-name-region-name memory-name))))

(defun parsed-program-has-pragma-p (parsed-program &optional (pragma-type 'pragma))
"Return T if PARSED-PROGRAM's executable code contains any pragma. Optionally use PRAGMA-TYPE to restrict to a particular pragma type."
(some (a:rcurry #'typep pragma-type)
Expand Down

0 comments on commit a9952a5

Please sign in to comment.