1 /* Warning: automatically generated code */ 2 #ifndef FIRM_IR_NODEOPS_H 3 #define FIRM_IR_NODEOPS_H 4 5 #include "firm_types.h" 6 7 #include "begin.h" 8 9 /** 10 * @addtogroup ir_node 11 * @{ 12 */ 13 14 /** 15 * @defgroup ASM ASM node 16 * 17 * executes assembler fragments of the target machine. 18 19 The node contains a template for an assembler snippet. The compiler will 20 replace occurences of %0 to %9 with input/output registers, 21 %% with a single % char. Some backends allow additional specifiers (for 22 example %w3, %l3, %h3 on x86 to get a 16bit, 8hit low, 8bit high part 23 of a register). 24 After the replacements the text is emitted into the final assembly. 25 26 The clobber list contains names of registers which have an undefined value 27 after the assembler instruction is executed; it may also contain 'memory' 28 or 'cc' if global state/memory changes or the condition code registers 29 (some backends implicitely set cc, memory clobbers on all ASM statements). 30 31 Example (an i386 instruction):: 32 33 ASM(text="btsl %1, %0", 34 input_constraints = ["=m", "r"], 35 clobbers = ["cc"]) 36 37 As there are no output, the %0 references the first input which is just an 38 address which the asm operation writes to. %1 references to an input which 39 is passed as a register. The condition code register has an unknown value 40 after the instruction. 41 42 (This format is inspired by the gcc extended asm syntax) 43 * @{ 44 */ 45 46 /** 47 * Input numbers for ASM node 48 */ 49 typedef enum { 50 n_ASM_mem, 51 n_ASM_max = n_ASM_mem 52 } n_ASM; 53 54 55 /** 56 * Test if node is a ASM 57 * @returns 1 if the node is a ASM node, 0 otherwise 58 */ 59 FIRM_API int is_ASM(const ir_node *node); 60 61 /** Returns mem input of an ASM node. */ 62 FIRM_API ir_node *get_ASM_mem(const ir_node *node); 63 /** Sets mem input of an ASM node. */ 64 FIRM_API void set_ASM_mem(ir_node *node, ir_node *mem); 65 /** Returns input_constraints attribute of an ASM node. */ 66 FIRM_API ir_asm_constraint* get_ASM_input_constraints(const ir_node *node); 67 /** Sets input_constraints attribute of an ASM node. */ 68 FIRM_API void set_ASM_input_constraints(ir_node *node, ir_asm_constraint* input_constraints); 69 /** Returns output_constraints attribute of an ASM node. */ 70 FIRM_API ir_asm_constraint* get_ASM_output_constraints(const ir_node *node); 71 /** Sets output_constraints attribute of an ASM node. */ 72 FIRM_API void set_ASM_output_constraints(ir_node *node, ir_asm_constraint* output_constraints); 73 /** Returns clobbers attribute of an ASM node. */ 74 FIRM_API ident** get_ASM_clobbers(const ir_node *node); 75 /** Sets clobbers attribute of an ASM node. */ 76 FIRM_API void set_ASM_clobbers(ir_node *node, ident** clobbers); 77 /** Returns text attribute of an ASM node. */ 78 FIRM_API ident* get_ASM_text(const ir_node *node); 79 /** Sets text attribute of an ASM node. */ 80 FIRM_API void set_ASM_text(ir_node *node, ident* text); 81 /** @} */ 82 83 /** 84 * @defgroup Add Add node 85 * 86 * returns the sum of its operands 87 * @{ 88 */ 89 90 /** 91 * Input numbers for Add node 92 */ 93 typedef enum { 94 n_Add_left, 95 n_Add_right, 96 n_Add_max = n_Add_right 97 } n_Add; 98 99 100 /** 101 * Construct an Add node. 102 * 103 * @param dbgi A pointer to debug information. 104 * @param block The IR block the node belongs to. 105 * @param irn_left first operand 106 * @param irn_right second operand 107 * @param mode mode of the operations result 108 */ 109 FIRM_API ir_node *new_rd_Add(dbg_info *dbgi, ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 110 111 /** 112 * Construct an Add node. 113 * 114 * @param block The IR block the node belongs to. 115 * @param irn_left first operand 116 * @param irn_right second operand 117 * @param mode mode of the operations result 118 */ 119 FIRM_API ir_node *new_r_Add(ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 120 121 /** 122 * Construct an Add node. 123 * 124 * @param dbgi A pointer to debug information. 125 * @param irn_left first operand 126 * @param irn_right second operand 127 * @param mode mode of the operations result 128 */ 129 FIRM_API ir_node *new_d_Add(dbg_info *dbgi, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 130 131 /** 132 * Construct an Add node. 133 * 134 * @param irn_left first operand 135 * @param irn_right second operand 136 * @param mode mode of the operations result 137 */ 138 FIRM_API ir_node *new_Add(ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 139 /** 140 * Test if node is a Add 141 * @returns 1 if the node is a Add node, 0 otherwise 142 */ 143 FIRM_API int is_Add(const ir_node *node); 144 145 /** Returns left input of an Add node. */ 146 FIRM_API ir_node *get_Add_left(const ir_node *node); 147 /** Sets left input of an Add node. */ 148 FIRM_API void set_Add_left(ir_node *node, ir_node *left); 149 /** Returns right input of an Add node. */ 150 FIRM_API ir_node *get_Add_right(const ir_node *node); 151 /** Sets right input of an Add node. */ 152 FIRM_API void set_Add_right(ir_node *node, ir_node *right); 153 /** @} */ 154 155 /** 156 * @defgroup Alloc Alloc node 157 * 158 * allocates a block of memory. 159 It can be specified whether the memory should be allocated to the stack 160 or to the heap. 161 Allocates memory for one or more objects (depending on value on count input). 162 * @{ 163 */ 164 165 /** 166 * Input numbers for Alloc node 167 */ 168 typedef enum { 169 n_Alloc_mem, 170 n_Alloc_count, 171 n_Alloc_max = n_Alloc_count 172 } n_Alloc; 173 174 175 /** 176 * Projection numbers for result of Alloc node (use for Proj nodes) 177 */ 178 typedef enum { 179 pn_Alloc_M, /**< memory result */ 180 pn_Alloc_res, /**< pointer to newly allocated memory */ 181 pn_Alloc_X_regular, /**< control flow when no exception occurs */ 182 pn_Alloc_X_except, /**< control flow when exception occured */ 183 pn_Alloc_max = pn_Alloc_X_except 184 } pn_Alloc; 185 186 /** 187 * Construct an Alloc node. 188 * 189 * @param dbgi A pointer to debug information. 190 * @param block The IR block the node belongs to. 191 * @param irn_mem memory dependency 192 * @param irn_count number of objects to allocate 193 * @param type type of the objects to allocate 194 * @param where whether to allocate the variable on the stack or heap 195 */ 196 FIRM_API ir_node *new_rd_Alloc(dbg_info *dbgi, ir_node *block, ir_node * irn_mem, ir_node * irn_count, ir_type* type, ir_where_alloc where); 197 198 /** 199 * Construct an Alloc node. 200 * 201 * @param block The IR block the node belongs to. 202 * @param irn_mem memory dependency 203 * @param irn_count number of objects to allocate 204 * @param type type of the objects to allocate 205 * @param where whether to allocate the variable on the stack or heap 206 */ 207 FIRM_API ir_node *new_r_Alloc(ir_node *block, ir_node * irn_mem, ir_node * irn_count, ir_type* type, ir_where_alloc where); 208 209 /** 210 * Construct an Alloc node. 211 * 212 * @param dbgi A pointer to debug information. 213 * @param irn_mem memory dependency 214 * @param irn_count number of objects to allocate 215 * @param type type of the objects to allocate 216 * @param where whether to allocate the variable on the stack or heap 217 */ 218 FIRM_API ir_node *new_d_Alloc(dbg_info *dbgi, ir_node * irn_mem, ir_node * irn_count, ir_type* type, ir_where_alloc where); 219 220 /** 221 * Construct an Alloc node. 222 * 223 * @param irn_mem memory dependency 224 * @param irn_count number of objects to allocate 225 * @param type type of the objects to allocate 226 * @param where whether to allocate the variable on the stack or heap 227 */ 228 FIRM_API ir_node *new_Alloc(ir_node * irn_mem, ir_node * irn_count, ir_type* type, ir_where_alloc where); 229 /** 230 * Test if node is a Alloc 231 * @returns 1 if the node is a Alloc node, 0 otherwise 232 */ 233 FIRM_API int is_Alloc(const ir_node *node); 234 235 /** Returns mem input of an Alloc node. */ 236 FIRM_API ir_node *get_Alloc_mem(const ir_node *node); 237 /** Sets mem input of an Alloc node. */ 238 FIRM_API void set_Alloc_mem(ir_node *node, ir_node *mem); 239 /** Returns count input of an Alloc node. */ 240 FIRM_API ir_node *get_Alloc_count(const ir_node *node); 241 /** Sets count input of an Alloc node. */ 242 FIRM_API void set_Alloc_count(ir_node *node, ir_node *count); 243 /** Returns type attribute of an Alloc node. */ 244 FIRM_API ir_type* get_Alloc_type(const ir_node *node); 245 /** Sets type attribute of an Alloc node. */ 246 FIRM_API void set_Alloc_type(ir_node *node, ir_type* type); 247 /** Returns where attribute of an Alloc node. */ 248 FIRM_API ir_where_alloc get_Alloc_where(const ir_node *node); 249 /** Sets where attribute of an Alloc node. */ 250 FIRM_API void set_Alloc_where(ir_node *node, ir_where_alloc where); 251 /** @} */ 252 253 /** 254 * @defgroup Anchor Anchor node 255 * 256 * utiliy node used to "hold" nodes in a graph that might possibly not be 257 reachable by other means or which should be reachable immediately without 258 searching through the graph. 259 Each firm-graph contains exactly one anchor node whose address is always 260 known. All other well-known graph-nodes like Start, End, NoMem, Bad, ... 261 are found by looking at the respective Anchor operand. 262 * @{ 263 */ 264 265 266 /** 267 * Test if node is a Anchor 268 * @returns 1 if the node is a Anchor node, 0 otherwise 269 */ 270 FIRM_API int is_Anchor(const ir_node *node); 271 272 /** @} */ 273 274 /** 275 * @defgroup And And node 276 * 277 * returns the result of a bitwise and operation of its operands 278 * @{ 279 */ 280 281 /** 282 * Input numbers for And node 283 */ 284 typedef enum { 285 n_And_left, 286 n_And_right, 287 n_And_max = n_And_right 288 } n_And; 289 290 291 /** 292 * Construct an And node. 293 * 294 * @param dbgi A pointer to debug information. 295 * @param block The IR block the node belongs to. 296 * @param irn_left first operand 297 * @param irn_right second operand 298 * @param mode mode of the operations result 299 */ 300 FIRM_API ir_node *new_rd_And(dbg_info *dbgi, ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 301 302 /** 303 * Construct an And node. 304 * 305 * @param block The IR block the node belongs to. 306 * @param irn_left first operand 307 * @param irn_right second operand 308 * @param mode mode of the operations result 309 */ 310 FIRM_API ir_node *new_r_And(ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 311 312 /** 313 * Construct an And node. 314 * 315 * @param dbgi A pointer to debug information. 316 * @param irn_left first operand 317 * @param irn_right second operand 318 * @param mode mode of the operations result 319 */ 320 FIRM_API ir_node *new_d_And(dbg_info *dbgi, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 321 322 /** 323 * Construct an And node. 324 * 325 * @param irn_left first operand 326 * @param irn_right second operand 327 * @param mode mode of the operations result 328 */ 329 FIRM_API ir_node *new_And(ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 330 /** 331 * Test if node is a And 332 * @returns 1 if the node is a And node, 0 otherwise 333 */ 334 FIRM_API int is_And(const ir_node *node); 335 336 /** Returns left input of an And node. */ 337 FIRM_API ir_node *get_And_left(const ir_node *node); 338 /** Sets left input of an And node. */ 339 FIRM_API void set_And_left(ir_node *node, ir_node *left); 340 /** Returns right input of an And node. */ 341 FIRM_API ir_node *get_And_right(const ir_node *node); 342 /** Sets right input of an And node. */ 343 FIRM_API void set_And_right(ir_node *node, ir_node *right); 344 /** @} */ 345 346 /** 347 * @defgroup Bad Bad node 348 * 349 * Bad nodes indicate invalid input, which is values which should never be 350 computed. 351 352 The typical use case for the Bad node is removing unreachable code. 353 Frontends should set the current_block to Bad when it is clear that 354 following code must be unreachable (ie. after a goto or return statement). 355 Optimisations also set block predecessors to Bad when it becomes clear, 356 that a control flow edge can never be executed. 357 358 The gigo optimisations ensures that nodes with Bad as their block, get 359 replaced by Bad themselves. Nodes with at least 1 Bad input get exchanged 360 with Bad too. Exception to this rule are Block, Phi, Tuple and End node; 361 This is because removing inputs from a Block is hairy operation (requiring, 362 Phis to be shortened too for example). So instead of removing block inputs 363 they are set to Bad, and the actual removal is left to the control flow 364 optimisation phase. Block, Phi, Tuple with only Bad inputs however are 365 replaced by Bad right away. 366 * @{ 367 */ 368 369 370 /** 371 * Construct a Bad node. 372 * 373 * @param dbgi A pointer to debug information. 374 * @param irg The IR graph the node belongs to. 375 * @param mode mode of the operations result 376 */ 377 FIRM_API ir_node *new_rd_Bad(dbg_info *dbgi, ir_graph *irg, ir_mode * mode); 378 379 /** 380 * Construct a Bad node. 381 * 382 * @param irg The IR graph the node belongs to. 383 * @param mode mode of the operations result 384 */ 385 FIRM_API ir_node *new_r_Bad(ir_graph *irg, ir_mode * mode); 386 387 /** 388 * Construct a Bad node. 389 * 390 * @param dbgi A pointer to debug information. 391 * @param mode mode of the operations result 392 */ 393 FIRM_API ir_node *new_d_Bad(dbg_info *dbgi, ir_mode * mode); 394 395 /** 396 * Construct a Bad node. 397 * 398 * @param mode mode of the operations result 399 */ 400 FIRM_API ir_node *new_Bad(ir_mode * mode); 401 /** 402 * Test if node is a Bad 403 * @returns 1 if the node is a Bad node, 0 otherwise 404 */ 405 FIRM_API int is_Bad(const ir_node *node); 406 407 /** @} */ 408 409 /** 410 * @defgroup Block Block node 411 * 412 * A basic block 413 * @{ 414 */ 415 416 417 /** 418 * Construct a Block node. 419 * 420 * @param dbgi A pointer to debug information. 421 * @param irg The IR graph the node belongs to. 422 * @param arity size of additional inputs array 423 * @param in additional inputs 424 */ 425 FIRM_API ir_node *new_rd_Block(dbg_info *dbgi, ir_graph *irg, int arity, ir_node *const * in); 426 427 /** 428 * Construct a Block node. 429 * 430 * @param irg The IR graph the node belongs to. 431 * @param arity size of additional inputs array 432 * @param in additional inputs 433 */ 434 FIRM_API ir_node *new_r_Block(ir_graph *irg, int arity, ir_node *const * in); 435 436 /** 437 * Construct a Block node. 438 * 439 * @param dbgi A pointer to debug information. 440 * @param arity size of additional inputs array 441 * @param in additional inputs 442 */ 443 FIRM_API ir_node *new_d_Block(dbg_info *dbgi, int arity, ir_node *const * in); 444 445 /** 446 * Construct a Block node. 447 * 448 * @param arity size of additional inputs array 449 * @param in additional inputs 450 */ 451 FIRM_API ir_node *new_Block(int arity, ir_node *const * in); 452 /** 453 * Test if node is a Block 454 * @returns 1 if the node is a Block node, 0 otherwise 455 */ 456 FIRM_API int is_Block(const ir_node *node); 457 458 /** Returns entity attribute of a Block node. */ 459 FIRM_API ir_entity* get_Block_entity(const ir_node *node); 460 /** Sets entity attribute of a Block node. */ 461 FIRM_API void set_Block_entity(ir_node *node, ir_entity* entity); 462 /** @} */ 463 464 /** 465 * @defgroup Borrow Borrow node 466 * 467 * Returns the borrow bit from and implied subtractions of its 2 operands 468 * @{ 469 */ 470 471 /** 472 * Input numbers for Borrow node 473 */ 474 typedef enum { 475 n_Borrow_left, 476 n_Borrow_right, 477 n_Borrow_max = n_Borrow_right 478 } n_Borrow; 479 480 481 /** 482 * Construct a Borrow node. 483 * 484 * @param dbgi A pointer to debug information. 485 * @param block The IR block the node belongs to. 486 * @param irn_left first operand 487 * @param irn_right second operand 488 * @param mode mode of the operations result 489 */ 490 FIRM_API ir_node *new_rd_Borrow(dbg_info *dbgi, ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 491 492 /** 493 * Construct a Borrow node. 494 * 495 * @param block The IR block the node belongs to. 496 * @param irn_left first operand 497 * @param irn_right second operand 498 * @param mode mode of the operations result 499 */ 500 FIRM_API ir_node *new_r_Borrow(ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 501 502 /** 503 * Construct a Borrow node. 504 * 505 * @param dbgi A pointer to debug information. 506 * @param irn_left first operand 507 * @param irn_right second operand 508 * @param mode mode of the operations result 509 */ 510 FIRM_API ir_node *new_d_Borrow(dbg_info *dbgi, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 511 512 /** 513 * Construct a Borrow node. 514 * 515 * @param irn_left first operand 516 * @param irn_right second operand 517 * @param mode mode of the operations result 518 */ 519 FIRM_API ir_node *new_Borrow(ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 520 /** 521 * Test if node is a Borrow 522 * @returns 1 if the node is a Borrow node, 0 otherwise 523 */ 524 FIRM_API int is_Borrow(const ir_node *node); 525 526 /** Returns left input of a Borrow node. */ 527 FIRM_API ir_node *get_Borrow_left(const ir_node *node); 528 /** Sets left input of a Borrow node. */ 529 FIRM_API void set_Borrow_left(ir_node *node, ir_node *left); 530 /** Returns right input of a Borrow node. */ 531 FIRM_API ir_node *get_Borrow_right(const ir_node *node); 532 /** Sets right input of a Borrow node. */ 533 FIRM_API void set_Borrow_right(ir_node *node, ir_node *right); 534 /** @} */ 535 536 /** 537 * @defgroup Bound Bound node 538 * 539 * Performs a bounds-check: if lower <= index < upper then return index, 540 otherwise throw an exception. 541 * @{ 542 */ 543 544 /** 545 * Input numbers for Bound node 546 */ 547 typedef enum { 548 n_Bound_mem, 549 n_Bound_index, 550 n_Bound_lower, 551 n_Bound_upper, 552 n_Bound_max = n_Bound_upper 553 } n_Bound; 554 555 556 /** 557 * Projection numbers for result of Bound node (use for Proj nodes) 558 */ 559 typedef enum { 560 pn_Bound_M, /**< memory result */ 561 pn_Bound_res, /**< the checked index */ 562 pn_Bound_X_regular, /**< control flow when no exception occurs */ 563 pn_Bound_X_except, /**< control flow when exception occured */ 564 pn_Bound_max = pn_Bound_X_except 565 } pn_Bound; 566 567 /** 568 * Construct a Bound node. 569 * 570 * @param dbgi A pointer to debug information. 571 * @param block The IR block the node belongs to. 572 * @param irn_mem memory dependency 573 * @param irn_index value to test 574 * @param irn_lower lower bound (inclusive) 575 * @param irn_upper upper bound (exclusive) 576 */ 577 FIRM_API ir_node *new_rd_Bound(dbg_info *dbgi, ir_node *block, ir_node * irn_mem, ir_node * irn_index, ir_node * irn_lower, ir_node * irn_upper); 578 579 /** 580 * Construct a Bound node. 581 * 582 * @param block The IR block the node belongs to. 583 * @param irn_mem memory dependency 584 * @param irn_index value to test 585 * @param irn_lower lower bound (inclusive) 586 * @param irn_upper upper bound (exclusive) 587 */ 588 FIRM_API ir_node *new_r_Bound(ir_node *block, ir_node * irn_mem, ir_node * irn_index, ir_node * irn_lower, ir_node * irn_upper); 589 590 /** 591 * Construct a Bound node. 592 * 593 * @param dbgi A pointer to debug information. 594 * @param irn_mem memory dependency 595 * @param irn_index value to test 596 * @param irn_lower lower bound (inclusive) 597 * @param irn_upper upper bound (exclusive) 598 */ 599 FIRM_API ir_node *new_d_Bound(dbg_info *dbgi, ir_node * irn_mem, ir_node * irn_index, ir_node * irn_lower, ir_node * irn_upper); 600 601 /** 602 * Construct a Bound node. 603 * 604 * @param irn_mem memory dependency 605 * @param irn_index value to test 606 * @param irn_lower lower bound (inclusive) 607 * @param irn_upper upper bound (exclusive) 608 */ 609 FIRM_API ir_node *new_Bound(ir_node * irn_mem, ir_node * irn_index, ir_node * irn_lower, ir_node * irn_upper); 610 /** 611 * Test if node is a Bound 612 * @returns 1 if the node is a Bound node, 0 otherwise 613 */ 614 FIRM_API int is_Bound(const ir_node *node); 615 616 /** Returns mem input of a Bound node. */ 617 FIRM_API ir_node *get_Bound_mem(const ir_node *node); 618 /** Sets mem input of a Bound node. */ 619 FIRM_API void set_Bound_mem(ir_node *node, ir_node *mem); 620 /** Returns index input of a Bound node. */ 621 FIRM_API ir_node *get_Bound_index(const ir_node *node); 622 /** Sets index input of a Bound node. */ 623 FIRM_API void set_Bound_index(ir_node *node, ir_node *index); 624 /** Returns lower input of a Bound node. */ 625 FIRM_API ir_node *get_Bound_lower(const ir_node *node); 626 /** Sets lower input of a Bound node. */ 627 FIRM_API void set_Bound_lower(ir_node *node, ir_node *lower); 628 /** Returns upper input of a Bound node. */ 629 FIRM_API ir_node *get_Bound_upper(const ir_node *node); 630 /** Sets upper input of a Bound node. */ 631 FIRM_API void set_Bound_upper(ir_node *node, ir_node *upper); 632 /** @} */ 633 634 /** 635 * @defgroup Builtin Builtin node 636 * 637 * performs a backend-specific builtin. 638 * @{ 639 */ 640 641 /** 642 * Input numbers for Builtin node 643 */ 644 typedef enum { 645 n_Builtin_mem, 646 n_Builtin_max = n_Builtin_mem 647 } n_Builtin; 648 649 650 /** 651 * Projection numbers for result of Builtin node (use for Proj nodes) 652 */ 653 typedef enum { 654 pn_Builtin_M, /**< memory result */ 655 pn_Builtin_max = pn_Builtin_M 656 } pn_Builtin; 657 658 /** 659 * Construct a Builtin node. 660 * 661 * @param dbgi A pointer to debug information. 662 * @param block The IR block the node belongs to. 663 * @param irn_mem memory dependency 664 * @param arity size of additional inputs array 665 * @param in additional inputs 666 * @param kind kind of builtin 667 * @param type method type for the builtin call 668 */ 669 FIRM_API ir_node *new_rd_Builtin(dbg_info *dbgi, ir_node *block, ir_node * irn_mem, int arity, ir_node *const * in, ir_builtin_kind kind, ir_type* type); 670 671 /** 672 * Construct a Builtin node. 673 * 674 * @param block The IR block the node belongs to. 675 * @param irn_mem memory dependency 676 * @param arity size of additional inputs array 677 * @param in additional inputs 678 * @param kind kind of builtin 679 * @param type method type for the builtin call 680 */ 681 FIRM_API ir_node *new_r_Builtin(ir_node *block, ir_node * irn_mem, int arity, ir_node *const * in, ir_builtin_kind kind, ir_type* type); 682 683 /** 684 * Construct a Builtin node. 685 * 686 * @param dbgi A pointer to debug information. 687 * @param irn_mem memory dependency 688 * @param arity size of additional inputs array 689 * @param in additional inputs 690 * @param kind kind of builtin 691 * @param type method type for the builtin call 692 */ 693 FIRM_API ir_node *new_d_Builtin(dbg_info *dbgi, ir_node * irn_mem, int arity, ir_node *const * in, ir_builtin_kind kind, ir_type* type); 694 695 /** 696 * Construct a Builtin node. 697 * 698 * @param irn_mem memory dependency 699 * @param arity size of additional inputs array 700 * @param in additional inputs 701 * @param kind kind of builtin 702 * @param type method type for the builtin call 703 */ 704 FIRM_API ir_node *new_Builtin(ir_node * irn_mem, int arity, ir_node *const * in, ir_builtin_kind kind, ir_type* type); 705 /** 706 * Test if node is a Builtin 707 * @returns 1 if the node is a Builtin node, 0 otherwise 708 */ 709 FIRM_API int is_Builtin(const ir_node *node); 710 711 /** Returns mem input of a Builtin node. */ 712 FIRM_API ir_node *get_Builtin_mem(const ir_node *node); 713 /** Sets mem input of a Builtin node. */ 714 FIRM_API void set_Builtin_mem(ir_node *node, ir_node *mem); 715 /** Returns kind attribute of a Builtin node. */ 716 FIRM_API ir_builtin_kind get_Builtin_kind(const ir_node *node); 717 /** Sets kind attribute of a Builtin node. */ 718 FIRM_API void set_Builtin_kind(ir_node *node, ir_builtin_kind kind); 719 /** Returns type attribute of a Builtin node. */ 720 FIRM_API ir_type* get_Builtin_type(const ir_node *node); 721 /** Sets type attribute of a Builtin node. */ 722 FIRM_API void set_Builtin_type(ir_node *node, ir_type* type); 723 /** @} */ 724 725 /** 726 * @defgroup Call Call node 727 * 728 * Calls other code. Control flow is transfered to ptr, additional 729 operands are passed to the called code. Called code usually performs a 730 return operation. The operands of this return operation are the result 731 of the Call node. 732 * @{ 733 */ 734 735 /** 736 * Input numbers for Call node 737 */ 738 typedef enum { 739 n_Call_mem, 740 n_Call_ptr, 741 n_Call_max = n_Call_ptr 742 } n_Call; 743 744 745 /** 746 * Projection numbers for result of Call node (use for Proj nodes) 747 */ 748 typedef enum { 749 pn_Call_M, /**< memory result */ 750 pn_Call_T_result, /**< tuple containing all results */ 751 pn_Call_X_regular, /**< control flow when no exception occurs */ 752 pn_Call_X_except, /**< control flow when exception occured */ 753 pn_Call_max = pn_Call_X_except 754 } pn_Call; 755 756 /** 757 * Construct a Call node. 758 * 759 * @param dbgi A pointer to debug information. 760 * @param block The IR block the node belongs to. 761 * @param irn_mem memory dependency 762 * @param irn_ptr pointer to called code 763 * @param arity size of additional inputs array 764 * @param in additional inputs 765 * @param type type of the call (usually type of the called procedure) 766 */ 767 FIRM_API ir_node *new_rd_Call(dbg_info *dbgi, ir_node *block, ir_node * irn_mem, ir_node * irn_ptr, int arity, ir_node *const * in, ir_type* type); 768 769 /** 770 * Construct a Call node. 771 * 772 * @param block The IR block the node belongs to. 773 * @param irn_mem memory dependency 774 * @param irn_ptr pointer to called code 775 * @param arity size of additional inputs array 776 * @param in additional inputs 777 * @param type type of the call (usually type of the called procedure) 778 */ 779 FIRM_API ir_node *new_r_Call(ir_node *block, ir_node * irn_mem, ir_node * irn_ptr, int arity, ir_node *const * in, ir_type* type); 780 781 /** 782 * Construct a Call node. 783 * 784 * @param dbgi A pointer to debug information. 785 * @param irn_mem memory dependency 786 * @param irn_ptr pointer to called code 787 * @param arity size of additional inputs array 788 * @param in additional inputs 789 * @param type type of the call (usually type of the called procedure) 790 */ 791 FIRM_API ir_node *new_d_Call(dbg_info *dbgi, ir_node * irn_mem, ir_node * irn_ptr, int arity, ir_node *const * in, ir_type* type); 792 793 /** 794 * Construct a Call node. 795 * 796 * @param irn_mem memory dependency 797 * @param irn_ptr pointer to called code 798 * @param arity size of additional inputs array 799 * @param in additional inputs 800 * @param type type of the call (usually type of the called procedure) 801 */ 802 FIRM_API ir_node *new_Call(ir_node * irn_mem, ir_node * irn_ptr, int arity, ir_node *const * in, ir_type* type); 803 /** 804 * Test if node is a Call 805 * @returns 1 if the node is a Call node, 0 otherwise 806 */ 807 FIRM_API int is_Call(const ir_node *node); 808 809 /** Returns mem input of a Call node. */ 810 FIRM_API ir_node *get_Call_mem(const ir_node *node); 811 /** Sets mem input of a Call node. */ 812 FIRM_API void set_Call_mem(ir_node *node, ir_node *mem); 813 /** Returns ptr input of a Call node. */ 814 FIRM_API ir_node *get_Call_ptr(const ir_node *node); 815 /** Sets ptr input of a Call node. */ 816 FIRM_API void set_Call_ptr(ir_node *node, ir_node *ptr); 817 /** Returns type attribute of a Call node. */ 818 FIRM_API ir_type* get_Call_type(const ir_node *node); 819 /** Sets type attribute of a Call node. */ 820 FIRM_API void set_Call_type(ir_node *node, ir_type* type); 821 /** @} */ 822 823 /** 824 * @defgroup Carry Carry node 825 * 826 * Computes the value of the carry-bit that would result when adding the 2 827 operands 828 * @{ 829 */ 830 831 /** 832 * Input numbers for Carry node 833 */ 834 typedef enum { 835 n_Carry_left, 836 n_Carry_right, 837 n_Carry_max = n_Carry_right 838 } n_Carry; 839 840 841 /** 842 * Construct a Carry node. 843 * 844 * @param dbgi A pointer to debug information. 845 * @param block The IR block the node belongs to. 846 * @param irn_left first operand 847 * @param irn_right second operand 848 * @param mode mode of the operations result 849 */ 850 FIRM_API ir_node *new_rd_Carry(dbg_info *dbgi, ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 851 852 /** 853 * Construct a Carry node. 854 * 855 * @param block The IR block the node belongs to. 856 * @param irn_left first operand 857 * @param irn_right second operand 858 * @param mode mode of the operations result 859 */ 860 FIRM_API ir_node *new_r_Carry(ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 861 862 /** 863 * Construct a Carry node. 864 * 865 * @param dbgi A pointer to debug information. 866 * @param irn_left first operand 867 * @param irn_right second operand 868 * @param mode mode of the operations result 869 */ 870 FIRM_API ir_node *new_d_Carry(dbg_info *dbgi, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 871 872 /** 873 * Construct a Carry node. 874 * 875 * @param irn_left first operand 876 * @param irn_right second operand 877 * @param mode mode of the operations result 878 */ 879 FIRM_API ir_node *new_Carry(ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 880 /** 881 * Test if node is a Carry 882 * @returns 1 if the node is a Carry node, 0 otherwise 883 */ 884 FIRM_API int is_Carry(const ir_node *node); 885 886 /** Returns left input of a Carry node. */ 887 FIRM_API ir_node *get_Carry_left(const ir_node *node); 888 /** Sets left input of a Carry node. */ 889 FIRM_API void set_Carry_left(ir_node *node, ir_node *left); 890 /** Returns right input of a Carry node. */ 891 FIRM_API ir_node *get_Carry_right(const ir_node *node); 892 /** Sets right input of a Carry node. */ 893 FIRM_API void set_Carry_right(ir_node *node, ir_node *right); 894 /** @} */ 895 896 /** 897 * @defgroup Cast Cast node 898 * 899 * perform a high-level type cast 900 * @{ 901 */ 902 903 /** 904 * Input numbers for Cast node 905 */ 906 typedef enum { 907 n_Cast_op, 908 n_Cast_max = n_Cast_op 909 } n_Cast; 910 911 912 /** 913 * Construct a Cast node. 914 * 915 * @param dbgi A pointer to debug information. 916 * @param block The IR block the node belongs to. 917 * @param irn_op operand 918 * @param type target type of the case 919 */ 920 FIRM_API ir_node *new_rd_Cast(dbg_info *dbgi, ir_node *block, ir_node * irn_op, ir_type* type); 921 922 /** 923 * Construct a Cast node. 924 * 925 * @param block The IR block the node belongs to. 926 * @param irn_op operand 927 * @param type target type of the case 928 */ 929 FIRM_API ir_node *new_r_Cast(ir_node *block, ir_node * irn_op, ir_type* type); 930 931 /** 932 * Construct a Cast node. 933 * 934 * @param dbgi A pointer to debug information. 935 * @param irn_op operand 936 * @param type target type of the case 937 */ 938 FIRM_API ir_node *new_d_Cast(dbg_info *dbgi, ir_node * irn_op, ir_type* type); 939 940 /** 941 * Construct a Cast node. 942 * 943 * @param irn_op operand 944 * @param type target type of the case 945 */ 946 FIRM_API ir_node *new_Cast(ir_node * irn_op, ir_type* type); 947 /** 948 * Test if node is a Cast 949 * @returns 1 if the node is a Cast node, 0 otherwise 950 */ 951 FIRM_API int is_Cast(const ir_node *node); 952 953 /** Returns op input of a Cast node. */ 954 FIRM_API ir_node *get_Cast_op(const ir_node *node); 955 /** Sets op input of a Cast node. */ 956 FIRM_API void set_Cast_op(ir_node *node, ir_node *op); 957 /** Returns type attribute of a Cast node. */ 958 FIRM_API ir_type* get_Cast_type(const ir_node *node); 959 /** Sets type attribute of a Cast node. */ 960 FIRM_API void set_Cast_type(ir_node *node, ir_type* type); 961 /** @} */ 962 963 /** 964 * @defgroup Cmp Cmp node 965 * 966 * Compares its two operands and checks whether a specified 967 relation (like less or equal) is fulfilled. 968 * @{ 969 */ 970 971 /** 972 * Input numbers for Cmp node 973 */ 974 typedef enum { 975 n_Cmp_left, 976 n_Cmp_right, 977 n_Cmp_max = n_Cmp_right 978 } n_Cmp; 979 980 981 /** 982 * Construct a Cmp node. 983 * 984 * @param dbgi A pointer to debug information. 985 * @param block The IR block the node belongs to. 986 * @param irn_left first operand 987 * @param irn_right second operand 988 * @param relation Comparison relation 989 */ 990 FIRM_API ir_node *new_rd_Cmp(dbg_info *dbgi, ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_relation relation); 991 992 /** 993 * Construct a Cmp node. 994 * 995 * @param block The IR block the node belongs to. 996 * @param irn_left first operand 997 * @param irn_right second operand 998 * @param relation Comparison relation 999 */ 1000 FIRM_API ir_node *new_r_Cmp(ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_relation relation); 1001 1002 /** 1003 * Construct a Cmp node. 1004 * 1005 * @param dbgi A pointer to debug information. 1006 * @param irn_left first operand 1007 * @param irn_right second operand 1008 * @param relation Comparison relation 1009 */ 1010 FIRM_API ir_node *new_d_Cmp(dbg_info *dbgi, ir_node * irn_left, ir_node * irn_right, ir_relation relation); 1011 1012 /** 1013 * Construct a Cmp node. 1014 * 1015 * @param irn_left first operand 1016 * @param irn_right second operand 1017 * @param relation Comparison relation 1018 */ 1019 FIRM_API ir_node *new_Cmp(ir_node * irn_left, ir_node * irn_right, ir_relation relation); 1020 /** 1021 * Test if node is a Cmp 1022 * @returns 1 if the node is a Cmp node, 0 otherwise 1023 */ 1024 FIRM_API int is_Cmp(const ir_node *node); 1025 1026 /** Returns left input of a Cmp node. */ 1027 FIRM_API ir_node *get_Cmp_left(const ir_node *node); 1028 /** Sets left input of a Cmp node. */ 1029 FIRM_API void set_Cmp_left(ir_node *node, ir_node *left); 1030 /** Returns right input of a Cmp node. */ 1031 FIRM_API ir_node *get_Cmp_right(const ir_node *node); 1032 /** Sets right input of a Cmp node. */ 1033 FIRM_API void set_Cmp_right(ir_node *node, ir_node *right); 1034 /** Returns relation attribute of a Cmp node. */ 1035 FIRM_API ir_relation get_Cmp_relation(const ir_node *node); 1036 /** Sets relation attribute of a Cmp node. */ 1037 FIRM_API void set_Cmp_relation(ir_node *node, ir_relation relation); 1038 /** @} */ 1039 1040 /** 1041 * @defgroup Cond Cond node 1042 * 1043 * Conditionally change control flow. 1044 * @{ 1045 */ 1046 1047 /** 1048 * Input numbers for Cond node 1049 */ 1050 typedef enum { 1051 n_Cond_selector, 1052 n_Cond_max = n_Cond_selector 1053 } n_Cond; 1054 1055 1056 /** 1057 * Projection numbers for result of Cond node (use for Proj nodes) 1058 */ 1059 typedef enum { 1060 pn_Cond_false, /**< control flow if operand is "false" */ 1061 pn_Cond_true, /**< control flow if operand is "true" */ 1062 pn_Cond_max = pn_Cond_true 1063 } pn_Cond; 1064 1065 /** 1066 * Construct a Cond node. 1067 * 1068 * @param dbgi A pointer to debug information. 1069 * @param block The IR block the node belongs to. 1070 * @param irn_selector condition parameter 1071 */ 1072 FIRM_API ir_node *new_rd_Cond(dbg_info *dbgi, ir_node *block, ir_node * irn_selector); 1073 1074 /** 1075 * Construct a Cond node. 1076 * 1077 * @param block The IR block the node belongs to. 1078 * @param irn_selector condition parameter 1079 */ 1080 FIRM_API ir_node *new_r_Cond(ir_node *block, ir_node * irn_selector); 1081 1082 /** 1083 * Construct a Cond node. 1084 * 1085 * @param dbgi A pointer to debug information. 1086 * @param irn_selector condition parameter 1087 */ 1088 FIRM_API ir_node *new_d_Cond(dbg_info *dbgi, ir_node * irn_selector); 1089 1090 /** 1091 * Construct a Cond node. 1092 * 1093 * @param irn_selector condition parameter 1094 */ 1095 FIRM_API ir_node *new_Cond(ir_node * irn_selector); 1096 /** 1097 * Test if node is a Cond 1098 * @returns 1 if the node is a Cond node, 0 otherwise 1099 */ 1100 FIRM_API int is_Cond(const ir_node *node); 1101 1102 /** Returns selector input of a Cond node. */ 1103 FIRM_API ir_node *get_Cond_selector(const ir_node *node); 1104 /** Sets selector input of a Cond node. */ 1105 FIRM_API void set_Cond_selector(ir_node *node, ir_node *selector); 1106 /** Returns jmp_pred attribute of a Cond node. */ 1107 FIRM_API cond_jmp_predicate get_Cond_jmp_pred(const ir_node *node); 1108 /** Sets jmp_pred attribute of a Cond node. */ 1109 FIRM_API void set_Cond_jmp_pred(ir_node *node, cond_jmp_predicate jmp_pred); 1110 /** @} */ 1111 1112 /** 1113 * @defgroup Confirm Confirm node 1114 * 1115 * Specifies constraints for a value. This allows explicit representation 1116 of path-sensitive properties. (Example: This value is always >= 0 on 1 1117 if-branch then all users within that branch are rerouted to a confirm-node 1118 specifying this property). 1119 1120 A constraint is specified for the relation between value and bound. 1121 value is always returned. 1122 Note that this node does NOT check or assert the constraint, it merely 1123 specifies it. 1124 * @{ 1125 */ 1126 1127 /** 1128 * Input numbers for Confirm node 1129 */ 1130 typedef enum { 1131 n_Confirm_value, 1132 n_Confirm_bound, 1133 n_Confirm_max = n_Confirm_bound 1134 } n_Confirm; 1135 1136 1137 /** 1138 * Construct a Confirm node. 1139 * 1140 * @param dbgi A pointer to debug information. 1141 * @param block The IR block the node belongs to. 1142 * @param irn_value value to express a constraint for 1143 * @param irn_bound value to compare against 1144 * @param relation relation of value to bound 1145 */ 1146 FIRM_API ir_node *new_rd_Confirm(dbg_info *dbgi, ir_node *block, ir_node * irn_value, ir_node * irn_bound, ir_relation relation); 1147 1148 /** 1149 * Construct a Confirm node. 1150 * 1151 * @param block The IR block the node belongs to. 1152 * @param irn_value value to express a constraint for 1153 * @param irn_bound value to compare against 1154 * @param relation relation of value to bound 1155 */ 1156 FIRM_API ir_node *new_r_Confirm(ir_node *block, ir_node * irn_value, ir_node * irn_bound, ir_relation relation); 1157 1158 /** 1159 * Construct a Confirm node. 1160 * 1161 * @param dbgi A pointer to debug information. 1162 * @param irn_value value to express a constraint for 1163 * @param irn_bound value to compare against 1164 * @param relation relation of value to bound 1165 */ 1166 FIRM_API ir_node *new_d_Confirm(dbg_info *dbgi, ir_node * irn_value, ir_node * irn_bound, ir_relation relation); 1167 1168 /** 1169 * Construct a Confirm node. 1170 * 1171 * @param irn_value value to express a constraint for 1172 * @param irn_bound value to compare against 1173 * @param relation relation of value to bound 1174 */ 1175 FIRM_API ir_node *new_Confirm(ir_node * irn_value, ir_node * irn_bound, ir_relation relation); 1176 /** 1177 * Test if node is a Confirm 1178 * @returns 1 if the node is a Confirm node, 0 otherwise 1179 */ 1180 FIRM_API int is_Confirm(const ir_node *node); 1181 1182 /** Returns value input of a Confirm node. */ 1183 FIRM_API ir_node *get_Confirm_value(const ir_node *node); 1184 /** Sets value input of a Confirm node. */ 1185 FIRM_API void set_Confirm_value(ir_node *node, ir_node *value); 1186 /** Returns bound input of a Confirm node. */ 1187 FIRM_API ir_node *get_Confirm_bound(const ir_node *node); 1188 /** Sets bound input of a Confirm node. */ 1189 FIRM_API void set_Confirm_bound(ir_node *node, ir_node *bound); 1190 /** Returns relation attribute of a Confirm node. */ 1191 FIRM_API ir_relation get_Confirm_relation(const ir_node *node); 1192 /** Sets relation attribute of a Confirm node. */ 1193 FIRM_API void set_Confirm_relation(ir_node *node, ir_relation relation); 1194 /** @} */ 1195 1196 /** 1197 * @defgroup Const Const node 1198 * 1199 * Returns a constant value. 1200 * @{ 1201 */ 1202 1203 1204 /** 1205 * Construct a Const node. 1206 * 1207 * @param dbgi A pointer to debug information. 1208 * @param irg The IR graph the node belongs to. 1209 * @param tarval constant value (a tarval object) 1210 */ 1211 FIRM_API ir_node *new_rd_Const(dbg_info *dbgi, ir_graph *irg, ir_tarval* tarval); 1212 1213 /** 1214 * Construct a Const node. 1215 * 1216 * @param irg The IR graph the node belongs to. 1217 * @param tarval constant value (a tarval object) 1218 */ 1219 FIRM_API ir_node *new_r_Const(ir_graph *irg, ir_tarval* tarval); 1220 1221 /** 1222 * Construct a Const node. 1223 * 1224 * @param dbgi A pointer to debug information. 1225 * @param tarval constant value (a tarval object) 1226 */ 1227 FIRM_API ir_node *new_d_Const(dbg_info *dbgi, ir_tarval* tarval); 1228 1229 /** 1230 * Construct a Const node. 1231 * 1232 * @param tarval constant value (a tarval object) 1233 */ 1234 FIRM_API ir_node *new_Const(ir_tarval* tarval); 1235 /** 1236 * Test if node is a Const 1237 * @returns 1 if the node is a Const node, 0 otherwise 1238 */ 1239 FIRM_API int is_Const(const ir_node *node); 1240 1241 /** Returns tarval attribute of a Const node. */ 1242 FIRM_API ir_tarval* get_Const_tarval(const ir_node *node); 1243 /** Sets tarval attribute of a Const node. */ 1244 FIRM_API void set_Const_tarval(ir_node *node, ir_tarval* tarval); 1245 /** @} */ 1246 1247 /** 1248 * @defgroup Conv Conv node 1249 * 1250 * Converts values between modes 1251 * @{ 1252 */ 1253 1254 /** 1255 * Input numbers for Conv node 1256 */ 1257 typedef enum { 1258 n_Conv_op, 1259 n_Conv_max = n_Conv_op 1260 } n_Conv; 1261 1262 1263 /** 1264 * Construct a Conv node. 1265 * 1266 * @param dbgi A pointer to debug information. 1267 * @param block The IR block the node belongs to. 1268 * @param irn_op operand 1269 * @param mode mode of the operations result 1270 */ 1271 FIRM_API ir_node *new_rd_Conv(dbg_info *dbgi, ir_node *block, ir_node * irn_op, ir_mode * mode); 1272 1273 /** 1274 * Construct a Conv node. 1275 * 1276 * @param block The IR block the node belongs to. 1277 * @param irn_op operand 1278 * @param mode mode of the operations result 1279 */ 1280 FIRM_API ir_node *new_r_Conv(ir_node *block, ir_node * irn_op, ir_mode * mode); 1281 1282 /** 1283 * Construct a Conv node. 1284 * 1285 * @param dbgi A pointer to debug information. 1286 * @param irn_op operand 1287 * @param mode mode of the operations result 1288 */ 1289 FIRM_API ir_node *new_d_Conv(dbg_info *dbgi, ir_node * irn_op, ir_mode * mode); 1290 1291 /** 1292 * Construct a Conv node. 1293 * 1294 * @param irn_op operand 1295 * @param mode mode of the operations result 1296 */ 1297 FIRM_API ir_node *new_Conv(ir_node * irn_op, ir_mode * mode); 1298 /** 1299 * Test if node is a Conv 1300 * @returns 1 if the node is a Conv node, 0 otherwise 1301 */ 1302 FIRM_API int is_Conv(const ir_node *node); 1303 1304 /** Returns op input of a Conv node. */ 1305 FIRM_API ir_node *get_Conv_op(const ir_node *node); 1306 /** Sets op input of a Conv node. */ 1307 FIRM_API void set_Conv_op(ir_node *node, ir_node *op); 1308 /** @} */ 1309 1310 /** 1311 * @defgroup CopyB CopyB node 1312 * 1313 * Copies a block of memory with statically known size/type. 1314 * @{ 1315 */ 1316 1317 /** 1318 * Input numbers for CopyB node 1319 */ 1320 typedef enum { 1321 n_CopyB_mem, 1322 n_CopyB_dst, 1323 n_CopyB_src, 1324 n_CopyB_max = n_CopyB_src 1325 } n_CopyB; 1326 1327 1328 /** 1329 * Projection numbers for result of CopyB node (use for Proj nodes) 1330 */ 1331 typedef enum { 1332 pn_CopyB_M, /**< memory result */ 1333 pn_CopyB_X_regular, /**< control flow when no exception occurs */ 1334 pn_CopyB_X_except, /**< control flow when exception occured */ 1335 pn_CopyB_max = pn_CopyB_X_except 1336 } pn_CopyB; 1337 1338 /** 1339 * Construct a CopyB node. 1340 * 1341 * @param dbgi A pointer to debug information. 1342 * @param block The IR block the node belongs to. 1343 * @param irn_mem memory dependency 1344 * @param irn_dst destination address 1345 * @param irn_src source address 1346 * @param type type of copied data 1347 */ 1348 FIRM_API ir_node *new_rd_CopyB(dbg_info *dbgi, ir_node *block, ir_node * irn_mem, ir_node * irn_dst, ir_node * irn_src, ir_type* type); 1349 1350 /** 1351 * Construct a CopyB node. 1352 * 1353 * @param block The IR block the node belongs to. 1354 * @param irn_mem memory dependency 1355 * @param irn_dst destination address 1356 * @param irn_src source address 1357 * @param type type of copied data 1358 */ 1359 FIRM_API ir_node *new_r_CopyB(ir_node *block, ir_node * irn_mem, ir_node * irn_dst, ir_node * irn_src, ir_type* type); 1360 1361 /** 1362 * Construct a CopyB node. 1363 * 1364 * @param dbgi A pointer to debug information. 1365 * @param irn_mem memory dependency 1366 * @param irn_dst destination address 1367 * @param irn_src source address 1368 * @param type type of copied data 1369 */ 1370 FIRM_API ir_node *new_d_CopyB(dbg_info *dbgi, ir_node * irn_mem, ir_node * irn_dst, ir_node * irn_src, ir_type* type); 1371 1372 /** 1373 * Construct a CopyB node. 1374 * 1375 * @param irn_mem memory dependency 1376 * @param irn_dst destination address 1377 * @param irn_src source address 1378 * @param type type of copied data 1379 */ 1380 FIRM_API ir_node *new_CopyB(ir_node * irn_mem, ir_node * irn_dst, ir_node * irn_src, ir_type* type); 1381 /** 1382 * Test if node is a CopyB 1383 * @returns 1 if the node is a CopyB node, 0 otherwise 1384 */ 1385 FIRM_API int is_CopyB(const ir_node *node); 1386 1387 /** Returns mem input of a CopyB node. */ 1388 FIRM_API ir_node *get_CopyB_mem(const ir_node *node); 1389 /** Sets mem input of a CopyB node. */ 1390 FIRM_API void set_CopyB_mem(ir_node *node, ir_node *mem); 1391 /** Returns dst input of a CopyB node. */ 1392 FIRM_API ir_node *get_CopyB_dst(const ir_node *node); 1393 /** Sets dst input of a CopyB node. */ 1394 FIRM_API void set_CopyB_dst(ir_node *node, ir_node *dst); 1395 /** Returns src input of a CopyB node. */ 1396 FIRM_API ir_node *get_CopyB_src(const ir_node *node); 1397 /** Sets src input of a CopyB node. */ 1398 FIRM_API void set_CopyB_src(ir_node *node, ir_node *src); 1399 /** Returns type attribute of a CopyB node. */ 1400 FIRM_API ir_type* get_CopyB_type(const ir_node *node); 1401 /** Sets type attribute of a CopyB node. */ 1402 FIRM_API void set_CopyB_type(ir_node *node, ir_type* type); 1403 /** @} */ 1404 1405 /** 1406 * @defgroup Deleted Deleted node 1407 * 1408 * Internal node which is temporary set to nodes which are already removed 1409 from the graph. 1410 * @{ 1411 */ 1412 1413 1414 /** 1415 * Test if node is a Deleted 1416 * @returns 1 if the node is a Deleted node, 0 otherwise 1417 */ 1418 FIRM_API int is_Deleted(const ir_node *node); 1419 1420 /** @} */ 1421 1422 /** 1423 * @defgroup Div Div node 1424 * 1425 * returns the quotient of its 2 operands 1426 * @{ 1427 */ 1428 1429 /** 1430 * Input numbers for Div node 1431 */ 1432 typedef enum { 1433 n_Div_mem, 1434 n_Div_left, 1435 n_Div_right, 1436 n_Div_max = n_Div_right 1437 } n_Div; 1438 1439 1440 /** 1441 * Projection numbers for result of Div node (use for Proj nodes) 1442 */ 1443 typedef enum { 1444 pn_Div_M, /**< memory result */ 1445 pn_Div_res, /**< result of computation */ 1446 pn_Div_X_regular, /**< control flow when no exception occurs */ 1447 pn_Div_X_except, /**< control flow when exception occured */ 1448 pn_Div_max = pn_Div_X_except 1449 } pn_Div; 1450 1451 /** 1452 * Construct a Div node. 1453 * 1454 * @param dbgi A pointer to debug information. 1455 * @param block The IR block the node belongs to. 1456 * @param irn_mem memory dependency 1457 * @param irn_left first operand 1458 * @param irn_right second operand 1459 * @param resmode mode of the result value 1460 * @param pin_state pinned state 1461 */ 1462 FIRM_API ir_node *new_rd_Div(dbg_info *dbgi, ir_node *block, ir_node * irn_mem, ir_node * irn_left, ir_node * irn_right, ir_mode* resmode, op_pin_state pin_state); 1463 1464 /** 1465 * Construct a Div node. 1466 * 1467 * @param block The IR block the node belongs to. 1468 * @param irn_mem memory dependency 1469 * @param irn_left first operand 1470 * @param irn_right second operand 1471 * @param resmode mode of the result value 1472 * @param pin_state pinned state 1473 */ 1474 FIRM_API ir_node *new_r_Div(ir_node *block, ir_node * irn_mem, ir_node * irn_left, ir_node * irn_right, ir_mode* resmode, op_pin_state pin_state); 1475 1476 /** 1477 * Construct a Div node. 1478 * 1479 * @param dbgi A pointer to debug information. 1480 * @param irn_mem memory dependency 1481 * @param irn_left first operand 1482 * @param irn_right second operand 1483 * @param resmode mode of the result value 1484 * @param pin_state pinned state 1485 */ 1486 FIRM_API ir_node *new_d_Div(dbg_info *dbgi, ir_node * irn_mem, ir_node * irn_left, ir_node * irn_right, ir_mode* resmode, op_pin_state pin_state); 1487 1488 /** 1489 * Construct a Div node. 1490 * 1491 * @param irn_mem memory dependency 1492 * @param irn_left first operand 1493 * @param irn_right second operand 1494 * @param resmode mode of the result value 1495 * @param pin_state pinned state 1496 */ 1497 FIRM_API ir_node *new_Div(ir_node * irn_mem, ir_node * irn_left, ir_node * irn_right, ir_mode* resmode, op_pin_state pin_state); 1498 /** 1499 * Test if node is a Div 1500 * @returns 1 if the node is a Div node, 0 otherwise 1501 */ 1502 FIRM_API int is_Div(const ir_node *node); 1503 1504 /** Returns mem input of a Div node. */ 1505 FIRM_API ir_node *get_Div_mem(const ir_node *node); 1506 /** Sets mem input of a Div node. */ 1507 FIRM_API void set_Div_mem(ir_node *node, ir_node *mem); 1508 /** Returns left input of a Div node. */ 1509 FIRM_API ir_node *get_Div_left(const ir_node *node); 1510 /** Sets left input of a Div node. */ 1511 FIRM_API void set_Div_left(ir_node *node, ir_node *left); 1512 /** Returns right input of a Div node. */ 1513 FIRM_API ir_node *get_Div_right(const ir_node *node); 1514 /** Sets right input of a Div node. */ 1515 FIRM_API void set_Div_right(ir_node *node, ir_node *right); 1516 /** Returns resmode attribute of a Div node. */ 1517 FIRM_API ir_mode* get_Div_resmode(const ir_node *node); 1518 /** Sets resmode attribute of a Div node. */ 1519 FIRM_API void set_Div_resmode(ir_node *node, ir_mode* resmode); 1520 /** Returns no_remainder attribute of a Div node. */ 1521 FIRM_API int get_Div_no_remainder(const ir_node *node); 1522 /** Sets no_remainder attribute of a Div node. */ 1523 FIRM_API void set_Div_no_remainder(ir_node *node, int no_remainder); 1524 /** @} */ 1525 1526 /** 1527 * @defgroup Dummy Dummy node 1528 * 1529 * A placeholder value. This is used when constructing cyclic graphs where 1530 you have cases where not all predecessors of a phi-node are known. Dummy 1531 nodes are used for the unknown predecessors and replaced later. 1532 * @{ 1533 */ 1534 1535 1536 /** 1537 * Construct a Dummy node. 1538 * 1539 * @param dbgi A pointer to debug information. 1540 * @param irg The IR graph the node belongs to. 1541 * @param mode mode of the operations result 1542 */ 1543 FIRM_API ir_node *new_rd_Dummy(dbg_info *dbgi, ir_graph *irg, ir_mode * mode); 1544 1545 /** 1546 * Construct a Dummy node. 1547 * 1548 * @param irg The IR graph the node belongs to. 1549 * @param mode mode of the operations result 1550 */ 1551 FIRM_API ir_node *new_r_Dummy(ir_graph *irg, ir_mode * mode); 1552 1553 /** 1554 * Construct a Dummy node. 1555 * 1556 * @param dbgi A pointer to debug information. 1557 * @param mode mode of the operations result 1558 */ 1559 FIRM_API ir_node *new_d_Dummy(dbg_info *dbgi, ir_mode * mode); 1560 1561 /** 1562 * Construct a Dummy node. 1563 * 1564 * @param mode mode of the operations result 1565 */ 1566 FIRM_API ir_node *new_Dummy(ir_mode * mode); 1567 /** 1568 * Test if node is a Dummy 1569 * @returns 1 if the node is a Dummy node, 0 otherwise 1570 */ 1571 FIRM_API int is_Dummy(const ir_node *node); 1572 1573 /** @} */ 1574 1575 /** 1576 * @defgroup End End node 1577 * 1578 * Last node of a graph. It references nodes in endless loops (so called 1579 keepalive edges) 1580 * @{ 1581 */ 1582 1583 1584 /** 1585 * Construct an End node. 1586 * 1587 * @param dbgi A pointer to debug information. 1588 * @param irg The IR graph the node belongs to. 1589 * @param arity size of additional inputs array 1590 * @param in additional inputs 1591 */ 1592 FIRM_API ir_node *new_rd_End(dbg_info *dbgi, ir_graph *irg, int arity, ir_node *const * in); 1593 1594 /** 1595 * Construct an End node. 1596 * 1597 * @param irg The IR graph the node belongs to. 1598 * @param arity size of additional inputs array 1599 * @param in additional inputs 1600 */ 1601 FIRM_API ir_node *new_r_End(ir_graph *irg, int arity, ir_node *const * in); 1602 1603 /** 1604 * Construct an End node. 1605 * 1606 * @param dbgi A pointer to debug information. 1607 * @param arity size of additional inputs array 1608 * @param in additional inputs 1609 */ 1610 FIRM_API ir_node *new_d_End(dbg_info *dbgi, int arity, ir_node *const * in); 1611 1612 /** 1613 * Construct an End node. 1614 * 1615 * @param arity size of additional inputs array 1616 * @param in additional inputs 1617 */ 1618 FIRM_API ir_node *new_End(int arity, ir_node *const * in); 1619 /** 1620 * Test if node is a End 1621 * @returns 1 if the node is a End node, 0 otherwise 1622 */ 1623 FIRM_API int is_End(const ir_node *node); 1624 1625 /** @} */ 1626 1627 /** 1628 * @defgroup Eor Eor node 1629 * 1630 * returns the result of a bitwise exclusive or operation of its operands. 1631 1632 This is also known as the Xor operation. 1633 * @{ 1634 */ 1635 1636 /** 1637 * Input numbers for Eor node 1638 */ 1639 typedef enum { 1640 n_Eor_left, 1641 n_Eor_right, 1642 n_Eor_max = n_Eor_right 1643 } n_Eor; 1644 1645 1646 /** 1647 * Construct an Eor node. 1648 * 1649 * @param dbgi A pointer to debug information. 1650 * @param block The IR block the node belongs to. 1651 * @param irn_left first operand 1652 * @param irn_right second operand 1653 * @param mode mode of the operations result 1654 */ 1655 FIRM_API ir_node *new_rd_Eor(dbg_info *dbgi, ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 1656 1657 /** 1658 * Construct an Eor node. 1659 * 1660 * @param block The IR block the node belongs to. 1661 * @param irn_left first operand 1662 * @param irn_right second operand 1663 * @param mode mode of the operations result 1664 */ 1665 FIRM_API ir_node *new_r_Eor(ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 1666 1667 /** 1668 * Construct an Eor node. 1669 * 1670 * @param dbgi A pointer to debug information. 1671 * @param irn_left first operand 1672 * @param irn_right second operand 1673 * @param mode mode of the operations result 1674 */ 1675 FIRM_API ir_node *new_d_Eor(dbg_info *dbgi, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 1676 1677 /** 1678 * Construct an Eor node. 1679 * 1680 * @param irn_left first operand 1681 * @param irn_right second operand 1682 * @param mode mode of the operations result 1683 */ 1684 FIRM_API ir_node *new_Eor(ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 1685 /** 1686 * Test if node is a Eor 1687 * @returns 1 if the node is a Eor node, 0 otherwise 1688 */ 1689 FIRM_API int is_Eor(const ir_node *node); 1690 1691 /** Returns left input of an Eor node. */ 1692 FIRM_API ir_node *get_Eor_left(const ir_node *node); 1693 /** Sets left input of an Eor node. */ 1694 FIRM_API void set_Eor_left(ir_node *node, ir_node *left); 1695 /** Returns right input of an Eor node. */ 1696 FIRM_API ir_node *get_Eor_right(const ir_node *node); 1697 /** Sets right input of an Eor node. */ 1698 FIRM_API void set_Eor_right(ir_node *node, ir_node *right); 1699 /** @} */ 1700 1701 /** 1702 * @defgroup Free Free node 1703 * 1704 * Frees a block of memory previously allocated by an Alloc node 1705 * @{ 1706 */ 1707 1708 /** 1709 * Input numbers for Free node 1710 */ 1711 typedef enum { 1712 n_Free_mem, 1713 n_Free_ptr, 1714 n_Free_count, 1715 n_Free_max = n_Free_count 1716 } n_Free; 1717 1718 1719 /** 1720 * Construct a Free node. 1721 * 1722 * @param dbgi A pointer to debug information. 1723 * @param block The IR block the node belongs to. 1724 * @param irn_mem memory dependency 1725 * @param irn_ptr pointer to the object to free 1726 * @param irn_count number of objects to allocate 1727 * @param type type of the allocated variable 1728 * @param where whether allocation was on the stack or heap 1729 */ 1730 FIRM_API ir_node *new_rd_Free(dbg_info *dbgi, ir_node *block, ir_node * irn_mem, ir_node * irn_ptr, ir_node * irn_count, ir_type* type, ir_where_alloc where); 1731 1732 /** 1733 * Construct a Free node. 1734 * 1735 * @param block The IR block the node belongs to. 1736 * @param irn_mem memory dependency 1737 * @param irn_ptr pointer to the object to free 1738 * @param irn_count number of objects to allocate 1739 * @param type type of the allocated variable 1740 * @param where whether allocation was on the stack or heap 1741 */ 1742 FIRM_API ir_node *new_r_Free(ir_node *block, ir_node * irn_mem, ir_node * irn_ptr, ir_node * irn_count, ir_type* type, ir_where_alloc where); 1743 1744 /** 1745 * Construct a Free node. 1746 * 1747 * @param dbgi A pointer to debug information. 1748 * @param irn_mem memory dependency 1749 * @param irn_ptr pointer to the object to free 1750 * @param irn_count number of objects to allocate 1751 * @param type type of the allocated variable 1752 * @param where whether allocation was on the stack or heap 1753 */ 1754 FIRM_API ir_node *new_d_Free(dbg_info *dbgi, ir_node * irn_mem, ir_node * irn_ptr, ir_node * irn_count, ir_type* type, ir_where_alloc where); 1755 1756 /** 1757 * Construct a Free node. 1758 * 1759 * @param irn_mem memory dependency 1760 * @param irn_ptr pointer to the object to free 1761 * @param irn_count number of objects to allocate 1762 * @param type type of the allocated variable 1763 * @param where whether allocation was on the stack or heap 1764 */ 1765 FIRM_API ir_node *new_Free(ir_node * irn_mem, ir_node * irn_ptr, ir_node * irn_count, ir_type* type, ir_where_alloc where); 1766 /** 1767 * Test if node is a Free 1768 * @returns 1 if the node is a Free node, 0 otherwise 1769 */ 1770 FIRM_API int is_Free(const ir_node *node); 1771 1772 /** Returns mem input of a Free node. */ 1773 FIRM_API ir_node *get_Free_mem(const ir_node *node); 1774 /** Sets mem input of a Free node. */ 1775 FIRM_API void set_Free_mem(ir_node *node, ir_node *mem); 1776 /** Returns ptr input of a Free node. */ 1777 FIRM_API ir_node *get_Free_ptr(const ir_node *node); 1778 /** Sets ptr input of a Free node. */ 1779 FIRM_API void set_Free_ptr(ir_node *node, ir_node *ptr); 1780 /** Returns count input of a Free node. */ 1781 FIRM_API ir_node *get_Free_count(const ir_node *node); 1782 /** Sets count input of a Free node. */ 1783 FIRM_API void set_Free_count(ir_node *node, ir_node *count); 1784 /** Returns type attribute of a Free node. */ 1785 FIRM_API ir_type* get_Free_type(const ir_node *node); 1786 /** Sets type attribute of a Free node. */ 1787 FIRM_API void set_Free_type(ir_node *node, ir_type* type); 1788 /** Returns where attribute of a Free node. */ 1789 FIRM_API ir_where_alloc get_Free_where(const ir_node *node); 1790 /** Sets where attribute of a Free node. */ 1791 FIRM_API void set_Free_where(ir_node *node, ir_where_alloc where); 1792 /** @} */ 1793 1794 /** 1795 * @defgroup IJmp IJmp node 1796 * 1797 * Jumps to the code in its argument. The code has to be in the same 1798 function and the the destination must be one of the blocks reachable 1799 by the tuple results 1800 * @{ 1801 */ 1802 1803 /** 1804 * Input numbers for IJmp node 1805 */ 1806 typedef enum { 1807 n_IJmp_target, 1808 n_IJmp_max = n_IJmp_target 1809 } n_IJmp; 1810 1811 1812 /** 1813 * Construct an IJmp node. 1814 * 1815 * @param dbgi A pointer to debug information. 1816 * @param block The IR block the node belongs to. 1817 * @param irn_target target address of the jump 1818 */ 1819 FIRM_API ir_node *new_rd_IJmp(dbg_info *dbgi, ir_node *block, ir_node * irn_target); 1820 1821 /** 1822 * Construct an IJmp node. 1823 * 1824 * @param block The IR block the node belongs to. 1825 * @param irn_target target address of the jump 1826 */ 1827 FIRM_API ir_node *new_r_IJmp(ir_node *block, ir_node * irn_target); 1828 1829 /** 1830 * Construct an IJmp node. 1831 * 1832 * @param dbgi A pointer to debug information. 1833 * @param irn_target target address of the jump 1834 */ 1835 FIRM_API ir_node *new_d_IJmp(dbg_info *dbgi, ir_node * irn_target); 1836 1837 /** 1838 * Construct an IJmp node. 1839 * 1840 * @param irn_target target address of the jump 1841 */ 1842 FIRM_API ir_node *new_IJmp(ir_node * irn_target); 1843 /** 1844 * Test if node is a IJmp 1845 * @returns 1 if the node is a IJmp node, 0 otherwise 1846 */ 1847 FIRM_API int is_IJmp(const ir_node *node); 1848 1849 /** Returns target input of an IJmp node. */ 1850 FIRM_API ir_node *get_IJmp_target(const ir_node *node); 1851 /** Sets target input of an IJmp node. */ 1852 FIRM_API void set_IJmp_target(ir_node *node, ir_node *target); 1853 /** @} */ 1854 1855 /** 1856 * @defgroup Id Id node 1857 * 1858 * Returns its operand unchanged. 1859 1860 This is mainly used when exchanging nodes. Usually you shouldn't see Id 1861 nodes since the getters/setters for node inputs skip them automatically. 1862 * @{ 1863 */ 1864 1865 /** 1866 * Input numbers for Id node 1867 */ 1868 typedef enum { 1869 n_Id_pred, 1870 n_Id_max = n_Id_pred 1871 } n_Id; 1872 1873 1874 /** 1875 * Construct an Id node. 1876 * 1877 * @param dbgi A pointer to debug information. 1878 * @param block The IR block the node belongs to. 1879 * @param irn_pred the value which is returned unchanged 1880 * @param mode mode of the operations result 1881 */ 1882 FIRM_API ir_node *new_rd_Id(dbg_info *dbgi, ir_node *block, ir_node * irn_pred, ir_mode * mode); 1883 1884 /** 1885 * Construct an Id node. 1886 * 1887 * @param block The IR block the node belongs to. 1888 * @param irn_pred the value which is returned unchanged 1889 * @param mode mode of the operations result 1890 */ 1891 FIRM_API ir_node *new_r_Id(ir_node *block, ir_node * irn_pred, ir_mode * mode); 1892 1893 /** 1894 * Construct an Id node. 1895 * 1896 * @param dbgi A pointer to debug information. 1897 * @param irn_pred the value which is returned unchanged 1898 * @param mode mode of the operations result 1899 */ 1900 FIRM_API ir_node *new_d_Id(dbg_info *dbgi, ir_node * irn_pred, ir_mode * mode); 1901 1902 /** 1903 * Construct an Id node. 1904 * 1905 * @param irn_pred the value which is returned unchanged 1906 * @param mode mode of the operations result 1907 */ 1908 FIRM_API ir_node *new_Id(ir_node * irn_pred, ir_mode * mode); 1909 /** 1910 * Test if node is a Id 1911 * @returns 1 if the node is a Id node, 0 otherwise 1912 */ 1913 FIRM_API int is_Id(const ir_node *node); 1914 1915 /** Returns pred input of an Id node. */ 1916 FIRM_API ir_node *get_Id_pred(const ir_node *node); 1917 /** Sets pred input of an Id node. */ 1918 FIRM_API void set_Id_pred(ir_node *node, ir_node *pred); 1919 /** @} */ 1920 1921 /** 1922 * @defgroup InstOf InstOf node 1923 * 1924 * Tests whether an object is an instance of a class-type 1925 * @{ 1926 */ 1927 1928 /** 1929 * Input numbers for InstOf node 1930 */ 1931 typedef enum { 1932 n_InstOf_store, 1933 n_InstOf_obj, 1934 n_InstOf_max = n_InstOf_obj 1935 } n_InstOf; 1936 1937 1938 /** 1939 * Projection numbers for result of InstOf node (use for Proj nodes) 1940 */ 1941 typedef enum { 1942 pn_InstOf_M, /**< memory result */ 1943 pn_InstOf_res, /**< checked object pointer */ 1944 pn_InstOf_X_regular, /**< control flow when no exception occurs */ 1945 pn_InstOf_X_except, /**< control flow when exception occured */ 1946 pn_InstOf_max = pn_InstOf_X_except 1947 } pn_InstOf; 1948 1949 /** 1950 * Construct an InstOf node. 1951 * 1952 * @param dbgi A pointer to debug information. 1953 * @param block The IR block the node belongs to. 1954 * @param irn_store memory dependency 1955 * @param irn_obj pointer to object being queried 1956 * @param type type to check ptr for 1957 */ 1958 FIRM_API ir_node *new_rd_InstOf(dbg_info *dbgi, ir_node *block, ir_node * irn_store, ir_node * irn_obj, ir_type* type); 1959 1960 /** 1961 * Construct an InstOf node. 1962 * 1963 * @param block The IR block the node belongs to. 1964 * @param irn_store memory dependency 1965 * @param irn_obj pointer to object being queried 1966 * @param type type to check ptr for 1967 */ 1968 FIRM_API ir_node *new_r_InstOf(ir_node *block, ir_node * irn_store, ir_node * irn_obj, ir_type* type); 1969 1970 /** 1971 * Construct an InstOf node. 1972 * 1973 * @param dbgi A pointer to debug information. 1974 * @param irn_store memory dependency 1975 * @param irn_obj pointer to object being queried 1976 * @param type type to check ptr for 1977 */ 1978 FIRM_API ir_node *new_d_InstOf(dbg_info *dbgi, ir_node * irn_store, ir_node * irn_obj, ir_type* type); 1979 1980 /** 1981 * Construct an InstOf node. 1982 * 1983 * @param irn_store memory dependency 1984 * @param irn_obj pointer to object being queried 1985 * @param type type to check ptr for 1986 */ 1987 FIRM_API ir_node *new_InstOf(ir_node * irn_store, ir_node * irn_obj, ir_type* type); 1988 /** 1989 * Test if node is a InstOf 1990 * @returns 1 if the node is a InstOf node, 0 otherwise 1991 */ 1992 FIRM_API int is_InstOf(const ir_node *node); 1993 1994 /** Returns store input of an InstOf node. */ 1995 FIRM_API ir_node *get_InstOf_store(const ir_node *node); 1996 /** Sets store input of an InstOf node. */ 1997 FIRM_API void set_InstOf_store(ir_node *node, ir_node *store); 1998 /** Returns obj input of an InstOf node. */ 1999 FIRM_API ir_node *get_InstOf_obj(const ir_node *node); 2000 /** Sets obj input of an InstOf node. */ 2001 FIRM_API void set_InstOf_obj(ir_node *node, ir_node *obj); 2002 /** Returns type attribute of an InstOf node. */ 2003 FIRM_API ir_type* get_InstOf_type(const ir_node *node); 2004 /** Sets type attribute of an InstOf node. */ 2005 FIRM_API void set_InstOf_type(ir_node *node, ir_type* type); 2006 /** @} */ 2007 2008 /** 2009 * @defgroup Jmp Jmp node 2010 * 2011 * Jumps to the block connected through the out-value 2012 * @{ 2013 */ 2014 2015 2016 /** 2017 * Construct a Jmp node. 2018 * 2019 * @param dbgi A pointer to debug information. 2020 * @param block The IR block the node belongs to. 2021 */ 2022 FIRM_API ir_node *new_rd_Jmp(dbg_info *dbgi, ir_node *block); 2023 2024 /** 2025 * Construct a Jmp node. 2026 * 2027 * @param block The IR block the node belongs to. 2028 */ 2029 FIRM_API ir_node *new_r_Jmp(ir_node *block); 2030 2031 /** 2032 * Construct a Jmp node. 2033 * 2034 * @param dbgi A pointer to debug information. 2035 */ 2036 FIRM_API ir_node *new_d_Jmp(dbg_info *dbgi); 2037 2038 /** 2039 * Construct a Jmp node. 2040 * 2041 */ 2042 FIRM_API ir_node *new_Jmp(void); 2043 /** 2044 * Test if node is a Jmp 2045 * @returns 1 if the node is a Jmp node, 0 otherwise 2046 */ 2047 FIRM_API int is_Jmp(const ir_node *node); 2048 2049 /** @} */ 2050 2051 /** 2052 * @defgroup Load Load node 2053 * 2054 * Loads a value from memory (heap or stack). 2055 * @{ 2056 */ 2057 2058 /** 2059 * Input numbers for Load node 2060 */ 2061 typedef enum { 2062 n_Load_mem, 2063 n_Load_ptr, 2064 n_Load_max = n_Load_ptr 2065 } n_Load; 2066 2067 2068 /** 2069 * Projection numbers for result of Load node (use for Proj nodes) 2070 */ 2071 typedef enum { 2072 pn_Load_M, /**< memory result */ 2073 pn_Load_res, /**< result of load operation */ 2074 pn_Load_X_regular, /**< control flow when no exception occurs */ 2075 pn_Load_X_except, /**< control flow when exception occured */ 2076 pn_Load_max = pn_Load_X_except 2077 } pn_Load; 2078 2079 /** 2080 * Construct a Load node. 2081 * 2082 * @param dbgi A pointer to debug information. 2083 * @param block The IR block the node belongs to. 2084 * @param irn_mem memory dependency 2085 * @param irn_ptr address to load from 2086 * @param mode mode of the value to be loaded 2087 * @param flags specifies alignment, volatility and pin state 2088 */ 2089 FIRM_API ir_node *new_rd_Load(dbg_info *dbgi, ir_node *block, ir_node * irn_mem, ir_node * irn_ptr, ir_mode* mode, ir_cons_flags flags); 2090 2091 /** 2092 * Construct a Load node. 2093 * 2094 * @param block The IR block the node belongs to. 2095 * @param irn_mem memory dependency 2096 * @param irn_ptr address to load from 2097 * @param mode mode of the value to be loaded 2098 * @param flags specifies alignment, volatility and pin state 2099 */ 2100 FIRM_API ir_node *new_r_Load(ir_node *block, ir_node * irn_mem, ir_node * irn_ptr, ir_mode* mode, ir_cons_flags flags); 2101 2102 /** 2103 * Construct a Load node. 2104 * 2105 * @param dbgi A pointer to debug information. 2106 * @param irn_mem memory dependency 2107 * @param irn_ptr address to load from 2108 * @param mode mode of the value to be loaded 2109 * @param flags specifies alignment, volatility and pin state 2110 */ 2111 FIRM_API ir_node *new_d_Load(dbg_info *dbgi, ir_node * irn_mem, ir_node * irn_ptr, ir_mode* mode, ir_cons_flags flags); 2112 2113 /** 2114 * Construct a Load node. 2115 * 2116 * @param irn_mem memory dependency 2117 * @param irn_ptr address to load from 2118 * @param mode mode of the value to be loaded 2119 * @param flags specifies alignment, volatility and pin state 2120 */ 2121 FIRM_API ir_node *new_Load(ir_node * irn_mem, ir_node * irn_ptr, ir_mode* mode, ir_cons_flags flags); 2122 /** 2123 * Test if node is a Load 2124 * @returns 1 if the node is a Load node, 0 otherwise 2125 */ 2126 FIRM_API int is_Load(const ir_node *node); 2127 2128 /** Returns mem input of a Load node. */ 2129 FIRM_API ir_node *get_Load_mem(const ir_node *node); 2130 /** Sets mem input of a Load node. */ 2131 FIRM_API void set_Load_mem(ir_node *node, ir_node *mem); 2132 /** Returns ptr input of a Load node. */ 2133 FIRM_API ir_node *get_Load_ptr(const ir_node *node); 2134 /** Sets ptr input of a Load node. */ 2135 FIRM_API void set_Load_ptr(ir_node *node, ir_node *ptr); 2136 /** Returns mode attribute of a Load node. */ 2137 FIRM_API ir_mode* get_Load_mode(const ir_node *node); 2138 /** Sets mode attribute of a Load node. */ 2139 FIRM_API void set_Load_mode(ir_node *node, ir_mode* mode); 2140 /** Returns volatility attribute of a Load node. */ 2141 FIRM_API ir_volatility get_Load_volatility(const ir_node *node); 2142 /** Sets volatility attribute of a Load node. */ 2143 FIRM_API void set_Load_volatility(ir_node *node, ir_volatility volatility); 2144 /** Returns unaligned attribute of a Load node. */ 2145 FIRM_API ir_align get_Load_unaligned(const ir_node *node); 2146 /** Sets unaligned attribute of a Load node. */ 2147 FIRM_API void set_Load_unaligned(ir_node *node, ir_align unaligned); 2148 /** @} */ 2149 2150 /** 2151 * @defgroup Minus Minus node 2152 * 2153 * returns the additive inverse of its operand 2154 * @{ 2155 */ 2156 2157 /** 2158 * Input numbers for Minus node 2159 */ 2160 typedef enum { 2161 n_Minus_op, 2162 n_Minus_max = n_Minus_op 2163 } n_Minus; 2164 2165 2166 /** 2167 * Construct a Minus node. 2168 * 2169 * @param dbgi A pointer to debug information. 2170 * @param block The IR block the node belongs to. 2171 * @param irn_op operand 2172 * @param mode mode of the operations result 2173 */ 2174 FIRM_API ir_node *new_rd_Minus(dbg_info *dbgi, ir_node *block, ir_node * irn_op, ir_mode * mode); 2175 2176 /** 2177 * Construct a Minus node. 2178 * 2179 * @param block The IR block the node belongs to. 2180 * @param irn_op operand 2181 * @param mode mode of the operations result 2182 */ 2183 FIRM_API ir_node *new_r_Minus(ir_node *block, ir_node * irn_op, ir_mode * mode); 2184 2185 /** 2186 * Construct a Minus node. 2187 * 2188 * @param dbgi A pointer to debug information. 2189 * @param irn_op operand 2190 * @param mode mode of the operations result 2191 */ 2192 FIRM_API ir_node *new_d_Minus(dbg_info *dbgi, ir_node * irn_op, ir_mode * mode); 2193 2194 /** 2195 * Construct a Minus node. 2196 * 2197 * @param irn_op operand 2198 * @param mode mode of the operations result 2199 */ 2200 FIRM_API ir_node *new_Minus(ir_node * irn_op, ir_mode * mode); 2201 /** 2202 * Test if node is a Minus 2203 * @returns 1 if the node is a Minus node, 0 otherwise 2204 */ 2205 FIRM_API int is_Minus(const ir_node *node); 2206 2207 /** Returns op input of a Minus node. */ 2208 FIRM_API ir_node *get_Minus_op(const ir_node *node); 2209 /** Sets op input of a Minus node. */ 2210 FIRM_API void set_Minus_op(ir_node *node, ir_node *op); 2211 /** @} */ 2212 2213 /** 2214 * @defgroup Mod Mod node 2215 * 2216 * returns the remainder of its operands from an implied division. 2217 2218 Examples: 2219 2220 * mod(5,3) produces 2 2221 * mod(5,-3) produces 2 2222 * mod(-5,3) produces -2 2223 * mod(-5,-3) produces -2 2224 * @{ 2225 */ 2226 2227 /** 2228 * Input numbers for Mod node 2229 */ 2230 typedef enum { 2231 n_Mod_mem, 2232 n_Mod_left, 2233 n_Mod_right, 2234 n_Mod_max = n_Mod_right 2235 } n_Mod; 2236 2237 2238 /** 2239 * Projection numbers for result of Mod node (use for Proj nodes) 2240 */ 2241 typedef enum { 2242 pn_Mod_M, /**< memory result */ 2243 pn_Mod_res, /**< result of computation */ 2244 pn_Mod_X_regular, /**< control flow when no exception occurs */ 2245 pn_Mod_X_except, /**< control flow when exception occured */ 2246 pn_Mod_max = pn_Mod_X_except 2247 } pn_Mod; 2248 2249 /** 2250 * Construct a Mod node. 2251 * 2252 * @param dbgi A pointer to debug information. 2253 * @param block The IR block the node belongs to. 2254 * @param irn_mem memory dependency 2255 * @param irn_left first operand 2256 * @param irn_right second operand 2257 * @param resmode mode of the result 2258 * @param pin_state pinned state 2259 */ 2260 FIRM_API ir_node *new_rd_Mod(dbg_info *dbgi, ir_node *block, ir_node * irn_mem, ir_node * irn_left, ir_node * irn_right, ir_mode* resmode, op_pin_state pin_state); 2261 2262 /** 2263 * Construct a Mod node. 2264 * 2265 * @param block The IR block the node belongs to. 2266 * @param irn_mem memory dependency 2267 * @param irn_left first operand 2268 * @param irn_right second operand 2269 * @param resmode mode of the result 2270 * @param pin_state pinned state 2271 */ 2272 FIRM_API ir_node *new_r_Mod(ir_node *block, ir_node * irn_mem, ir_node * irn_left, ir_node * irn_right, ir_mode* resmode, op_pin_state pin_state); 2273 2274 /** 2275 * Construct a Mod node. 2276 * 2277 * @param dbgi A pointer to debug information. 2278 * @param irn_mem memory dependency 2279 * @param irn_left first operand 2280 * @param irn_right second operand 2281 * @param resmode mode of the result 2282 * @param pin_state pinned state 2283 */ 2284 FIRM_API ir_node *new_d_Mod(dbg_info *dbgi, ir_node * irn_mem, ir_node * irn_left, ir_node * irn_right, ir_mode* resmode, op_pin_state pin_state); 2285 2286 /** 2287 * Construct a Mod node. 2288 * 2289 * @param irn_mem memory dependency 2290 * @param irn_left first operand 2291 * @param irn_right second operand 2292 * @param resmode mode of the result 2293 * @param pin_state pinned state 2294 */ 2295 FIRM_API ir_node *new_Mod(ir_node * irn_mem, ir_node * irn_left, ir_node * irn_right, ir_mode* resmode, op_pin_state pin_state); 2296 /** 2297 * Test if node is a Mod 2298 * @returns 1 if the node is a Mod node, 0 otherwise 2299 */ 2300 FIRM_API int is_Mod(const ir_node *node); 2301 2302 /** Returns mem input of a Mod node. */ 2303 FIRM_API ir_node *get_Mod_mem(const ir_node *node); 2304 /** Sets mem input of a Mod node. */ 2305 FIRM_API void set_Mod_mem(ir_node *node, ir_node *mem); 2306 /** Returns left input of a Mod node. */ 2307 FIRM_API ir_node *get_Mod_left(const ir_node *node); 2308 /** Sets left input of a Mod node. */ 2309 FIRM_API void set_Mod_left(ir_node *node, ir_node *left); 2310 /** Returns right input of a Mod node. */ 2311 FIRM_API ir_node *get_Mod_right(const ir_node *node); 2312 /** Sets right input of a Mod node. */ 2313 FIRM_API void set_Mod_right(ir_node *node, ir_node *right); 2314 /** Returns resmode attribute of a Mod node. */ 2315 FIRM_API ir_mode* get_Mod_resmode(const ir_node *node); 2316 /** Sets resmode attribute of a Mod node. */ 2317 FIRM_API void set_Mod_resmode(ir_node *node, ir_mode* resmode); 2318 /** @} */ 2319 2320 /** 2321 * @defgroup Mul Mul node 2322 * 2323 * returns the product of its operands 2324 * @{ 2325 */ 2326 2327 /** 2328 * Input numbers for Mul node 2329 */ 2330 typedef enum { 2331 n_Mul_left, 2332 n_Mul_right, 2333 n_Mul_max = n_Mul_right 2334 } n_Mul; 2335 2336 2337 /** 2338 * Construct a Mul node. 2339 * 2340 * @param dbgi A pointer to debug information. 2341 * @param block The IR block the node belongs to. 2342 * @param irn_left first operand 2343 * @param irn_right second operand 2344 * @param mode mode of the operations result 2345 */ 2346 FIRM_API ir_node *new_rd_Mul(dbg_info *dbgi, ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 2347 2348 /** 2349 * Construct a Mul node. 2350 * 2351 * @param block The IR block the node belongs to. 2352 * @param irn_left first operand 2353 * @param irn_right second operand 2354 * @param mode mode of the operations result 2355 */ 2356 FIRM_API ir_node *new_r_Mul(ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 2357 2358 /** 2359 * Construct a Mul node. 2360 * 2361 * @param dbgi A pointer to debug information. 2362 * @param irn_left first operand 2363 * @param irn_right second operand 2364 * @param mode mode of the operations result 2365 */ 2366 FIRM_API ir_node *new_d_Mul(dbg_info *dbgi, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 2367 2368 /** 2369 * Construct a Mul node. 2370 * 2371 * @param irn_left first operand 2372 * @param irn_right second operand 2373 * @param mode mode of the operations result 2374 */ 2375 FIRM_API ir_node *new_Mul(ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 2376 /** 2377 * Test if node is a Mul 2378 * @returns 1 if the node is a Mul node, 0 otherwise 2379 */ 2380 FIRM_API int is_Mul(const ir_node *node); 2381 2382 /** Returns left input of a Mul node. */ 2383 FIRM_API ir_node *get_Mul_left(const ir_node *node); 2384 /** Sets left input of a Mul node. */ 2385 FIRM_API void set_Mul_left(ir_node *node, ir_node *left); 2386 /** Returns right input of a Mul node. */ 2387 FIRM_API ir_node *get_Mul_right(const ir_node *node); 2388 /** Sets right input of a Mul node. */ 2389 FIRM_API void set_Mul_right(ir_node *node, ir_node *right); 2390 /** @} */ 2391 2392 /** 2393 * @defgroup Mulh Mulh node 2394 * 2395 * returns the upper word of the product of its operands (the part which 2396 would not fit into the result mode of a normal Mul anymore) 2397 * @{ 2398 */ 2399 2400 /** 2401 * Input numbers for Mulh node 2402 */ 2403 typedef enum { 2404 n_Mulh_left, 2405 n_Mulh_right, 2406 n_Mulh_max = n_Mulh_right 2407 } n_Mulh; 2408 2409 2410 /** 2411 * Construct a Mulh node. 2412 * 2413 * @param dbgi A pointer to debug information. 2414 * @param block The IR block the node belongs to. 2415 * @param irn_left first operand 2416 * @param irn_right second operand 2417 * @param mode mode of the operations result 2418 */ 2419 FIRM_API ir_node *new_rd_Mulh(dbg_info *dbgi, ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 2420 2421 /** 2422 * Construct a Mulh node. 2423 * 2424 * @param block The IR block the node belongs to. 2425 * @param irn_left first operand 2426 * @param irn_right second operand 2427 * @param mode mode of the operations result 2428 */ 2429 FIRM_API ir_node *new_r_Mulh(ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 2430 2431 /** 2432 * Construct a Mulh node. 2433 * 2434 * @param dbgi A pointer to debug information. 2435 * @param irn_left first operand 2436 * @param irn_right second operand 2437 * @param mode mode of the operations result 2438 */ 2439 FIRM_API ir_node *new_d_Mulh(dbg_info *dbgi, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 2440 2441 /** 2442 * Construct a Mulh node. 2443 * 2444 * @param irn_left first operand 2445 * @param irn_right second operand 2446 * @param mode mode of the operations result 2447 */ 2448 FIRM_API ir_node *new_Mulh(ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 2449 /** 2450 * Test if node is a Mulh 2451 * @returns 1 if the node is a Mulh node, 0 otherwise 2452 */ 2453 FIRM_API int is_Mulh(const ir_node *node); 2454 2455 /** Returns left input of a Mulh node. */ 2456 FIRM_API ir_node *get_Mulh_left(const ir_node *node); 2457 /** Sets left input of a Mulh node. */ 2458 FIRM_API void set_Mulh_left(ir_node *node, ir_node *left); 2459 /** Returns right input of a Mulh node. */ 2460 FIRM_API ir_node *get_Mulh_right(const ir_node *node); 2461 /** Sets right input of a Mulh node. */ 2462 FIRM_API void set_Mulh_right(ir_node *node, ir_node *right); 2463 /** @} */ 2464 2465 /** 2466 * @defgroup Mux Mux node 2467 * 2468 * returns the false or true operand depending on the value of the sel 2469 operand 2470 * @{ 2471 */ 2472 2473 /** 2474 * Input numbers for Mux node 2475 */ 2476 typedef enum { 2477 n_Mux_sel, 2478 n_Mux_false, 2479 n_Mux_true, 2480 n_Mux_max = n_Mux_true 2481 } n_Mux; 2482 2483 2484 /** 2485 * Construct a Mux node. 2486 * 2487 * @param dbgi A pointer to debug information. 2488 * @param block The IR block the node belongs to. 2489 * @param irn_sel value making the output selection 2490 * @param irn_false selected if sel input is false 2491 * @param irn_true selected if sel input is true 2492 * @param mode mode of the operations result 2493 */ 2494 FIRM_API ir_node *new_rd_Mux(dbg_info *dbgi, ir_node *block, ir_node * irn_sel, ir_node * irn_false, ir_node * irn_true, ir_mode * mode); 2495 2496 /** 2497 * Construct a Mux node. 2498 * 2499 * @param block The IR block the node belongs to. 2500 * @param irn_sel value making the output selection 2501 * @param irn_false selected if sel input is false 2502 * @param irn_true selected if sel input is true 2503 * @param mode mode of the operations result 2504 */ 2505 FIRM_API ir_node *new_r_Mux(ir_node *block, ir_node * irn_sel, ir_node * irn_false, ir_node * irn_true, ir_mode * mode); 2506 2507 /** 2508 * Construct a Mux node. 2509 * 2510 * @param dbgi A pointer to debug information. 2511 * @param irn_sel value making the output selection 2512 * @param irn_false selected if sel input is false 2513 * @param irn_true selected if sel input is true 2514 * @param mode mode of the operations result 2515 */ 2516 FIRM_API ir_node *new_d_Mux(dbg_info *dbgi, ir_node * irn_sel, ir_node * irn_false, ir_node * irn_true, ir_mode * mode); 2517 2518 /** 2519 * Construct a Mux node. 2520 * 2521 * @param irn_sel value making the output selection 2522 * @param irn_false selected if sel input is false 2523 * @param irn_true selected if sel input is true 2524 * @param mode mode of the operations result 2525 */ 2526 FIRM_API ir_node *new_Mux(ir_node * irn_sel, ir_node * irn_false, ir_node * irn_true, ir_mode * mode); 2527 /** 2528 * Test if node is a Mux 2529 * @returns 1 if the node is a Mux node, 0 otherwise 2530 */ 2531 FIRM_API int is_Mux(const ir_node *node); 2532 2533 /** Returns sel input of a Mux node. */ 2534 FIRM_API ir_node *get_Mux_sel(const ir_node *node); 2535 /** Sets sel input of a Mux node. */ 2536 FIRM_API void set_Mux_sel(ir_node *node, ir_node *sel); 2537 /** Returns false input of a Mux node. */ 2538 FIRM_API ir_node *get_Mux_false(const ir_node *node); 2539 /** Sets false input of a Mux node. */ 2540 FIRM_API void set_Mux_false(ir_node *node, ir_node *false_); 2541 /** Returns true input of a Mux node. */ 2542 FIRM_API ir_node *get_Mux_true(const ir_node *node); 2543 /** Sets true input of a Mux node. */ 2544 FIRM_API void set_Mux_true(ir_node *node, ir_node *true_); 2545 /** @} */ 2546 2547 /** 2548 * @defgroup NoMem NoMem node 2549 * 2550 * Placeholder node for cases where you don't need any memory input 2551 * @{ 2552 */ 2553 2554 2555 /** 2556 * Construct a NoMem node. 2557 * 2558 * @param dbgi A pointer to debug information. 2559 * @param irg The IR graph the node belongs to. 2560 */ 2561 FIRM_API ir_node *new_rd_NoMem(dbg_info *dbgi, ir_graph *irg); 2562 2563 /** 2564 * Construct a NoMem node. 2565 * 2566 * @param irg The IR graph the node belongs to. 2567 */ 2568 FIRM_API ir_node *new_r_NoMem(ir_graph *irg); 2569 2570 /** 2571 * Construct a NoMem node. 2572 * 2573 * @param dbgi A pointer to debug information. 2574 */ 2575 FIRM_API ir_node *new_d_NoMem(dbg_info *dbgi); 2576 2577 /** 2578 * Construct a NoMem node. 2579 * 2580 */ 2581 FIRM_API ir_node *new_NoMem(void); 2582 /** 2583 * Test if node is a NoMem 2584 * @returns 1 if the node is a NoMem node, 0 otherwise 2585 */ 2586 FIRM_API int is_NoMem(const ir_node *node); 2587 2588 /** @} */ 2589 2590 /** 2591 * @defgroup Not Not node 2592 * 2593 * returns the bitwise complement of a value. Works for boolean values, too. 2594 * @{ 2595 */ 2596 2597 /** 2598 * Input numbers for Not node 2599 */ 2600 typedef enum { 2601 n_Not_op, 2602 n_Not_max = n_Not_op 2603 } n_Not; 2604 2605 2606 /** 2607 * Construct a Not node. 2608 * 2609 * @param dbgi A pointer to debug information. 2610 * @param block The IR block the node belongs to. 2611 * @param irn_op operand 2612 * @param mode mode of the operations result 2613 */ 2614 FIRM_API ir_node *new_rd_Not(dbg_info *dbgi, ir_node *block, ir_node * irn_op, ir_mode * mode); 2615 2616 /** 2617 * Construct a Not node. 2618 * 2619 * @param block The IR block the node belongs to. 2620 * @param irn_op operand 2621 * @param mode mode of the operations result 2622 */ 2623 FIRM_API ir_node *new_r_Not(ir_node *block, ir_node * irn_op, ir_mode * mode); 2624 2625 /** 2626 * Construct a Not node. 2627 * 2628 * @param dbgi A pointer to debug information. 2629 * @param irn_op operand 2630 * @param mode mode of the operations result 2631 */ 2632 FIRM_API ir_node *new_d_Not(dbg_info *dbgi, ir_node * irn_op, ir_mode * mode); 2633 2634 /** 2635 * Construct a Not node. 2636 * 2637 * @param irn_op operand 2638 * @param mode mode of the operations result 2639 */ 2640 FIRM_API ir_node *new_Not(ir_node * irn_op, ir_mode * mode); 2641 /** 2642 * Test if node is a Not 2643 * @returns 1 if the node is a Not node, 0 otherwise 2644 */ 2645 FIRM_API int is_Not(const ir_node *node); 2646 2647 /** Returns op input of a Not node. */ 2648 FIRM_API ir_node *get_Not_op(const ir_node *node); 2649 /** Sets op input of a Not node. */ 2650 FIRM_API void set_Not_op(ir_node *node, ir_node *op); 2651 /** @} */ 2652 2653 /** 2654 * @defgroup Or Or node 2655 * 2656 * returns the result of a bitwise or operation of its operands 2657 * @{ 2658 */ 2659 2660 /** 2661 * Input numbers for Or node 2662 */ 2663 typedef enum { 2664 n_Or_left, 2665 n_Or_right, 2666 n_Or_max = n_Or_right 2667 } n_Or; 2668 2669 2670 /** 2671 * Construct an Or node. 2672 * 2673 * @param dbgi A pointer to debug information. 2674 * @param block The IR block the node belongs to. 2675 * @param irn_left first operand 2676 * @param irn_right second operand 2677 * @param mode mode of the operations result 2678 */ 2679 FIRM_API ir_node *new_rd_Or(dbg_info *dbgi, ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 2680 2681 /** 2682 * Construct an Or node. 2683 * 2684 * @param block The IR block the node belongs to. 2685 * @param irn_left first operand 2686 * @param irn_right second operand 2687 * @param mode mode of the operations result 2688 */ 2689 FIRM_API ir_node *new_r_Or(ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 2690 2691 /** 2692 * Construct an Or node. 2693 * 2694 * @param dbgi A pointer to debug information. 2695 * @param irn_left first operand 2696 * @param irn_right second operand 2697 * @param mode mode of the operations result 2698 */ 2699 FIRM_API ir_node *new_d_Or(dbg_info *dbgi, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 2700 2701 /** 2702 * Construct an Or node. 2703 * 2704 * @param irn_left first operand 2705 * @param irn_right second operand 2706 * @param mode mode of the operations result 2707 */ 2708 FIRM_API ir_node *new_Or(ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 2709 /** 2710 * Test if node is a Or 2711 * @returns 1 if the node is a Or node, 0 otherwise 2712 */ 2713 FIRM_API int is_Or(const ir_node *node); 2714 2715 /** Returns left input of an Or node. */ 2716 FIRM_API ir_node *get_Or_left(const ir_node *node); 2717 /** Sets left input of an Or node. */ 2718 FIRM_API void set_Or_left(ir_node *node, ir_node *left); 2719 /** Returns right input of an Or node. */ 2720 FIRM_API ir_node *get_Or_right(const ir_node *node); 2721 /** Sets right input of an Or node. */ 2722 FIRM_API void set_Or_right(ir_node *node, ir_node *right); 2723 /** @} */ 2724 2725 /** 2726 * @defgroup Phi Phi node 2727 * 2728 * Choose a value based on control flow. A phi node has 1 input for each 2729 predecessor of its block. If a block is entered from its nth predecessor 2730 all phi nodes produce their nth input as result. 2731 * @{ 2732 */ 2733 2734 2735 /** 2736 * Construct a Phi node. 2737 * 2738 * @param dbgi A pointer to debug information. 2739 * @param block The IR block the node belongs to. 2740 * @param arity size of additional inputs array 2741 * @param in additional inputs 2742 * @param mode mode of the operations result 2743 */ 2744 FIRM_API ir_node *new_rd_Phi(dbg_info *dbgi, ir_node *block, int arity, ir_node *const * in, ir_mode * mode); 2745 2746 /** 2747 * Construct a Phi node. 2748 * 2749 * @param block The IR block the node belongs to. 2750 * @param arity size of additional inputs array 2751 * @param in additional inputs 2752 * @param mode mode of the operations result 2753 */ 2754 FIRM_API ir_node *new_r_Phi(ir_node *block, int arity, ir_node *const * in, ir_mode * mode); 2755 2756 /** 2757 * Construct a Phi node. 2758 * 2759 * @param dbgi A pointer to debug information. 2760 * @param arity size of additional inputs array 2761 * @param in additional inputs 2762 * @param mode mode of the operations result 2763 */ 2764 FIRM_API ir_node *new_d_Phi(dbg_info *dbgi, int arity, ir_node *const * in, ir_mode * mode); 2765 2766 /** 2767 * Construct a Phi node. 2768 * 2769 * @param arity size of additional inputs array 2770 * @param in additional inputs 2771 * @param mode mode of the operations result 2772 */ 2773 FIRM_API ir_node *new_Phi(int arity, ir_node *const * in, ir_mode * mode); 2774 /** 2775 * Test if node is a Phi 2776 * @returns 1 if the node is a Phi node, 0 otherwise 2777 */ 2778 FIRM_API int is_Phi(const ir_node *node); 2779 2780 /** @} */ 2781 2782 /** 2783 * @defgroup Pin Pin node 2784 * 2785 * Pin the value of the node node in the current block. No users of the Pin 2786 node can float above the Block of the Pin. The node cannot float behind 2787 this block. Often used to Pin the NoMem node. 2788 * @{ 2789 */ 2790 2791 /** 2792 * Input numbers for Pin node 2793 */ 2794 typedef enum { 2795 n_Pin_op, 2796 n_Pin_max = n_Pin_op 2797 } n_Pin; 2798 2799 2800 /** 2801 * Construct a Pin node. 2802 * 2803 * @param dbgi A pointer to debug information. 2804 * @param block The IR block the node belongs to. 2805 * @param irn_op value which is pinned 2806 */ 2807 FIRM_API ir_node *new_rd_Pin(dbg_info *dbgi, ir_node *block, ir_node * irn_op); 2808 2809 /** 2810 * Construct a Pin node. 2811 * 2812 * @param block The IR block the node belongs to. 2813 * @param irn_op value which is pinned 2814 */ 2815 FIRM_API ir_node *new_r_Pin(ir_node *block, ir_node * irn_op); 2816 2817 /** 2818 * Construct a Pin node. 2819 * 2820 * @param dbgi A pointer to debug information. 2821 * @param irn_op value which is pinned 2822 */ 2823 FIRM_API ir_node *new_d_Pin(dbg_info *dbgi, ir_node * irn_op); 2824 2825 /** 2826 * Construct a Pin node. 2827 * 2828 * @param irn_op value which is pinned 2829 */ 2830 FIRM_API ir_node *new_Pin(ir_node * irn_op); 2831 /** 2832 * Test if node is a Pin 2833 * @returns 1 if the node is a Pin node, 0 otherwise 2834 */ 2835 FIRM_API int is_Pin(const ir_node *node); 2836 2837 /** Returns op input of a Pin node. */ 2838 FIRM_API ir_node *get_Pin_op(const ir_node *node); 2839 /** Sets op input of a Pin node. */ 2840 FIRM_API void set_Pin_op(ir_node *node, ir_node *op); 2841 /** @} */ 2842 2843 /** 2844 * @defgroup Proj Proj node 2845 * 2846 * returns an entry of a tuple value 2847 * @{ 2848 */ 2849 2850 /** 2851 * Input numbers for Proj node 2852 */ 2853 typedef enum { 2854 n_Proj_pred, 2855 n_Proj_max = n_Proj_pred 2856 } n_Proj; 2857 2858 2859 /** 2860 * Construct a Proj node. 2861 * 2862 * @param dbgi A pointer to debug information. 2863 * @param irn_pred the tuple value from which a part is extracted 2864 * @param mode mode of the operations result 2865 * @param proj number of tuple component to be extracted 2866 */ 2867 FIRM_API ir_node *new_rd_Proj(dbg_info *dbgi, ir_node * irn_pred, ir_mode * mode, long proj); 2868 2869 /** 2870 * Construct a Proj node. 2871 * 2872 * @param irn_pred the tuple value from which a part is extracted 2873 * @param mode mode of the operations result 2874 * @param proj number of tuple component to be extracted 2875 */ 2876 FIRM_API ir_node *new_r_Proj(ir_node * irn_pred, ir_mode * mode, long proj); 2877 2878 /** 2879 * Construct a Proj node. 2880 * 2881 * @param dbgi A pointer to debug information. 2882 * @param irn_pred the tuple value from which a part is extracted 2883 * @param mode mode of the operations result 2884 * @param proj number of tuple component to be extracted 2885 */ 2886 FIRM_API ir_node *new_d_Proj(dbg_info *dbgi, ir_node * irn_pred, ir_mode * mode, long proj); 2887 2888 /** 2889 * Construct a Proj node. 2890 * 2891 * @param irn_pred the tuple value from which a part is extracted 2892 * @param mode mode of the operations result 2893 * @param proj number of tuple component to be extracted 2894 */ 2895 FIRM_API ir_node *new_Proj(ir_node * irn_pred, ir_mode * mode, long proj); 2896 /** 2897 * Test if node is a Proj 2898 * @returns 1 if the node is a Proj node, 0 otherwise 2899 */ 2900 FIRM_API int is_Proj(const ir_node *node); 2901 2902 /** Returns pred input of a Proj node. */ 2903 FIRM_API ir_node *get_Proj_pred(const ir_node *node); 2904 /** Sets pred input of a Proj node. */ 2905 FIRM_API void set_Proj_pred(ir_node *node, ir_node *pred); 2906 /** Returns proj attribute of a Proj node. */ 2907 FIRM_API long get_Proj_proj(const ir_node *node); 2908 /** Sets proj attribute of a Proj node. */ 2909 FIRM_API void set_Proj_proj(ir_node *node, long proj); 2910 /** @} */ 2911 2912 /** 2913 * @defgroup Raise Raise node 2914 * 2915 * Raises an exception. Unconditional change of control flow. Writes an 2916 explicit Except variable to memory to pass it to the exception handler. 2917 Must be lowered to a Call to a runtime check function. 2918 * @{ 2919 */ 2920 2921 /** 2922 * Input numbers for Raise node 2923 */ 2924 typedef enum { 2925 n_Raise_mem, 2926 n_Raise_exo_ptr, 2927 n_Raise_max = n_Raise_exo_ptr 2928 } n_Raise; 2929 2930 2931 /** 2932 * Projection numbers for result of Raise node (use for Proj nodes) 2933 */ 2934 typedef enum { 2935 pn_Raise_M, /**< memory result */ 2936 pn_Raise_X, /**< control flow to exception handler */ 2937 pn_Raise_max = pn_Raise_X 2938 } pn_Raise; 2939 2940 /** 2941 * Construct a Raise node. 2942 * 2943 * @param dbgi A pointer to debug information. 2944 * @param block The IR block the node belongs to. 2945 * @param irn_mem memory dependency 2946 * @param irn_exo_ptr pointer to exception object to be thrown 2947 */ 2948 FIRM_API ir_node *new_rd_Raise(dbg_info *dbgi, ir_node *block, ir_node * irn_mem, ir_node * irn_exo_ptr); 2949 2950 /** 2951 * Construct a Raise node. 2952 * 2953 * @param block The IR block the node belongs to. 2954 * @param irn_mem memory dependency 2955 * @param irn_exo_ptr pointer to exception object to be thrown 2956 */ 2957 FIRM_API ir_node *new_r_Raise(ir_node *block, ir_node * irn_mem, ir_node * irn_exo_ptr); 2958 2959 /** 2960 * Construct a Raise node. 2961 * 2962 * @param dbgi A pointer to debug information. 2963 * @param irn_mem memory dependency 2964 * @param irn_exo_ptr pointer to exception object to be thrown 2965 */ 2966 FIRM_API ir_node *new_d_Raise(dbg_info *dbgi, ir_node * irn_mem, ir_node * irn_exo_ptr); 2967 2968 /** 2969 * Construct a Raise node. 2970 * 2971 * @param irn_mem memory dependency 2972 * @param irn_exo_ptr pointer to exception object to be thrown 2973 */ 2974 FIRM_API ir_node *new_Raise(ir_node * irn_mem, ir_node * irn_exo_ptr); 2975 /** 2976 * Test if node is a Raise 2977 * @returns 1 if the node is a Raise node, 0 otherwise 2978 */ 2979 FIRM_API int is_Raise(const ir_node *node); 2980 2981 /** Returns mem input of a Raise node. */ 2982 FIRM_API ir_node *get_Raise_mem(const ir_node *node); 2983 /** Sets mem input of a Raise node. */ 2984 FIRM_API void set_Raise_mem(ir_node *node, ir_node *mem); 2985 /** Returns exo_ptr input of a Raise node. */ 2986 FIRM_API ir_node *get_Raise_exo_ptr(const ir_node *node); 2987 /** Sets exo_ptr input of a Raise node. */ 2988 FIRM_API void set_Raise_exo_ptr(ir_node *node, ir_node *exo_ptr); 2989 /** @} */ 2990 2991 /** 2992 * @defgroup Return Return node 2993 * 2994 * Returns from the current function. Takes memory and return values as 2995 operands. 2996 * @{ 2997 */ 2998 2999 /** 3000 * Input numbers for Return node 3001 */ 3002 typedef enum { 3003 n_Return_mem, 3004 n_Return_max = n_Return_mem 3005 } n_Return; 3006 3007 3008 /** 3009 * Construct a Return node. 3010 * 3011 * @param dbgi A pointer to debug information. 3012 * @param block The IR block the node belongs to. 3013 * @param irn_mem memory dependency 3014 * @param arity size of additional inputs array 3015 * @param in additional inputs 3016 */ 3017 FIRM_API ir_node *new_rd_Return(dbg_info *dbgi, ir_node *block, ir_node * irn_mem, int arity, ir_node *const * in); 3018 3019 /** 3020 * Construct a Return node. 3021 * 3022 * @param block The IR block the node belongs to. 3023 * @param irn_mem memory dependency 3024 * @param arity size of additional inputs array 3025 * @param in additional inputs 3026 */ 3027 FIRM_API ir_node *new_r_Return(ir_node *block, ir_node * irn_mem, int arity, ir_node *const * in); 3028 3029 /** 3030 * Construct a Return node. 3031 * 3032 * @param dbgi A pointer to debug information. 3033 * @param irn_mem memory dependency 3034 * @param arity size of additional inputs array 3035 * @param in additional inputs 3036 */ 3037 FIRM_API ir_node *new_d_Return(dbg_info *dbgi, ir_node * irn_mem, int arity, ir_node *const * in); 3038 3039 /** 3040 * Construct a Return node. 3041 * 3042 * @param irn_mem memory dependency 3043 * @param arity size of additional inputs array 3044 * @param in additional inputs 3045 */ 3046 FIRM_API ir_node *new_Return(ir_node * irn_mem, int arity, ir_node *const * in); 3047 /** 3048 * Test if node is a Return 3049 * @returns 1 if the node is a Return node, 0 otherwise 3050 */ 3051 FIRM_API int is_Return(const ir_node *node); 3052 3053 /** Returns mem input of a Return node. */ 3054 FIRM_API ir_node *get_Return_mem(const ir_node *node); 3055 /** Sets mem input of a Return node. */ 3056 FIRM_API void set_Return_mem(ir_node *node, ir_node *mem); 3057 /** @} */ 3058 3059 /** 3060 * @defgroup Rotl Rotl node 3061 * 3062 * Returns its first operand bits rotated left by the amount in the 2nd 3063 operand 3064 * @{ 3065 */ 3066 3067 /** 3068 * Input numbers for Rotl node 3069 */ 3070 typedef enum { 3071 n_Rotl_left, 3072 n_Rotl_right, 3073 n_Rotl_max = n_Rotl_right 3074 } n_Rotl; 3075 3076 3077 /** 3078 * Construct a Rotl node. 3079 * 3080 * @param dbgi A pointer to debug information. 3081 * @param block The IR block the node belongs to. 3082 * @param irn_left first operand 3083 * @param irn_right second operand 3084 * @param mode mode of the operations result 3085 */ 3086 FIRM_API ir_node *new_rd_Rotl(dbg_info *dbgi, ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3087 3088 /** 3089 * Construct a Rotl node. 3090 * 3091 * @param block The IR block the node belongs to. 3092 * @param irn_left first operand 3093 * @param irn_right second operand 3094 * @param mode mode of the operations result 3095 */ 3096 FIRM_API ir_node *new_r_Rotl(ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3097 3098 /** 3099 * Construct a Rotl node. 3100 * 3101 * @param dbgi A pointer to debug information. 3102 * @param irn_left first operand 3103 * @param irn_right second operand 3104 * @param mode mode of the operations result 3105 */ 3106 FIRM_API ir_node *new_d_Rotl(dbg_info *dbgi, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3107 3108 /** 3109 * Construct a Rotl node. 3110 * 3111 * @param irn_left first operand 3112 * @param irn_right second operand 3113 * @param mode mode of the operations result 3114 */ 3115 FIRM_API ir_node *new_Rotl(ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3116 /** 3117 * Test if node is a Rotl 3118 * @returns 1 if the node is a Rotl node, 0 otherwise 3119 */ 3120 FIRM_API int is_Rotl(const ir_node *node); 3121 3122 /** Returns left input of a Rotl node. */ 3123 FIRM_API ir_node *get_Rotl_left(const ir_node *node); 3124 /** Sets left input of a Rotl node. */ 3125 FIRM_API void set_Rotl_left(ir_node *node, ir_node *left); 3126 /** Returns right input of a Rotl node. */ 3127 FIRM_API ir_node *get_Rotl_right(const ir_node *node); 3128 /** Sets right input of a Rotl node. */ 3129 FIRM_API void set_Rotl_right(ir_node *node, ir_node *right); 3130 /** @} */ 3131 3132 /** 3133 * @defgroup Sel Sel node 3134 * 3135 * Computes the address of a entity of a compound type given the base 3136 address of an instance of the compound type. 3137 3138 Optimisations assume that a Sel node can only produce a NULL pointer if the 3139 ptr input was NULL. 3140 * @{ 3141 */ 3142 3143 /** 3144 * Input numbers for Sel node 3145 */ 3146 typedef enum { 3147 n_Sel_mem, 3148 n_Sel_ptr, 3149 n_Sel_max = n_Sel_ptr 3150 } n_Sel; 3151 3152 3153 /** 3154 * Construct a Sel node. 3155 * 3156 * @param dbgi A pointer to debug information. 3157 * @param block The IR block the node belongs to. 3158 * @param irn_mem memory dependency 3159 * @param irn_ptr pointer to object to select from 3160 * @param arity size of additional inputs array 3161 * @param in additional inputs 3162 * @param entity entity which is selected 3163 */ 3164 FIRM_API ir_node *new_rd_Sel(dbg_info *dbgi, ir_node *block, ir_node * irn_mem, ir_node * irn_ptr, int arity, ir_node *const * in, ir_entity* entity); 3165 3166 /** 3167 * Construct a Sel node. 3168 * 3169 * @param block The IR block the node belongs to. 3170 * @param irn_mem memory dependency 3171 * @param irn_ptr pointer to object to select from 3172 * @param arity size of additional inputs array 3173 * @param in additional inputs 3174 * @param entity entity which is selected 3175 */ 3176 FIRM_API ir_node *new_r_Sel(ir_node *block, ir_node * irn_mem, ir_node * irn_ptr, int arity, ir_node *const * in, ir_entity* entity); 3177 3178 /** 3179 * Construct a Sel node. 3180 * 3181 * @param dbgi A pointer to debug information. 3182 * @param irn_mem memory dependency 3183 * @param irn_ptr pointer to object to select from 3184 * @param arity size of additional inputs array 3185 * @param in additional inputs 3186 * @param entity entity which is selected 3187 */ 3188 FIRM_API ir_node *new_d_Sel(dbg_info *dbgi, ir_node * irn_mem, ir_node * irn_ptr, int arity, ir_node *const * in, ir_entity* entity); 3189 3190 /** 3191 * Construct a Sel node. 3192 * 3193 * @param irn_mem memory dependency 3194 * @param irn_ptr pointer to object to select from 3195 * @param arity size of additional inputs array 3196 * @param in additional inputs 3197 * @param entity entity which is selected 3198 */ 3199 FIRM_API ir_node *new_Sel(ir_node * irn_mem, ir_node * irn_ptr, int arity, ir_node *const * in, ir_entity* entity); 3200 /** 3201 * Test if node is a Sel 3202 * @returns 1 if the node is a Sel node, 0 otherwise 3203 */ 3204 FIRM_API int is_Sel(const ir_node *node); 3205 3206 /** Returns mem input of a Sel node. */ 3207 FIRM_API ir_node *get_Sel_mem(const ir_node *node); 3208 /** Sets mem input of a Sel node. */ 3209 FIRM_API void set_Sel_mem(ir_node *node, ir_node *mem); 3210 /** Returns ptr input of a Sel node. */ 3211 FIRM_API ir_node *get_Sel_ptr(const ir_node *node); 3212 /** Sets ptr input of a Sel node. */ 3213 FIRM_API void set_Sel_ptr(ir_node *node, ir_node *ptr); 3214 /** Returns entity attribute of a Sel node. */ 3215 FIRM_API ir_entity* get_Sel_entity(const ir_node *node); 3216 /** Sets entity attribute of a Sel node. */ 3217 FIRM_API void set_Sel_entity(ir_node *node, ir_entity* entity); 3218 /** @} */ 3219 3220 /** 3221 * @defgroup Shl Shl node 3222 * 3223 * Returns its first operands bits shifted left by the amount of the 2nd 3224 operand. 3225 The right input (shift amount) must be an unsigned integer value. 3226 If the result mode has modulo_shift!=0, then the effective shift amount is 3227 the right input modulo this modulo_shift amount. 3228 * @{ 3229 */ 3230 3231 /** 3232 * Input numbers for Shl node 3233 */ 3234 typedef enum { 3235 n_Shl_left, 3236 n_Shl_right, 3237 n_Shl_max = n_Shl_right 3238 } n_Shl; 3239 3240 3241 /** 3242 * Construct a Shl node. 3243 * 3244 * @param dbgi A pointer to debug information. 3245 * @param block The IR block the node belongs to. 3246 * @param irn_left first operand 3247 * @param irn_right second operand 3248 * @param mode mode of the operations result 3249 */ 3250 FIRM_API ir_node *new_rd_Shl(dbg_info *dbgi, ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3251 3252 /** 3253 * Construct a Shl node. 3254 * 3255 * @param block The IR block the node belongs to. 3256 * @param irn_left first operand 3257 * @param irn_right second operand 3258 * @param mode mode of the operations result 3259 */ 3260 FIRM_API ir_node *new_r_Shl(ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3261 3262 /** 3263 * Construct a Shl node. 3264 * 3265 * @param dbgi A pointer to debug information. 3266 * @param irn_left first operand 3267 * @param irn_right second operand 3268 * @param mode mode of the operations result 3269 */ 3270 FIRM_API ir_node *new_d_Shl(dbg_info *dbgi, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3271 3272 /** 3273 * Construct a Shl node. 3274 * 3275 * @param irn_left first operand 3276 * @param irn_right second operand 3277 * @param mode mode of the operations result 3278 */ 3279 FIRM_API ir_node *new_Shl(ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3280 /** 3281 * Test if node is a Shl 3282 * @returns 1 if the node is a Shl node, 0 otherwise 3283 */ 3284 FIRM_API int is_Shl(const ir_node *node); 3285 3286 /** Returns left input of a Shl node. */ 3287 FIRM_API ir_node *get_Shl_left(const ir_node *node); 3288 /** Sets left input of a Shl node. */ 3289 FIRM_API void set_Shl_left(ir_node *node, ir_node *left); 3290 /** Returns right input of a Shl node. */ 3291 FIRM_API ir_node *get_Shl_right(const ir_node *node); 3292 /** Sets right input of a Shl node. */ 3293 FIRM_API void set_Shl_right(ir_node *node, ir_node *right); 3294 /** @} */ 3295 3296 /** 3297 * @defgroup Shr Shr node 3298 * 3299 * Returns its first operands bits shifted right by the amount of the 2nd 3300 operand. No special handling for the sign bit is performed (zero extension). 3301 The right input (shift amount) must be an unsigned integer value. 3302 If the result mode has modulo_shift!=0, then the effective shift amount is 3303 the right input modulo this modulo_shift amount. 3304 * @{ 3305 */ 3306 3307 /** 3308 * Input numbers for Shr node 3309 */ 3310 typedef enum { 3311 n_Shr_left, 3312 n_Shr_right, 3313 n_Shr_max = n_Shr_right 3314 } n_Shr; 3315 3316 3317 /** 3318 * Construct a Shr node. 3319 * 3320 * @param dbgi A pointer to debug information. 3321 * @param block The IR block the node belongs to. 3322 * @param irn_left first operand 3323 * @param irn_right second operand 3324 * @param mode mode of the operations result 3325 */ 3326 FIRM_API ir_node *new_rd_Shr(dbg_info *dbgi, ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3327 3328 /** 3329 * Construct a Shr node. 3330 * 3331 * @param block The IR block the node belongs to. 3332 * @param irn_left first operand 3333 * @param irn_right second operand 3334 * @param mode mode of the operations result 3335 */ 3336 FIRM_API ir_node *new_r_Shr(ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3337 3338 /** 3339 * Construct a Shr node. 3340 * 3341 * @param dbgi A pointer to debug information. 3342 * @param irn_left first operand 3343 * @param irn_right second operand 3344 * @param mode mode of the operations result 3345 */ 3346 FIRM_API ir_node *new_d_Shr(dbg_info *dbgi, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3347 3348 /** 3349 * Construct a Shr node. 3350 * 3351 * @param irn_left first operand 3352 * @param irn_right second operand 3353 * @param mode mode of the operations result 3354 */ 3355 FIRM_API ir_node *new_Shr(ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3356 /** 3357 * Test if node is a Shr 3358 * @returns 1 if the node is a Shr node, 0 otherwise 3359 */ 3360 FIRM_API int is_Shr(const ir_node *node); 3361 3362 /** Returns left input of a Shr node. */ 3363 FIRM_API ir_node *get_Shr_left(const ir_node *node); 3364 /** Sets left input of a Shr node. */ 3365 FIRM_API void set_Shr_left(ir_node *node, ir_node *left); 3366 /** Returns right input of a Shr node. */ 3367 FIRM_API ir_node *get_Shr_right(const ir_node *node); 3368 /** Sets right input of a Shr node. */ 3369 FIRM_API void set_Shr_right(ir_node *node, ir_node *right); 3370 /** @} */ 3371 3372 /** 3373 * @defgroup Shrs Shrs node 3374 * 3375 * Returns its first operands bits shifted right by the amount of the 2nd 3376 operand. The leftmost bit (usually the sign bit) stays the same 3377 (sign extension). 3378 The right input (shift amount) must be an unsigned integer value. 3379 If the result mode has modulo_shift!=0, then the effective shift amount is 3380 the right input modulo this modulo_shift amount. 3381 * @{ 3382 */ 3383 3384 /** 3385 * Input numbers for Shrs node 3386 */ 3387 typedef enum { 3388 n_Shrs_left, 3389 n_Shrs_right, 3390 n_Shrs_max = n_Shrs_right 3391 } n_Shrs; 3392 3393 3394 /** 3395 * Construct a Shrs node. 3396 * 3397 * @param dbgi A pointer to debug information. 3398 * @param block The IR block the node belongs to. 3399 * @param irn_left first operand 3400 * @param irn_right second operand 3401 * @param mode mode of the operations result 3402 */ 3403 FIRM_API ir_node *new_rd_Shrs(dbg_info *dbgi, ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3404 3405 /** 3406 * Construct a Shrs node. 3407 * 3408 * @param block The IR block the node belongs to. 3409 * @param irn_left first operand 3410 * @param irn_right second operand 3411 * @param mode mode of the operations result 3412 */ 3413 FIRM_API ir_node *new_r_Shrs(ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3414 3415 /** 3416 * Construct a Shrs node. 3417 * 3418 * @param dbgi A pointer to debug information. 3419 * @param irn_left first operand 3420 * @param irn_right second operand 3421 * @param mode mode of the operations result 3422 */ 3423 FIRM_API ir_node *new_d_Shrs(dbg_info *dbgi, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3424 3425 /** 3426 * Construct a Shrs node. 3427 * 3428 * @param irn_left first operand 3429 * @param irn_right second operand 3430 * @param mode mode of the operations result 3431 */ 3432 FIRM_API ir_node *new_Shrs(ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3433 /** 3434 * Test if node is a Shrs 3435 * @returns 1 if the node is a Shrs node, 0 otherwise 3436 */ 3437 FIRM_API int is_Shrs(const ir_node *node); 3438 3439 /** Returns left input of a Shrs node. */ 3440 FIRM_API ir_node *get_Shrs_left(const ir_node *node); 3441 /** Sets left input of a Shrs node. */ 3442 FIRM_API void set_Shrs_left(ir_node *node, ir_node *left); 3443 /** Returns right input of a Shrs node. */ 3444 FIRM_API ir_node *get_Shrs_right(const ir_node *node); 3445 /** Sets right input of a Shrs node. */ 3446 FIRM_API void set_Shrs_right(ir_node *node, ir_node *right); 3447 /** @} */ 3448 3449 /** 3450 * @defgroup Start Start node 3451 * 3452 * The first node of a graph. Execution starts with this node. 3453 * @{ 3454 */ 3455 3456 3457 /** 3458 * Projection numbers for result of Start node (use for Proj nodes) 3459 */ 3460 typedef enum { 3461 pn_Start_X_initial_exec, /**< control flow */ 3462 pn_Start_M, /**< initial memory */ 3463 pn_Start_P_frame_base, /**< frame base pointer */ 3464 pn_Start_T_args, /**< function arguments */ 3465 pn_Start_max = pn_Start_T_args 3466 } pn_Start; 3467 3468 /** 3469 * Construct a Start node. 3470 * 3471 * @param dbgi A pointer to debug information. 3472 * @param irg The IR graph the node belongs to. 3473 */ 3474 FIRM_API ir_node *new_rd_Start(dbg_info *dbgi, ir_graph *irg); 3475 3476 /** 3477 * Construct a Start node. 3478 * 3479 * @param irg The IR graph the node belongs to. 3480 */ 3481 FIRM_API ir_node *new_r_Start(ir_graph *irg); 3482 3483 /** 3484 * Construct a Start node. 3485 * 3486 * @param dbgi A pointer to debug information. 3487 */ 3488 FIRM_API ir_node *new_d_Start(dbg_info *dbgi); 3489 3490 /** 3491 * Construct a Start node. 3492 * 3493 */ 3494 FIRM_API ir_node *new_Start(void); 3495 /** 3496 * Test if node is a Start 3497 * @returns 1 if the node is a Start node, 0 otherwise 3498 */ 3499 FIRM_API int is_Start(const ir_node *node); 3500 3501 /** @} */ 3502 3503 /** 3504 * @defgroup Store Store node 3505 * 3506 * Stores a value into memory (heap or stack). 3507 * @{ 3508 */ 3509 3510 /** 3511 * Input numbers for Store node 3512 */ 3513 typedef enum { 3514 n_Store_mem, 3515 n_Store_ptr, 3516 n_Store_value, 3517 n_Store_max = n_Store_value 3518 } n_Store; 3519 3520 3521 /** 3522 * Projection numbers for result of Store node (use for Proj nodes) 3523 */ 3524 typedef enum { 3525 pn_Store_M, /**< memory result */ 3526 pn_Store_X_regular, /**< control flow when no exception occurs */ 3527 pn_Store_X_except, /**< control flow when exception occured */ 3528 pn_Store_max = pn_Store_X_except 3529 } pn_Store; 3530 3531 /** 3532 * Construct a Store node. 3533 * 3534 * @param dbgi A pointer to debug information. 3535 * @param block The IR block the node belongs to. 3536 * @param irn_mem memory dependency 3537 * @param irn_ptr address to store to 3538 * @param irn_value value to store 3539 * @param flags specifies alignment, volatility and pin state 3540 */ 3541 FIRM_API ir_node *new_rd_Store(dbg_info *dbgi, ir_node *block, ir_node * irn_mem, ir_node * irn_ptr, ir_node * irn_value, ir_cons_flags flags); 3542 3543 /** 3544 * Construct a Store node. 3545 * 3546 * @param block The IR block the node belongs to. 3547 * @param irn_mem memory dependency 3548 * @param irn_ptr address to store to 3549 * @param irn_value value to store 3550 * @param flags specifies alignment, volatility and pin state 3551 */ 3552 FIRM_API ir_node *new_r_Store(ir_node *block, ir_node * irn_mem, ir_node * irn_ptr, ir_node * irn_value, ir_cons_flags flags); 3553 3554 /** 3555 * Construct a Store node. 3556 * 3557 * @param dbgi A pointer to debug information. 3558 * @param irn_mem memory dependency 3559 * @param irn_ptr address to store to 3560 * @param irn_value value to store 3561 * @param flags specifies alignment, volatility and pin state 3562 */ 3563 FIRM_API ir_node *new_d_Store(dbg_info *dbgi, ir_node * irn_mem, ir_node * irn_ptr, ir_node * irn_value, ir_cons_flags flags); 3564 3565 /** 3566 * Construct a Store node. 3567 * 3568 * @param irn_mem memory dependency 3569 * @param irn_ptr address to store to 3570 * @param irn_value value to store 3571 * @param flags specifies alignment, volatility and pin state 3572 */ 3573 FIRM_API ir_node *new_Store(ir_node * irn_mem, ir_node * irn_ptr, ir_node * irn_value, ir_cons_flags flags); 3574 /** 3575 * Test if node is a Store 3576 * @returns 1 if the node is a Store node, 0 otherwise 3577 */ 3578 FIRM_API int is_Store(const ir_node *node); 3579 3580 /** Returns mem input of a Store node. */ 3581 FIRM_API ir_node *get_Store_mem(const ir_node *node); 3582 /** Sets mem input of a Store node. */ 3583 FIRM_API void set_Store_mem(ir_node *node, ir_node *mem); 3584 /** Returns ptr input of a Store node. */ 3585 FIRM_API ir_node *get_Store_ptr(const ir_node *node); 3586 /** Sets ptr input of a Store node. */ 3587 FIRM_API void set_Store_ptr(ir_node *node, ir_node *ptr); 3588 /** Returns value input of a Store node. */ 3589 FIRM_API ir_node *get_Store_value(const ir_node *node); 3590 /** Sets value input of a Store node. */ 3591 FIRM_API void set_Store_value(ir_node *node, ir_node *value); 3592 /** Returns volatility attribute of a Store node. */ 3593 FIRM_API ir_volatility get_Store_volatility(const ir_node *node); 3594 /** Sets volatility attribute of a Store node. */ 3595 FIRM_API void set_Store_volatility(ir_node *node, ir_volatility volatility); 3596 /** Returns unaligned attribute of a Store node. */ 3597 FIRM_API ir_align get_Store_unaligned(const ir_node *node); 3598 /** Sets unaligned attribute of a Store node. */ 3599 FIRM_API void set_Store_unaligned(ir_node *node, ir_align unaligned); 3600 /** @} */ 3601 3602 /** 3603 * @defgroup Sub Sub node 3604 * 3605 * returns the difference of its operands 3606 * @{ 3607 */ 3608 3609 /** 3610 * Input numbers for Sub node 3611 */ 3612 typedef enum { 3613 n_Sub_left, 3614 n_Sub_right, 3615 n_Sub_max = n_Sub_right 3616 } n_Sub; 3617 3618 3619 /** 3620 * Construct a Sub node. 3621 * 3622 * @param dbgi A pointer to debug information. 3623 * @param block The IR block the node belongs to. 3624 * @param irn_left first operand 3625 * @param irn_right second operand 3626 * @param mode mode of the operations result 3627 */ 3628 FIRM_API ir_node *new_rd_Sub(dbg_info *dbgi, ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3629 3630 /** 3631 * Construct a Sub node. 3632 * 3633 * @param block The IR block the node belongs to. 3634 * @param irn_left first operand 3635 * @param irn_right second operand 3636 * @param mode mode of the operations result 3637 */ 3638 FIRM_API ir_node *new_r_Sub(ir_node *block, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3639 3640 /** 3641 * Construct a Sub node. 3642 * 3643 * @param dbgi A pointer to debug information. 3644 * @param irn_left first operand 3645 * @param irn_right second operand 3646 * @param mode mode of the operations result 3647 */ 3648 FIRM_API ir_node *new_d_Sub(dbg_info *dbgi, ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3649 3650 /** 3651 * Construct a Sub node. 3652 * 3653 * @param irn_left first operand 3654 * @param irn_right second operand 3655 * @param mode mode of the operations result 3656 */ 3657 FIRM_API ir_node *new_Sub(ir_node * irn_left, ir_node * irn_right, ir_mode * mode); 3658 /** 3659 * Test if node is a Sub 3660 * @returns 1 if the node is a Sub node, 0 otherwise 3661 */ 3662 FIRM_API int is_Sub(const ir_node *node); 3663 3664 /** Returns left input of a Sub node. */ 3665 FIRM_API ir_node *get_Sub_left(const ir_node *node); 3666 /** Sets left input of a Sub node. */ 3667 FIRM_API void set_Sub_left(ir_node *node, ir_node *left); 3668 /** Returns right input of a Sub node. */ 3669 FIRM_API ir_node *get_Sub_right(const ir_node *node); 3670 /** Sets right input of a Sub node. */ 3671 FIRM_API void set_Sub_right(ir_node *node, ir_node *right); 3672 /** @} */ 3673 3674 /** 3675 * @defgroup Switch Switch node 3676 * 3677 * Change control flow. The destination is choosen based on an integer input value which is looked up in a table. 3678 3679 Backends can implement this efficiently using a jump table. 3680 * @{ 3681 */ 3682 3683 /** 3684 * Input numbers for Switch node 3685 */ 3686 typedef enum { 3687 n_Switch_selector, 3688 n_Switch_max = n_Switch_selector 3689 } n_Switch; 3690 3691 3692 /** 3693 * Projection numbers for result of Switch node (use for Proj nodes) 3694 */ 3695 typedef enum { 3696 pn_Switch_default, /**< control flow if no other case matches */ 3697 pn_Switch_max = pn_Switch_default 3698 } pn_Switch; 3699 3700 /** 3701 * Construct a Switch node. 3702 * 3703 * @param dbgi A pointer to debug information. 3704 * @param block The IR block the node belongs to. 3705 * @param irn_selector input selector 3706 * @param n_outs number of outputs (including pn_Switch_default) 3707 * @param table table describing mapping from input values to Proj numbers 3708 */ 3709 FIRM_API ir_node *new_rd_Switch(dbg_info *dbgi, ir_node *block, ir_node * irn_selector, unsigned n_outs, ir_switch_table* table); 3710 3711 /** 3712 * Construct a Switch node. 3713 * 3714 * @param block The IR block the node belongs to. 3715 * @param irn_selector input selector 3716 * @param n_outs number of outputs (including pn_Switch_default) 3717 * @param table table describing mapping from input values to Proj numbers 3718 */ 3719 FIRM_API ir_node *new_r_Switch(ir_node *block, ir_node * irn_selector, unsigned n_outs, ir_switch_table* table); 3720 3721 /** 3722 * Construct a Switch node. 3723 * 3724 * @param dbgi A pointer to debug information. 3725 * @param irn_selector input selector 3726 * @param n_outs number of outputs (including pn_Switch_default) 3727 * @param table table describing mapping from input values to Proj numbers 3728 */ 3729 FIRM_API ir_node *new_d_Switch(dbg_info *dbgi, ir_node * irn_selector, unsigned n_outs, ir_switch_table* table); 3730 3731 /** 3732 * Construct a Switch node. 3733 * 3734 * @param irn_selector input selector 3735 * @param n_outs number of outputs (including pn_Switch_default) 3736 * @param table table describing mapping from input values to Proj numbers 3737 */ 3738 FIRM_API ir_node *new_Switch(ir_node * irn_selector, unsigned n_outs, ir_switch_table* table); 3739 /** 3740 * Test if node is a Switch 3741 * @returns 1 if the node is a Switch node, 0 otherwise 3742 */ 3743 FIRM_API int is_Switch(const ir_node *node); 3744 3745 /** Returns selector input of a Switch node. */ 3746 FIRM_API ir_node *get_Switch_selector(const ir_node *node); 3747 /** Sets selector input of a Switch node. */ 3748 FIRM_API void set_Switch_selector(ir_node *node, ir_node *selector); 3749 /** Returns n_outs attribute of a Switch node. */ 3750 FIRM_API unsigned get_Switch_n_outs(const ir_node *node); 3751 /** Sets n_outs attribute of a Switch node. */ 3752 FIRM_API void set_Switch_n_outs(ir_node *node, unsigned n_outs); 3753 /** Returns table attribute of a Switch node. */ 3754 FIRM_API ir_switch_table* get_Switch_table(const ir_node *node); 3755 /** Sets table attribute of a Switch node. */ 3756 FIRM_API void set_Switch_table(ir_node *node, ir_switch_table* table); 3757 /** @} */ 3758 3759 /** 3760 * @defgroup SymConst SymConst node 3761 * 3762 * A symbolic constant. 3763 3764 - *symconst_type_size* The symbolic constant represents the size of a type. 3765 The type of which the constant represents the size 3766 is given explicitly. 3767 - *symconst_type_align* The symbolic constant represents the alignment of a 3768 type. The type of which the constant represents the 3769 size is given explicitly. 3770 - *symconst_addr_ent* The symbolic constant represents the address of an 3771 entity (variable or method). The variable is given 3772 explicitly by a firm entity. 3773 - *symconst_ofs_ent* The symbolic constant represents the offset of an 3774 entity in its owner type. 3775 - *symconst_enum_const* The symbolic constant is a enumeration constant of 3776 an enumeration type. 3777 * @{ 3778 */ 3779 3780 3781 /** 3782 * Test if node is a SymConst 3783 * @returns 1 if the node is a SymConst node, 0 otherwise 3784 */ 3785 FIRM_API int is_SymConst(const ir_node *node); 3786 3787 /** @} */ 3788 3789 /** 3790 * @defgroup Sync Sync node 3791 * 3792 * The Sync operation unifies several partial memory blocks. These blocks 3793 have to be pairwise disjunct or the values in common locations have to 3794 be identical. This operation allows to specify all operations that 3795 eventually need several partial memory blocks as input with a single 3796 entrance by unifying the memories with a preceding Sync operation. 3797 * @{ 3798 */ 3799 3800 3801 /** 3802 * Construct a Sync node. 3803 * 3804 * @param dbgi A pointer to debug information. 3805 * @param block The IR block the node belongs to. 3806 * @param arity size of additional inputs array 3807 * @param in additional inputs 3808 */ 3809 FIRM_API ir_node *new_rd_Sync(dbg_info *dbgi, ir_node *block, int arity, ir_node *const * in); 3810 3811 /** 3812 * Construct a Sync node. 3813 * 3814 * @param block The IR block the node belongs to. 3815 * @param arity size of additional inputs array 3816 * @param in additional inputs 3817 */ 3818 FIRM_API ir_node *new_r_Sync(ir_node *block, int arity, ir_node *const * in); 3819 3820 /** 3821 * Construct a Sync node. 3822 * 3823 * @param dbgi A pointer to debug information. 3824 * @param arity size of additional inputs array 3825 * @param in additional inputs 3826 */ 3827 FIRM_API ir_node *new_d_Sync(dbg_info *dbgi, int arity, ir_node *const * in); 3828 3829 /** 3830 * Construct a Sync node. 3831 * 3832 * @param arity size of additional inputs array 3833 * @param in additional inputs 3834 */ 3835 FIRM_API ir_node *new_Sync(int arity, ir_node *const * in); 3836 /** 3837 * Test if node is a Sync 3838 * @returns 1 if the node is a Sync node, 0 otherwise 3839 */ 3840 FIRM_API int is_Sync(const ir_node *node); 3841 3842 /** @} */ 3843 3844 /** 3845 * @defgroup Tuple Tuple node 3846 * 3847 * Builds a Tuple from single values. 3848 3849 This is needed to implement optimizations that remove a node that produced 3850 a tuple. The node can be replaced by the Tuple operation so that the 3851 following Proj nodes have not to be changed. (They are hard to find due to 3852 the implementation with pointers in only one direction.) The Tuple node is 3853 smaller than any other node, so that a node can be changed into a Tuple by 3854 just changing its opcode and giving it a new in array. 3855 * @{ 3856 */ 3857 3858 3859 /** 3860 * Construct a Tuple node. 3861 * 3862 * @param dbgi A pointer to debug information. 3863 * @param block The IR block the node belongs to. 3864 * @param arity size of additional inputs array 3865 * @param in additional inputs 3866 */ 3867 FIRM_API ir_node *new_rd_Tuple(dbg_info *dbgi, ir_node *block, int arity, ir_node *const * in); 3868 3869 /** 3870 * Construct a Tuple node. 3871 * 3872 * @param block The IR block the node belongs to. 3873 * @param arity size of additional inputs array 3874 * @param in additional inputs 3875 */ 3876 FIRM_API ir_node *new_r_Tuple(ir_node *block, int arity, ir_node *const * in); 3877 3878 /** 3879 * Construct a Tuple node. 3880 * 3881 * @param dbgi A pointer to debug information. 3882 * @param arity size of additional inputs array 3883 * @param in additional inputs 3884 */ 3885 FIRM_API ir_node *new_d_Tuple(dbg_info *dbgi, int arity, ir_node *const * in); 3886 3887 /** 3888 * Construct a Tuple node. 3889 * 3890 * @param arity size of additional inputs array 3891 * @param in additional inputs 3892 */ 3893 FIRM_API ir_node *new_Tuple(int arity, ir_node *const * in); 3894 /** 3895 * Test if node is a Tuple 3896 * @returns 1 if the node is a Tuple node, 0 otherwise 3897 */ 3898 FIRM_API int is_Tuple(const ir_node *node); 3899 3900 /** @} */ 3901 3902 /** 3903 * @defgroup Unknown Unknown node 3904 * 3905 * Returns an unknown (at compile- and runtime) value. It is a valid 3906 optimisation to replace an Unknown by any other constant value. 3907 * @{ 3908 */ 3909 3910 3911 /** 3912 * Construct an Unknown node. 3913 * 3914 * @param dbgi A pointer to debug information. 3915 * @param irg The IR graph the node belongs to. 3916 * @param mode mode of the operations result 3917 */ 3918 FIRM_API ir_node *new_rd_Unknown(dbg_info *dbgi, ir_graph *irg, ir_mode * mode); 3919 3920 /** 3921 * Construct an Unknown node. 3922 * 3923 * @param irg The IR graph the node belongs to. 3924 * @param mode mode of the operations result 3925 */ 3926 FIRM_API ir_node *new_r_Unknown(ir_graph *irg, ir_mode * mode); 3927 3928 /** 3929 * Construct an Unknown node. 3930 * 3931 * @param dbgi A pointer to debug information. 3932 * @param mode mode of the operations result 3933 */ 3934 FIRM_API ir_node *new_d_Unknown(dbg_info *dbgi, ir_mode * mode); 3935 3936 /** 3937 * Construct an Unknown node. 3938 * 3939 * @param mode mode of the operations result 3940 */ 3941 FIRM_API ir_node *new_Unknown(ir_mode * mode); 3942 /** 3943 * Test if node is a Unknown 3944 * @returns 1 if the node is a Unknown node, 0 otherwise 3945 */ 3946 FIRM_API int is_Unknown(const ir_node *node); 3947 3948 /** @} */ 3949 3950 /** @} */ 3951 3952 #include "end.h" 3953 3954 #endif 3955