1*181254a7Smrg" Syntax highlighting rules for GIMPLE dump files (for Vim). 2*181254a7Smrg" 3*181254a7Smrg" Copyright (C) 2015 Free Software Foundation, Inc. 4*181254a7Smrg" 5*181254a7Smrg" This script is free software; you can redistribute it and/or modify 6*181254a7Smrg" it under the terms of the GNU General Public License as published by 7*181254a7Smrg" the Free Software Foundation; either version 3, or (at your option) 8*181254a7Smrg" any later version 9*181254a7Smrg" 10*181254a7Smrg" This Vim script highlights syntax in debug dumps containing GIMPLE 11*181254a7Smrg" intermediate representation. Such dumps are produced by GCC when 12*181254a7Smrg" it is invoked with -fdump-tree-* and/or -fdump-ipa-* switches. Tested 13*181254a7Smrg" in Vim 7.4 (but should also work with earlier versions). 14*181254a7Smrg 15*181254a7Smrg 16*181254a7Smrg" Do not continue, if syntax is already enabled in current buffer. 17*181254a7Smrgif exists("b:current_syntax") 18*181254a7Smrg finish 19*181254a7Smrgendif 20*181254a7Smrg 21*181254a7Smrg" If this variable is set to true, "Unknown tree" in -fdump-tree-original will 22*181254a7Smrg" be highlighted as an error. 23*181254a7Smrglet s:unknown_tree_is_error=0 24*181254a7Smrg 25*181254a7Smrg" Comments for Phi nodes, value ranges, use/def-chains, etc. 26*181254a7Smrgsyn match gimpleAnnotation "\v#.*$" 27*181254a7Smrg \ contains=gimpleAnnotationOp, gimpleAnnotationMark, 28*181254a7Smrg \ gimpleNumber, gimpleLineNo 29*181254a7Smrgsyn match gimpleAnnotationMark "#" contained 30*181254a7Smrgsyn keyword gimpleAnnotationOp PHI VUSE VDEF RANGE PT USE CLB 31*181254a7Smrg \ ALIGN MISALIGN NONZERO contained 32*181254a7Smrg 33*181254a7Smrg" General-purpose comments. 34*181254a7Smrgsyn match gimpleComment ";;.*$" 35*181254a7Smrg 36*181254a7Smrg" Types - mostly borrowed from original Vim syntax file for C 37*181254a7Smrgsyn keyword gimpleType int long short char void 38*181254a7Smrg \ signed unsigned float double 39*181254a7Smrg \ size_t ssize_t off_t wchar_t ptrdiff_t sig_atomic_t fpos_t 40*181254a7Smrg \ clock_t time_t va_list jmp_buf FILE DIR div_t ldiv_t 41*181254a7Smrg \ mbstate_t wctrans_t wint_t wctype_t 42*181254a7Smrg \ _Bool bool _Complex complex _Imaginary imaginary 43*181254a7Smrg \ int8_t int16_t int32_t int64_t 44*181254a7Smrg \ uint8_t uint16_t uint32_t uint64_t 45*181254a7Smrg \ int_least8_t int_least16_t int_least32_t int_least64_t 46*181254a7Smrg \ uint_least8_t uint_least16_t uint_least32_t uint_least64_t 47*181254a7Smrg \ int_fast8_t int_fast16_t int_fast32_t int_fast64_t 48*181254a7Smrg \ uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t 49*181254a7Smrg \ intptr_t uintptr_t 50*181254a7Smrg \ intmax_t uintmax_t 51*181254a7Smrg \ __label__ __complex__ __volatile__ 52*181254a7Smrg \ char16_t char32_t sizetype __vtbl_ptr_type 53*181254a7Smrg 54*181254a7Smrg" C/C++-like control structures 55*181254a7Smrgsyn keyword gimpleStatement goto return 56*181254a7Smrgsyn keyword gimpleConditional if else 57*181254a7Smrgsyn keyword gimpleLoop while 58*181254a7Smrgsyn keyword gimpleException try catch finally 59*181254a7Smrg 60*181254a7Smrg" Special 'values' 61*181254a7Smrgsyn match gimpleConstant "{CLOBBER}" 62*181254a7Smrgsyn match gimpleConstant "{ref-all}" 63*181254a7Smrgsyn match gimpleConstant "{v}" 64*181254a7Smrg 65*181254a7Smrg" Blocks 66*181254a7Smrgsyn region gimpleBlock start="{" end="}" transparent fold 67*181254a7Smrg 68*181254a7Smrg" String literals 69*181254a7Smrgsyn region gimpleString start=/\v"/ skip=/\v\\./ end=/\v"/ 70*181254a7Smrg 71*181254a7Smrg" GENERIC AST nodes 72*181254a7Smrgsyn keyword gimpleASTNode BIT_FIELD_REF TARGET_EXPR expr_stmt 73*181254a7Smrg \ NON_LVALUE_EXPR 74*181254a7Smrg \ must_not_throw_expr eh_spec_block eh_filter 75*181254a7Smrg \ eh_must_not_throw aggr_init_expr cleanup_point 76*181254a7Smrg 77*181254a7Smrgif s:unknown_tree_is_error 78*181254a7Smrg syn match gimpleUnknownTree "\vUnknown tree: \w+" 79*181254a7Smrgend 80*181254a7Smrg 81*181254a7Smrg" Ignore probability of edges and basic blocks 82*181254a7Smrg" <bb 2> [70.00%]: 83*181254a7Smrgsyn match gimpleFrequency " \[\d*\.\d*%\]" 84*181254a7Smrg 85*181254a7Smrg" Ignore basic block with a count 86*181254a7Smrg" <bb 10> [local count: 118111601]: 87*181254a7Smrgsyn match gimpleBBCount "\v\[(local )?count: \d+\]" 88*181254a7Smrg 89*181254a7Smrg" Numbers 90*181254a7Smrgsyn match gimpleNumber "\v([^.a-zA-Z0-9_])\zs-?\d+B?" 91*181254a7Smrgsyn match gimpleFloat "\v\W\zs-?\d*\.\d+(e\+\d+)?" 92*181254a7Smrg 93*181254a7Smrg" Basic block label 94*181254a7Smrg" <bb 123>: 95*181254a7Smrgsyn match gimpleLabel "\v^\s*\zs\<bb \d+\>" 96*181254a7Smrg" <D.1234>: 97*181254a7Smrg" <L1>: 98*181254a7Smrgsyn match gimpleLabel "\v^\s*\zs\<[DL]\.?\d+\>" 99*181254a7Smrg" label: - user-defined label 100*181254a7Smrg" bb1L.1: 101*181254a7Smrgsyn match gimpleLabel "\v^\s*[a-zA-Z0-9._]+\ze:\s*$" 102*181254a7Smrg 103*181254a7Smrg" Match label after goto to suppress highlighting of numbers inside 104*181254a7Smrgsyn match gimpleGotoLabel "\v<bb \d+\>[^:]" 105*181254a7Smrg 106*181254a7Smrg" Line numbers, generated with -fdump-tree-*-lineno 107*181254a7Smrgsyn match gimpleLineNo "\v\[[^\]]+:\d+:\d+\]" 108*181254a7Smrg 109*181254a7Smrg" DEBUG statements 110*181254a7Smrgsyn match gimpleDebug "\v# DEBUG.*" 111*181254a7Smrg 112*181254a7Smrg" GIMPLE predict statement 113*181254a7Smrgsyn match gimplePrediction "\v\/\/ predicted.*" 114*181254a7Smrg 115*181254a7Smrg 116*181254a7Smrg" Misc C/C++-like keywords 117*181254a7Smrgsyn keyword gimpleStructure struct union enum typedef class 118*181254a7Smrgsyn keyword gimpleStorageClass static register auto volatile extern const 119*181254a7Smrg \ template inline __attribute__ _Alignas alignas _Atomic 120*181254a7Smrg \ _Thread_local thread_local _Alignof alignof sizeof 121*181254a7Smrg 122*181254a7Smrghi def link gimpleType Type 123*181254a7Smrghi def link gimpleNumber Number 124*181254a7Smrghi def link gimpleFloat Float 125*181254a7Smrghi def link gimpleConstant Constant 126*181254a7Smrghi def link gimpleStructure Structure 127*181254a7Smrghi def link gimpleStorageClass StorageClass 128*181254a7Smrghi def link gimpleOperator Operator 129*181254a7Smrghi def link gimpleASTNode Operator 130*181254a7Smrghi def link gimpleStatement Statement 131*181254a7Smrghi def link gimpleConditional Conditional 132*181254a7Smrghi def link gimpleLoop Repeat 133*181254a7Smrghi def link gimpleException Exception 134*181254a7Smrghi def link gimpleComment Comment 135*181254a7Smrghi def link gimpleLineNo Comment 136*181254a7Smrghi def link gimpleLabel Label 137*181254a7Smrghi def link gimpleAnnotationOp Debug 138*181254a7Smrghi def link gimpleAnnotationMark Debug 139*181254a7Smrghi def link gimpleString String 140*181254a7Smrghi def link gimpleUnknownTree Error 141*181254a7Smrghi def link gimpleDebug Debug 142*181254a7Smrghi def link gimplePrediction Debug 143*181254a7Smrghi def link gimpleFrequency Debug 144*181254a7Smrghi def link gimpleBBCount Debug 145*181254a7Smrg 146*181254a7Smrglet b:current_syntax = "gimple" 147