Eliminate purely null vl-forstmts.
(vl-forstmt-rewrite x body warnings) → (mv warnings stmt)
The basic rewrite this performs is:
for(initlhs = initrhs; test; nextlhs = nextrhs) [null] ; --> [null];
We could eventually unroll things. This rewrite is generally meant to allow
us to ignore for loops with
Function:
(defun vl-forstmt-rewrite (x body warnings) (declare (xargs :guard (and (vl-stmt-p x) (vl-stmt-p body) (vl-warninglist-p warnings)))) (declare (xargs :guard (eq (vl-stmt-kind x) :vl-forstmt))) (let ((__function__ 'vl-forstmt-rewrite)) (declare (ignorable __function__)) (if (vl-nullstmt-p body) (mv warnings body) (mv warnings (change-vl-forstmt x :body body)))))
Theorem:
(defthm vl-warninglist-p-of-vl-forstmt-rewrite.warnings (implies (and (force (vl-stmt-p x)) (force (vl-stmt-p body)) (force (vl-warninglist-p warnings)) (force (eq (vl-stmt-kind$inline x) ':vl-forstmt))) (b* (((mv ?warnings ?stmt) (vl-forstmt-rewrite x body warnings))) (vl-warninglist-p warnings))) :rule-classes :rewrite)
Theorem:
(defthm vl-stmt-p-of-vl-forstmt-rewrite.stmt (implies (and (force (vl-stmt-p x)) (force (vl-stmt-p body)) (force (vl-warninglist-p warnings)) (force (eq (vl-stmt-kind$inline x) ':vl-forstmt))) (b* (((mv ?warnings ?stmt) (vl-forstmt-rewrite x body warnings))) (vl-stmt-p stmt))) :rule-classes :rewrite)