summaryrefslogtreecommitdiff
path: root/gcc/testsuite/melt/tgcissue-pv-1m.melt
blob: 2314feeeb1caef985bdf31fbbe759632f235df8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
;; -*- lisp -*-
;; bug reported by Pierre Vittet 
;;   http://gcc.gnu.org/ml/gcc/2011-03/msg00206.html
;; the trivial MELT pass


;; transtate first this file with
#|
   ./cc1 -fmelt-module-path=melt-modules -fmelt-source-path=melt-sources \
        -O2 -c -fmelt-mode=translatetomodule \
        -fmelt-arg=$GCCMELT_SOURCE/gcc/testsuite/melt/tgcissue-pv-1m.melt 
|#
;; then run the tgcissue-pv-1c.c test file

;;; trivial gate function
(defun tgissue_gate (pass)
  (debug_msg pass "tgissue_gate pass")
  (return :true))

;; trivial exec function
(defun tgissue_exec (pass)
  (debug_msg pass "tgissue_exec pass")
  (return :true)
  )

(defun tgissue_docmd (cmd moduldata)
  (let ( (tgissue_pass
	  (instance class_gcc_gimple_pass
		    :named_name '"tgissue_pass"
		    :gccpass_gate tgissue_gate
		    :gccpass_exec tgissue_exec
		    ))
	 )
    (debug_msg tgissue_pass "tgissue_docmd tgissue_pass")
    (install_melt_gcc_pass tgissue_pass "after" "phiopt" 0)
    (return tgissue_pass)
    ))


;; we would like to call directly (tgissue_docmd) but for strange reasons it is called but the pass does not happen.
;; so we have to install a mode
(definstance tgissue_mod
    class_melt_mode
    :named_name '"tgcissue"
    :meltmode_help '"tgissue test"
    :meltmode_fun tgissue_docmd
)
(install_melt_mode tgissue_mod)
;;; eof tgissue-pv-1m.melt