Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 1 | (* |
| 2 | |
| 3 | polygen grammar for LLVM assembly language. |
| 4 | |
| 5 | This file defines an LLVM assembly language grammar for polygen, |
| 6 | which is a tool for generating random text based on a grammar. |
| 7 | It is strictly syntax-based, and makes no attempt to generate |
| 8 | IR that is semantically valid. Most of the IR produced doesn't |
| 9 | pass the Verifier. |
| 10 | |
| 11 | *) |
| 12 | |
| 13 | I ::= "title: LLVM assembly language\n" |
| 14 | ^ "status: experimental\n" |
| 15 | ^ "audience: LLVM developers\n" |
| 16 | ; |
| 17 | |
| 18 | S ::= Module ; |
| 19 | |
| 20 | (* |
| 21 | Define rules for non-keyword tokens. This is currently just a bunch |
| 22 | of hacks. They don't cover many valid forms of tokens, and they also |
| 23 | generate some invalid forms of tokens. The LLVM parser has custom |
| 24 | C++ code to lex these; custom C++ code for emitting them would be |
| 25 | convenient, but polygen doesn't support that. |
| 26 | *) |
| 27 | NonZeroDecimalDigit ::= 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ; |
| 28 | DecimalDigit ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ; |
| 29 | DecimalDigitSeq ::= DecimalDigit [^ DecimalDigitSeq ]; |
| 30 | HexDigit ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 31 | | a | b | c | d | e | f ; |
| 32 | HexDigitSeq ::= HexDigit [^ HexDigitSeq ]; |
| 33 | StringChar ::= a | b | c | d | e | f | g | h | i | j | k | l | m |
| 34 | | n | o | p | q | r | s | t | u | v | w | x | y | z ; |
| 35 | StringConstantSeq ::= StringChar [^ StringConstantSeq ]; |
| 36 | StringConstant ::= StringChar [^ StringConstantSeq ]; |
| 37 | EUINT64VAL ::= NonZeroDecimalDigit [^ DecimalDigitSeq ]; |
| 38 | ESINT64VAL ::= [ "-" ] ^ EUINT64VAL ; |
| 39 | EUAPINTVAL ::= EUINT64VAL ; |
| 40 | ESAPINTVAL ::= ESINT64VAL ; |
| 41 | LOCALVALID ::= "%" ^ DecimalDigitSeq ; |
| 42 | GLOBALVALID ::= "@" ^ DecimalDigitSeq ; |
| 43 | INTTYPE ::= "i" ^ EUINT64VAL ; |
| 44 | GLOBALVAR ::= "@" ^ StringConstant ; |
| 45 | LOCALVAR ::= "%" ^ StringConstant ; |
| 46 | STRINGCONSTANT ::= "\"" ^ StringConstant ^ "\"" ; |
| 47 | ATSTRINGCONSTANT ::= "@" ^ STRINGCONSTANT ; |
| 48 | PCTSTRINGCONSTANT ::= "%" ^ STRINGCONSTANT ; |
| 49 | LABELSTR ::= StringConstant ; |
| 50 | FPVAL ::= ESAPINTVAL ^ "." ^ EUAPINTVAL | "0x" ^ HexDigitSeq ; |
| 51 | |
| 52 | (* |
| 53 | The rest of this file is derived directly from llvmAsmParser.y. |
| 54 | *) |
| 55 | |
Dan Gohman | ae3a0be | 2009-06-04 22:49:04 +0000 | [diff] [blame] | 56 | ArithmeticOps ::= add | fadd | sub | fsub | mul | fmul | |
| 57 | udiv | sdiv | fdiv | urem | srem | frem ; |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 58 | LogicalOps ::= shl | lshr | ashr | and | or | xor; |
| 59 | CastOps ::= trunc | zext | sext | fptrunc | fpext | bitcast | |
| 60 | uitofp | sitofp | fptoui | fptosi | inttoptr | ptrtoint ; |
| 61 | |
| 62 | IPredicates ::= eq | ne | slt | sgt | sle | sge | ult | ugt | ule | uge ; |
| 63 | |
| 64 | FPredicates ::= oeq | one | olt | ogt | ole | oge | ord | uno | ueq | une |
| 65 | | ult | ugt | ule | uge | true | false ; |
| 66 | |
| 67 | IntType ::= INTTYPE; |
| 68 | FPType ::= float | double | "ppc_fp128" | fp128 | "x86_fp80"; |
| 69 | |
| 70 | LocalName ::= LOCALVAR | STRINGCONSTANT | PCTSTRINGCONSTANT ; |
| 71 | OptLocalName ::= LocalName | _ ; |
| 72 | |
Dan Gohman | 8f56eba | 2009-01-05 17:29:42 +0000 | [diff] [blame] | 73 | OptAddrSpace ::= - addrspace ^ "(" ^ EUINT64VAL ^ ")" | _ ; |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 74 | |
| 75 | OptLocalAssign ::= LocalName "=" | _ ; |
| 76 | |
| 77 | GlobalName ::= GLOBALVAR | ATSTRINGCONSTANT ; |
| 78 | |
| 79 | OptGlobalAssign ::= GlobalAssign | _ ; |
| 80 | |
| 81 | GlobalAssign ::= GlobalName "=" ; |
| 82 | |
| 83 | GVInternalLinkage |
| 84 | ::= + internal |
| 85 | | weak |
Duncan Sands | 667d4b8 | 2009-03-07 15:45:40 +0000 | [diff] [blame] | 86 | | "weak_odr" |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 87 | | linkonce |
Duncan Sands | 667d4b8 | 2009-03-07 15:45:40 +0000 | [diff] [blame] | 88 | | "linkonce_odr" |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 89 | | appending |
| 90 | | dllexport |
| 91 | | common |
| 92 | ; |
| 93 | |
| 94 | GVExternalLinkage |
| 95 | ::= dllimport |
| 96 | | "extern_weak" |
| 97 | | + external |
| 98 | ; |
| 99 | |
| 100 | GVVisibilityStyle |
| 101 | ::= + _ |
| 102 | | default |
| 103 | | hidden |
| 104 | | protected |
| 105 | ; |
| 106 | |
| 107 | FunctionDeclareLinkage |
| 108 | ::= + _ |
| 109 | | dllimport |
| 110 | | "extern_weak" |
| 111 | ; |
| 112 | |
| 113 | FunctionDefineLinkage |
| 114 | ::= + _ |
| 115 | | internal |
| 116 | | linkonce |
Duncan Sands | 667d4b8 | 2009-03-07 15:45:40 +0000 | [diff] [blame] | 117 | | "linkonce_odr" |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 118 | | weak |
Duncan Sands | 667d4b8 | 2009-03-07 15:45:40 +0000 | [diff] [blame] | 119 | | "weak_odr" |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 120 | | dllexport |
| 121 | ; |
| 122 | |
Duncan Sands | 667d4b8 | 2009-03-07 15:45:40 +0000 | [diff] [blame] | 123 | AliasLinkage ::= + _ | weak | "weak_odr" | internal ; |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 124 | |
| 125 | OptCallingConv ::= + _ | |
| 126 | ccc | |
| 127 | fastcc | |
| 128 | coldcc | |
| 129 | "x86_stdcallcc" | |
| 130 | "x86_fastcallcc" | |
| 131 | cc EUINT64VAL ; |
| 132 | |
| 133 | ParamAttr ::= zeroext |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 134 | | signext |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 135 | | inreg |
| 136 | | sret |
| 137 | | noalias |
Dan Gohman | 571238a | 2009-01-05 03:21:23 +0000 | [diff] [blame] | 138 | | nocapture |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 139 | | byval |
| 140 | | nest |
| 141 | | align EUINT64VAL |
| 142 | ; |
| 143 | |
| 144 | OptParamAttrs ::= + _ | OptParamAttrs ParamAttr ; |
| 145 | |
Dan Gohman | 571238a | 2009-01-05 03:21:23 +0000 | [diff] [blame] | 146 | RetAttr ::= inreg |
| 147 | | zeroext |
| 148 | | signext |
| 149 | | noalias |
| 150 | ; |
| 151 | |
| 152 | OptRetAttrs ::= _ |
| 153 | | OptRetAttrs RetAttr |
| 154 | ; |
| 155 | |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 156 | FuncAttr ::= noreturn |
| 157 | | nounwind |
Dan Gohman | 571238a | 2009-01-05 03:21:23 +0000 | [diff] [blame] | 158 | | inreg |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 159 | | zeroext |
| 160 | | signext |
| 161 | | readnone |
| 162 | | readonly |
Dan Gohman | 571238a | 2009-01-05 03:21:23 +0000 | [diff] [blame] | 163 | | noinline |
| 164 | | alwaysinline |
| 165 | | optsize |
| 166 | | ssp |
| 167 | | sspreq |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 168 | ; |
| 169 | |
| 170 | OptFuncAttrs ::= + _ | OptFuncAttrs FuncAttr ; |
| 171 | |
| 172 | OptGC ::= + _ | gc STRINGCONSTANT ; |
| 173 | |
| 174 | OptAlign ::= + _ | align EUINT64VAL ; |
| 175 | OptCAlign ::= + _ | ^ "," align EUINT64VAL ; |
| 176 | |
| 177 | SectionString ::= section STRINGCONSTANT ; |
| 178 | |
| 179 | OptSection ::= + _ | SectionString ; |
| 180 | |
| 181 | GlobalVarAttributes ::= + _ | ^ "," GlobalVarAttribute GlobalVarAttributes ; |
| 182 | GlobalVarAttribute ::= SectionString | align EUINT64VAL ; |
| 183 | |
| 184 | PrimType ::= INTTYPE | float | double | "ppc_fp128" | fp128 | "x86_fp80" |
| 185 | | - label ; |
| 186 | |
| 187 | Types |
| 188 | ::= opaque |
| 189 | | PrimType |
| 190 | | Types OptAddrSpace ^ "*" |
| 191 | | SymbolicValueRef |
| 192 | | "\\" ^ EUINT64VAL |
| 193 | | Types "(" ^ ArgTypeListI ^ ")" OptFuncAttrs |
| 194 | | void "(" ^ ArgTypeListI ^ ")" OptFuncAttrs |
| 195 | | "[" ^ EUINT64VAL "x" Types ^ "]" |
| 196 | | "<" ^ EUINT64VAL "x" Types ^ ">" |
| 197 | | "{" TypeListI "}" |
Dan Gohman | 0d58eb6 | 2008-09-15 16:10:51 +0000 | [diff] [blame] | 198 | | "{" ^ "}" |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 199 | | "<" ^ "{" TypeListI "}" ^ ">" |
Dan Gohman | 0d58eb6 | 2008-09-15 16:10:51 +0000 | [diff] [blame] | 200 | | "<" ^ "{" ^ "}" ^ ">" |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 201 | ; |
| 202 | |
| 203 | ArgType ::= Types OptParamAttrs ; |
| 204 | |
| 205 | ResultTypes ::= Types | void ; |
| 206 | |
| 207 | ArgTypeList ::= ArgType | ArgTypeList ^ "," ArgType ; |
| 208 | |
| 209 | ArgTypeListI ::= ArgTypeList | ArgTypeList ^ "," "..." | "..." | _ ; |
| 210 | |
| 211 | TypeListI ::= Types | TypeListI ^ "," Types ; |
| 212 | |
| 213 | ConstVal::= Types "[" ^ ConstVector ^ "]" |
Dan Gohman | 0d58eb6 | 2008-09-15 16:10:51 +0000 | [diff] [blame] | 214 | | Types "[" ^ "]" |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 215 | | Types "c" ^ STRINGCONSTANT |
| 216 | | Types "<" ^ ConstVector ^ ">" |
| 217 | | Types "{" ConstVector "}" |
Dan Gohman | 0d58eb6 | 2008-09-15 16:10:51 +0000 | [diff] [blame] | 218 | | Types "{" ^ "}" |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 219 | | Types "<" ^ "{" ConstVector "}" ^ ">" |
Dan Gohman | 0d58eb6 | 2008-09-15 16:10:51 +0000 | [diff] [blame] | 220 | | Types "<" ^ "{" ^ "}" ^ ">" |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 221 | | Types null |
| 222 | | Types undef |
| 223 | | Types SymbolicValueRef |
| 224 | | Types ConstExpr |
| 225 | | Types zeroinitializer |
Dan Gohman | 571238a | 2009-01-05 03:21:23 +0000 | [diff] [blame] | 226 | | Types ESINT64VAL |
| 227 | | Types ESAPINTVAL |
| 228 | | Types EUINT64VAL |
| 229 | | Types EUAPINTVAL |
| 230 | | Types true |
| 231 | | Types false |
| 232 | | Types FPVAL ; |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 233 | |
| 234 | ConstExpr::= CastOps "(" ^ ConstVal to Types ^ ")" |
| 235 | | getelementptr "(" ^ ConstVal IndexList ^ ")" |
| 236 | | select "(" ^ ConstVal ^ "," ConstVal ^ "," ConstVal ^ ")" |
| 237 | | ArithmeticOps "(" ^ ConstVal ^ "," ConstVal ^ ")" |
| 238 | | LogicalOps "(" ^ ConstVal ^ "," ConstVal ^ ")" |
| 239 | | icmp IPredicates "(" ^ ConstVal ^ "," ConstVal ^ ")" |
| 240 | | fcmp FPredicates "(" ^ ConstVal ^ "," ConstVal ^ ")" |
| 241 | | vicmp IPredicates "(" ^ ConstVal ^ "," ConstVal ^ ")" |
| 242 | | vfcmp FPredicates "(" ^ ConstVal ^ "," ConstVal ^ ")" |
| 243 | | extractelement "(" ^ ConstVal ^ "," ConstVal ^ ")" |
| 244 | | insertelement "(" ^ ConstVal ^ "," ConstVal ^ "," ConstVal ^ ")" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 245 | | shufflevector "(" ^ ConstVal ^ "," ConstVal ^ "," ConstVal ^ ")" |
Dan Gohman | 34e71fe | 2008-06-02 19:47:09 +0000 | [diff] [blame] | 246 | | extractvalue "(" ^ ConstVal ^ ConstantIndexList ^ ")" |
| 247 | | insertvalue "(" ^ ConstVal ^ "," ConstVal ^ ConstantIndexList ^ ")" ; |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 248 | |
| 249 | ConstVector ::= ConstVector ^ "," ConstVal | ConstVal ; |
| 250 | |
| 251 | GlobalType ::= global | constant ; |
| 252 | |
| 253 | ThreadLocal ::= - "thread_local" | _ ; |
| 254 | |
| 255 | AliaseeRef ::= ResultTypes SymbolicValueRef |
| 256 | | bitcast "(" ^ AliaseeRef to Types ^ ")" ; |
| 257 | |
| 258 | Module ::= +++ DefinitionList | --- _ ; |
| 259 | |
| 260 | DefinitionList ::= - Definition | + DefinitionList Definition ; |
| 261 | |
| 262 | Definition |
| 263 | ::= ^ ( +++++ define Function |
| 264 | | declare FunctionProto |
| 265 | | - module asm AsmBlock |
| 266 | | OptLocalAssign type Types |
Dan Gohman | de0e7f2 | 2009-01-05 23:03:03 +0000 | [diff] [blame] | 267 | | OptGlobalAssign GVVisibilityStyle ThreadLocal OptAddrSpace GlobalType |
Dan Gohman | 8f56eba | 2009-01-05 17:29:42 +0000 | [diff] [blame] | 268 | ConstVal GlobalVarAttributes |
| 269 | | OptGlobalAssign GVInternalLinkage GVVisibilityStyle ThreadLocal OptAddrSpace |
| 270 | GlobalType ConstVal GlobalVarAttributes |
| 271 | | OptGlobalAssign GVExternalLinkage GVVisibilityStyle ThreadLocal OptAddrSpace |
| 272 | GlobalType Types GlobalVarAttributes |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 273 | | OptGlobalAssign GVVisibilityStyle alias AliasLinkage AliaseeRef |
| 274 | | target TargetDefinition |
| 275 | | deplibs "=" LibrariesDefinition |
| 276 | ) ^ "\n"; |
| 277 | |
| 278 | AsmBlock ::= STRINGCONSTANT ; |
| 279 | |
| 280 | TargetDefinition ::= triple "=" STRINGCONSTANT |
| 281 | | datalayout "=" STRINGCONSTANT ; |
| 282 | |
Dan Gohman | 8f56eba | 2009-01-05 17:29:42 +0000 | [diff] [blame] | 283 | LibrariesDefinition ::= "[" ( LibList | _ ) "]"; |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 284 | |
Dan Gohman | 8f56eba | 2009-01-05 17:29:42 +0000 | [diff] [blame] | 285 | LibList ::= LibList ^ "," STRINGCONSTANT | STRINGCONSTANT ; |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 286 | |
| 287 | ArgListH ::= ArgListH ^ "," Types OptParamAttrs OptLocalName |
| 288 | | Types OptParamAttrs OptLocalName ; |
| 289 | |
| 290 | ArgList ::= ArgListH | ArgListH ^ "," "..." | "..." | _ ; |
| 291 | |
Dan Gohman | 571238a | 2009-01-05 03:21:23 +0000 | [diff] [blame] | 292 | FunctionHeaderH ::= OptCallingConv OptRetAttrs ResultTypes |
Dan Gohman | 8f56eba | 2009-01-05 17:29:42 +0000 | [diff] [blame] | 293 | GlobalName ^ "(" ^ ArgList ^ ")" |
Dan Gohman | 571238a | 2009-01-05 03:21:23 +0000 | [diff] [blame] | 294 | OptFuncAttrs OptSection OptAlign OptGC ; |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 295 | |
| 296 | BEGIN ::= ( begin | "{" ) ^ "\n"; |
| 297 | |
| 298 | FunctionHeader ::= |
| 299 | FunctionDefineLinkage GVVisibilityStyle FunctionHeaderH BEGIN ; |
| 300 | |
| 301 | END ::= ^ ( end | "}" ) ^ "\n"; |
| 302 | |
| 303 | Function ::= BasicBlockList END ; |
| 304 | |
| 305 | FunctionProto ::= FunctionDeclareLinkage GVVisibilityStyle FunctionHeaderH ; |
| 306 | |
| 307 | OptSideEffect ::= _ | sideeffect ; |
| 308 | |
| 309 | ConstValueRef ::= ESINT64VAL |
| 310 | | EUINT64VAL |
| 311 | | FPVAL |
| 312 | | true |
| 313 | | false |
| 314 | | null |
| 315 | | undef |
| 316 | | zeroinitializer |
| 317 | | "<" ConstVector ">" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 318 | | "[" ConstVector "]" |
Dan Gohman | 0d58eb6 | 2008-09-15 16:10:51 +0000 | [diff] [blame] | 319 | | "[" ^ "]" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 320 | | "c" ^ STRINGCONSTANT |
| 321 | | "{" ConstVector "}" |
Dan Gohman | 0d58eb6 | 2008-09-15 16:10:51 +0000 | [diff] [blame] | 322 | | "{" ^ "}" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 323 | | "<" ^ "{" ConstVector "}" ^ ">" |
Dan Gohman | 0d58eb6 | 2008-09-15 16:10:51 +0000 | [diff] [blame] | 324 | | "<" ^ "{" ^ "}" ^ ">" |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 325 | | ConstExpr |
| 326 | | asm OptSideEffect STRINGCONSTANT ^ "," STRINGCONSTANT ; |
| 327 | |
| 328 | SymbolicValueRef ::= LOCALVALID |
| 329 | | GLOBALVALID |
| 330 | | LocalName |
| 331 | | GlobalName ; |
| 332 | |
| 333 | ValueRef ::= SymbolicValueRef | ConstValueRef; |
| 334 | |
| 335 | ResolvedVal ::= Types ValueRef ; |
| 336 | |
| 337 | ReturnedVal ::= ResolvedVal | ReturnedVal ^ "," ResolvedVal ; |
| 338 | |
| 339 | BasicBlockList ::= BasicBlockList BasicBlock | FunctionHeader BasicBlock ; |
| 340 | |
| 341 | BasicBlock ::= InstructionList OptLocalAssign BBTerminatorInst ; |
| 342 | |
| 343 | InstructionList ::= +++ InstructionList Inst |
| 344 | | - _ |
| 345 | | ^ LABELSTR ^ ":\n" ; |
| 346 | |
| 347 | BBTerminatorInst ::= ^ " " ^ |
| 348 | ( ret ReturnedVal |
| 349 | | ret void |
| 350 | | br label ValueRef |
| 351 | | br INTTYPE ValueRef ^ "," label ValueRef ^ "," label ValueRef |
| 352 | | switch IntType ValueRef ^ "," label ValueRef "[" JumpTable "]" |
Dan Gohman | 0d58eb6 | 2008-09-15 16:10:51 +0000 | [diff] [blame] | 353 | | switch IntType ValueRef ^ "," label ValueRef "[" ^ "]" |
| 354 | | invoke OptCallingConv ResultTypes ValueRef ^ "(" ^ ParamList ^ ")" |
| 355 | OptFuncAttrs |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 356 | to label ValueRef unwind label ValueRef |
| 357 | | unwind |
| 358 | | unreachable ) ^ "\n"; |
| 359 | |
| 360 | JumpTable ::= JumpTable IntType ConstValueRef ^ "," label ValueRef |
| 361 | | IntType ConstValueRef ^ "," label ValueRef ; |
| 362 | |
| 363 | Inst ::= ^ " " ^ OptLocalAssign InstVal ^ "\n"; |
| 364 | |
| 365 | PHIList ::= Types "[" ValueRef ^ "," ValueRef "]" |
| 366 | | PHIList ^ "," "[" ValueRef ^ "," ValueRef "]" ; |
| 367 | |
| 368 | ParamList ::= Types OptParamAttrs ValueRef OptParamAttrs |
| 369 | | label OptParamAttrs ValueRef OptParamAttrs |
| 370 | | ParamList ^ "," Types OptParamAttrs ValueRef OptParamAttrs |
| 371 | | ParamList ^ "," label OptParamAttrs ValueRef OptParamAttrs |
| 372 | | - _ ; |
| 373 | |
| 374 | IndexList ::= _ | IndexList ^ "," ResolvedVal ; |
| 375 | |
Dan Gohman | 34e71fe | 2008-06-02 19:47:09 +0000 | [diff] [blame] | 376 | ConstantIndexList ::= "," EUINT64VAL | ConstantIndexList ^ "," EUINT64VAL ; |
| 377 | |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 378 | OptTailCall ::= tail call | call ; |
| 379 | |
| 380 | InstVal ::= |
| 381 | ArithmeticOps Types ValueRef ^ "," ValueRef |
| 382 | | LogicalOps Types ValueRef ^ "," ValueRef |
| 383 | | icmp IPredicates Types ValueRef ^ "," ValueRef |
| 384 | | fcmp FPredicates Types ValueRef ^ "," ValueRef |
| 385 | | vicmp IPredicates Types ValueRef ^ "," ValueRef |
| 386 | | vfcmp FPredicates Types ValueRef ^ "," ValueRef |
| 387 | | CastOps ResolvedVal to Types |
| 388 | | select ResolvedVal ^ "," ResolvedVal ^ "," ResolvedVal |
Dan Gohman | b737a64 | 2008-05-23 17:11:55 +0000 | [diff] [blame] | 389 | | "va_arg" ResolvedVal ^ "," Types |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 390 | | extractelement ResolvedVal ^ "," ResolvedVal |
| 391 | | insertelement ResolvedVal ^ "," ResolvedVal ^ "," ResolvedVal |
| 392 | | shufflevector ResolvedVal ^ "," ResolvedVal ^ "," ResolvedVal |
| 393 | | phi PHIList |
Dan Gohman | 0d58eb6 | 2008-09-15 16:10:51 +0000 | [diff] [blame] | 394 | | OptTailCall OptCallingConv ResultTypes ValueRef ^ "(" ^ ParamList ^ ")" |
Dan Gohman | 890c31c | 2008-05-22 22:45:03 +0000 | [diff] [blame] | 395 | OptFuncAttrs |
| 396 | | MemoryInst ; |
| 397 | |
| 398 | OptVolatile ::= - volatile | _ ; |
| 399 | |
| 400 | MemoryInst ::= malloc Types OptCAlign |
| 401 | | malloc Types ^ "," INTTYPE ValueRef OptCAlign |
| 402 | | alloca Types OptCAlign |
| 403 | | alloca Types ^ "," INTTYPE ValueRef OptCAlign |
| 404 | | free ResolvedVal |
| 405 | | OptVolatile load Types ValueRef OptCAlign |
| 406 | | OptVolatile store ResolvedVal ^ "," Types ValueRef OptCAlign |
| 407 | | getresult Types ValueRef ^ "," EUINT64VAL |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 408 | | getelementptr Types ValueRef IndexList |
Dan Gohman | 34e71fe | 2008-06-02 19:47:09 +0000 | [diff] [blame] | 409 | | extractvalue Types ValueRef ^ ConstantIndexList |
| 410 | | insertvalue Types ValueRef ^ "," Types ValueRef ^ ConstantIndexList ; |