00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #ifndef wn_core_INCLUDED
00045 #define wn_core_INCLUDED
00046
00047 #ifndef symtab_INCLUDED
00048 #include "symtab.h"
00049 #endif
00050
00051 #ifndef irbdata_INCLUDED
00052 #include "irbdata.h"
00053 #endif
00054
00055 #ifndef wintrinsic_INCLUDED
00056 #include "wintrinsic.h"
00057 #endif
00058 #ifndef wio_INCLUDED
00059 #include "wio.h"
00060 #endif
00061
00062 #ifndef defs_INCLUDED
00063 #include "defs.h"
00064 #endif
00065
00388 #define MAX_FIELD_ID 0x3ffe
00389 #define UNKNOWN_FIELD_ID 0x3fff
00390
00391 class WN;
00392 class STMT_WN;
00393
00394 typedef INT32 WN_OFFSET;
00395 typedef INT64 WN_ESIZE;
00396 typedef INT32 WN_MAP_ID;
00397
00398 typedef enum REGION_KIND {
00399 REGION_KIND_PRAGMA = 0x0,
00400 REGION_KIND_FUNC_ENTRY = 0x1,
00401 REGION_KIND_LOOP = 0x2,
00402 REGION_KIND_OLIMIT = 0x3,
00403 REGION_KIND_MP = 0x4,
00404 REGION_KIND_RPI = 0x5,
00405 REGION_KIND_COLD = 0x6,
00406 REGION_KIND_SWP = 0x7,
00407
00408 REGION_KIND_EH = 0x8,
00409 REGION_KIND_TRY = 0x8,
00410 REGION_KIND_CLEANUP = 0x9,
00411 REGION_KIND_EXC_SPEC = 0xa,
00412 REGION_KIND_MASK = 0xb,
00413 REGION_KIND_GUARD = 0xc,
00414 REGION_KIND_NULL_CLEANUP = 0xd,
00415
00416 #if defined(TARG_SL) //fork_joint
00417
00418 REGION_KIND_MINOR = 0x11,
00419 REGION_KIND_MAJOR = 0x12,
00420 REGION_KIND_SL2_ENCLOSING_REGION = 0x13,
00421 REGION_KIND_HOT = 0x14,
00422 #endif
00423 } REGION_KIND;
00424
00425 class WN {
00426 public:
00427 union {
00428 struct {
00429 union {
00430 WN_OFFSET load_offset;
00431 WN_OFFSET lda_offset;
00432 WN_OFFSET store_offset;
00433 WN_OFFSET idname_offset;
00434 INT32 num_entries;
00435 TY_IDX loadx_addr_ty;
00436 INT16 cvtl_bits;
00437 INT32 label_number;
00438 UINT32 call_flag;
00439 UINT32 if_flag;
00440 UINT32 io_flag;
00441 UINT32 asm_flag;
00442 UINT32 asm_operand_num;
00443 struct {
00444 mUINT16 trip_est;
00445 mUINT16 loop_depth;
00446 } li;
00447 struct {
00448 mUINT16 pragma_flags;
00449 mUINT16 pragma_id;
00450 } pragma;
00451 TY_IDX io_item_ty;
00452 struct {
00453 #if defined(TARG_SL)
00454 REGION_KIND region_kind: 7;
00455 mUINT32 region_id :25;
00456 #else
00457 REGION_KIND region_kind: 4;
00458 mUINT32 region_id :28;
00459 #endif
00460 } region;
00461 } ua;
00462 union {
00463 ST_IDX st_idx;
00464 TY_IDX ty;
00465
00466 INT32 id;
00467 INTRINSIC intrinsic;
00468 IOSTATEMENT iostatement;
00469 IOITEM ioitem;
00470 UINT32 prefetch_flag;
00471 UINT32 loop_flag;
00472 INT32 last_label;
00473 INITO_IDX ereg_supp;
00474 UINT32 label_level;
00475 } ub;
00476 } uu;
00477 WN_ESIZE element_size;
00478 } u1u2;
00479
00480
00481
00482
00483 struct {
00484 OPERATOR wn_operator : 8;
00485 TYPE_ID rtype : 6;
00486 mUINT32 kid_count :14;
00487 mINT64 map_id :30;
00488 TYPE_ID desc : 6;
00489 } common;
00490
00491 union {
00492 struct {
00493 WN *dummy1;
00494 TY_IDX ty;
00495 } ty_fields;
00496 WN *kids[2];
00497 INT64 const_val;
00498 struct {
00499 UINT32 num_inputs;
00500 UINT32 num_clobbers;
00501 } asm_fields;
00502 struct {
00503 WN *dummy2;
00504 UINT32 label_flag;
00505 } label_flag_fields;
00506 struct {
00507 WN *first;
00508 WN *last;
00509 } block;
00510
00511 union {
00512 INT64 pragma_arg64;
00513 struct {
00514 INT32 pragma_arg1;
00515 union {
00516 INT32 pragma_arg2;
00517 struct {
00518 mUINT32 pragma_asm_opnd_num : 8;
00519 PREG_NUM pragma_asm_copyout_preg : 24;
00520 } asm_pragma;
00521 };
00522 } up1;
00523 struct {
00524 mINT16 pragma_pad1;
00525 mINT8 pragma_distr_type;
00526 mINT8 pragma_index;
00527 INT32 pragma_preg;
00528 } up2;
00529 } pragma;
00530 } u3;
00531
00532 #if defined(TARG_SL)
00533
00534 struct
00535 {
00536 BOOL vbuf_ofst_adjusted;
00537 BOOL is_internal_mem_ofst;
00538 BOOL compgoto_para;
00539 BOOL compgoto_for_minor;
00540 }sl_ext;
00541
00542
00543 UINT32 div_in_actual;
00544 #define WN_div_in_actual(x) ((x)->div_in_actual)
00545 #define WN_Set_div_in_actual(x, y) (((x)->div_in_actual) = (y))
00546
00547 #define WN_vbuf_ofst_adjusted(x) ((x)->sl_ext.vbuf_ofst_adjusted)
00548 #define WN_Set_vbuf_ofst_adjusted(x) ((x)->sl_ext.vbuf_ofst_adjusted = TRUE)
00549
00550
00551 #define WN_is_internal_mem_ofst(x) ((x)->sl_ext.is_internal_mem_ofst)
00552 #define WN_Set_is_internal_mem_ofst(x) ((x)->sl_ext.is_internal_mem_ofst = TRUE)
00553
00554 #define WN_is_compgoto_para(x) ((x) ->sl_ext.compgoto_para)
00555 #define WN_Set_is_compgoto_para(x) ((x) ->sl_ext.compgoto_para = TRUE)
00556
00557 #define WN_is_compgoto_for_minor(x) ((x) ->sl_ext.compgoto_for_minor)
00558 #define WN_Set_is_compgoto_for_minor(x) ((x) ->sl_ext.compgoto_for_minor = TRUE)
00559 #endif // TARG_SL
00560
00561 #ifndef WN_NO_ACCESSOR_FUNCTIONS
00562
00563 WN () {}
00564 #pragma set woff 3201
00565 WN (const WN& wn) {}
00566 WN (const WN* wn) {}
00567 #pragma set woff 1116
00568 WN& operator= (const WN& wn) {}
00569 #pragma reset woff 1116
00570 #pragma reset woff 3201
00571 ~WN () {}
00572
00573 public:
00574
00575 friend inline WN_OFFSET WN_load_offset (const WN *);
00576 friend inline WN_OFFSET& WN_load_offset (WN *);
00577 friend inline WN_OFFSET WN_lda_offset (const WN *);
00578 friend inline WN_OFFSET& WN_lda_offset (WN *);
00579 friend inline WN_OFFSET WN_store_offset (const WN *);
00580 friend inline WN_OFFSET& WN_store_offset (WN *);
00581 friend inline WN_OFFSET WN_idname_offset (const WN *);
00582 friend inline WN_OFFSET& WN_idname_offset (WN *);
00583 friend inline WN_OFFSET WN_offset (const WN *);
00584 friend inline WN_OFFSET& WN_offset (WN *);
00585 friend inline INT32 WN_num_entries (const WN *);
00586 friend inline INT32& WN_num_entries (WN *);
00587
00588
00589 friend inline INT16 WN_cvtl_bits (const WN *);
00590 friend inline INT16& WN_cvtl_bits (WN *);
00591 friend inline INT32& WN_label_number (WN *);
00592 friend inline INT32 WN_label_number (const WN *);
00593 friend inline UINT32& WN_call_flag (WN *);
00594 friend inline UINT32 WN_call_flag (const WN *);
00595 friend inline UINT32& WN_if_flag (WN *);
00596 friend inline UINT32 WN_if_flag (const WN *);
00597 friend inline UINT32& WN_io_flag (WN *);
00598 friend inline UINT32 WN_io_flag (const WN *);
00599 friend inline UINT32& WN_asm_flag (WN *);
00600 friend inline UINT32 WN_asm_flag (const WN *);
00601 friend inline UINT32& WN_asm_num_inputs (WN *);
00602 friend inline UINT32 WN_asm_num_inputs (const WN *);
00603 friend inline UINT32& WN_asm_num_clobbers (WN *);
00604 friend inline UINT32 WN_asm_num_clobbers (const WN *);
00605 friend inline char * WN_asm_string (const WN *);
00606 friend inline char * WN_asm_input_constraint (const WN *);
00607 friend inline UINT32 WN_asm_opnd_num(const WN *);
00608 friend inline UINT32& WN_label_level (WN *);
00609 friend inline UINT32 WN_label_level (const WN *);
00610
00611 friend inline mUINT16 WN_loop_trip_est (const WN *);
00612 friend inline mUINT16& WN_loop_trip_est (WN *);
00613 friend inline mUINT16 WN_loop_depth (const WN *);
00614 friend inline mUINT16& WN_loop_depth (WN *);
00615
00616 friend inline mUINT16 WN_pragma_flags (const WN *);
00617 friend inline mUINT16& WN_pragma_flags (WN *);
00618 friend inline mUINT16 WN_pragma (const WN *);
00619 friend inline mUINT16& WN_pragma (WN *);
00620 friend inline UINT32 WN_pragma_asm_opnd_num (const WN *);
00621 friend inline void WN_set_pragma_asm_opnd_num (WN *, UINT32);
00622
00623
00624
00625
00626 friend inline REGION_KIND WN_region_kind (const WN *);
00627 friend inline void WN_set_region_kind (WN *, REGION_KIND);
00628 friend inline mUINT32 WN_region_id (const WN *);
00629 friend inline void WN_set_region_id (WN *, mUINT32);
00630
00631 friend inline ST_IDX WN_st_idx (const WN *);
00632 friend inline ST_IDX& WN_st_idx (WN *);
00633
00634
00635 friend inline INTRINSIC WN_intrinsic (const WN *);
00636 friend inline INTRINSIC& WN_intrinsic (WN *);
00637 friend inline IOSTATEMENT WN_io_statement(const WN *);
00638 friend inline IOSTATEMENT& WN_io_statement(WN *);
00639 friend inline IOITEM WN_io_item(const WN *);
00640 friend inline IOITEM& WN_io_item(WN *);
00641
00642
00643 friend inline UINT32 WN_prefetch_flag (const WN *);
00644 friend inline UINT32& WN_prefetch_flag (WN *);
00645 friend inline UINT32 WN_loop_flag (const WN *);
00646 friend inline UINT32& WN_loop_flag (WN *);
00647 friend inline INT32 WN_last_label (const WN *);
00648 friend inline INT32& WN_last_label (WN *);
00649 friend inline INITO_IDX WN_ereg_supp (const WN *);
00650 friend inline INITO_IDX& WN_ereg_supp (WN *);
00651
00652 friend inline WN_ESIZE WN_element_size (const WN *);
00653 friend inline WN_ESIZE& WN_element_size (WN *);
00654
00655 friend inline OPERATOR WN_operator (const WN *);
00656 friend inline void WN_set_operator (WN *, OPERATOR);
00657 friend inline TYPE_ID WN_rtype (const WN *);
00658 friend inline void WN_set_rtype (WN *, TYPE_ID);
00659 friend inline INT WN_kid_count (const WN *);
00660 friend inline void WN_set_kid_count (WN *, UINT);
00661 friend inline UINT WN_field_id (const WN *);
00662 friend inline void WN_set_field_id (WN *, UINT);
00663 friend inline UINT WN_bit_offset (const WN *);
00664 friend inline void WN_set_bit_offset (WN *, UINT);
00665 friend inline UINT WN_bit_size (const WN *);
00666 friend inline void WN_set_bit_size (WN *, UINT);
00667 friend inline TYPE_ID WN_desc (const WN *);
00668 friend inline void WN_set_desc (WN *, TYPE_ID);
00669 friend inline INT32 WN_map_id (const WN *);
00670
00671 friend inline TY_IDX WN_ty (const WN *, const int);
00672 friend inline TY_IDX& WN_ty (WN *, const int);
00673 friend inline WN* WN_kid (const WN *, const int);
00674 friend inline WN*& WN_kid (WN *, const int);
00675 friend inline WN* WN_kid0 (const WN *);
00676 friend inline WN*& WN_kid0 (WN *);
00677 friend inline WN* WN_kid1 (const WN *);
00678 friend inline WN*& WN_kid1 (WN *);
00679 friend inline WN* WN_kid2 (const WN *);
00680 friend inline WN*& WN_kid2 (WN *);
00681 friend inline WN* WN_kid3 (const WN *);
00682 friend inline WN*& WN_kid3 (WN *);
00683 friend inline INT64 WN_const_val (const WN *);
00684 friend inline INT64& WN_const_val (WN *);
00685 friend inline UINT32 WN_label_flag (const WN *);
00686 friend inline UINT32& WN_label_flag (WN *);
00687
00688 friend inline WN* WN_first (const WN *);
00689 friend inline WN*& WN_first (WN *);
00690 friend inline WN* WN_last (const WN *);
00691 friend inline WN*& WN_last (WN *);
00692
00693 friend inline INT64 WN_pragma_arg64 (const WN *);
00694 friend inline INT64& WN_pragma_arg64 (WN *);
00695 friend inline INT32 WN_pragma_arg1 (const WN *);
00696 friend inline INT32& WN_pragma_arg1 (WN *);
00697 friend inline INT32 WN_pragma_arg2 (const WN *);
00698 friend inline INT32& WN_pragma_arg2 (WN *);
00699 friend inline mINT8 WN_pragma_distr_type (const WN *);
00700 friend inline mINT8& WN_pragma_distr_type (WN *);
00701 friend inline mINT8 WN_pragma_index (const WN *);
00702 friend inline mINT8& WN_pragma_index (WN *);
00703 friend inline INT32 WN_pragma_preg (const WN *);
00704 friend inline INT32& WN_pragma_preg (WN *);
00705
00706 friend inline char * WN_pragma_asm_constraint (const WN *);
00707 friend inline PREG_NUM WN_pragma_asm_copyout_preg (const WN *);
00708 friend inline void WN_set_pragma_asm_copyout_preg (WN *, PREG_NUM);
00709
00710 friend inline OPCODE WN_opcode (const WN*);
00711 friend inline void WN_set_opcode (WN*, OPCODE);
00712 friend inline TY_IDX WN_ty (const WN*);
00713 friend inline void WN_set_ty (WN*, TY_IDX);
00714 friend inline TY_IDX WN_load_addr_ty (const WN *);
00715 friend inline void WN_set_load_addr_ty (WN*, TY_IDX);
00716
00717 friend inline void WN_Copy_u1u2 (WN*, const WN*);
00718 friend inline void WN_Copy_u3 (WN*, const WN*);
00719
00720 #if defined(TARG_SL)
00721
00722 friend inline void WN_Copy_sl_ext(WN* , const WN*);
00723 #endif
00724 #endif
00725 };
00726
00727 #ifndef WN_NO_ACCESSOR_FUNCTIONS
00728
00729 inline WN_OFFSET WN_load_offset (const WN* wn) { return wn->u1u2.uu.ua.load_offset; }
00730 inline WN_OFFSET& WN_load_offset (WN* wn) { return wn->u1u2.uu.ua.load_offset; }
00731 inline WN_OFFSET WN_lda_offset (const WN* wn) { return wn->u1u2.uu.ua.lda_offset; }
00732 inline WN_OFFSET& WN_lda_offset (WN* wn) { return wn->u1u2.uu.ua.lda_offset; }
00733 inline WN_OFFSET WN_store_offset (const WN* wn) { return wn->u1u2.uu.ua.store_offset; }
00734 inline WN_OFFSET& WN_store_offset (WN* wn) { return wn->u1u2.uu.ua.store_offset; }
00735 inline WN_OFFSET WN_idname_offset (const WN* wn) { return wn->u1u2.uu.ua.idname_offset; }
00736 inline WN_OFFSET& WN_idname_offset (WN* wn) { return wn->u1u2.uu.ua.idname_offset; }
00737 inline WN_OFFSET WN_offset (const WN* wn) { return wn->u1u2.uu.ua.idname_offset; }
00738 inline WN_OFFSET& WN_offset (WN* wn) { return wn->u1u2.uu.ua.idname_offset; }
00739 inline INT32 WN_num_entries (const WN* wn) { return wn->u1u2.uu.ua.num_entries; }
00740 inline INT32& WN_num_entries (WN* wn) { return wn->u1u2.uu.ua.num_entries; }
00741 inline INT16 WN_cvtl_bits (const WN* wn) { return wn->u1u2.uu.ua.cvtl_bits; }
00742 inline INT16& WN_cvtl_bits (WN* wn) { return wn->u1u2.uu.ua.cvtl_bits; }
00743 inline INT32 WN_label_number (const WN* wn) { return wn->u1u2.uu.ua.label_number; }
00744 inline INT32& WN_label_number (WN* wn) { return wn->u1u2.uu.ua.label_number; }
00745 inline UINT32 WN_call_flag (const WN* wn) { return wn->u1u2.uu.ua.call_flag; }
00746 inline UINT32& WN_call_flag (WN* wn) { return wn->u1u2.uu.ua.call_flag; }
00747 inline UINT32 WN_if_flag (const WN* wn) { return wn->u1u2.uu.ua.if_flag; }
00748 inline UINT32& WN_if_flag (WN* wn) { return wn->u1u2.uu.ua.if_flag; }
00749 inline UINT32 WN_io_flag (const WN* wn) { return wn->u1u2.uu.ua.io_flag; }
00750 inline UINT32& WN_io_flag (WN* wn) { return wn->u1u2.uu.ua.io_flag; }
00751 inline UINT32 WN_asm_flag (const WN *wn) { return wn->u1u2.uu.ua.asm_flag; }
00752 inline UINT32& WN_asm_flag (WN *wn) { return wn->u1u2.uu.ua.asm_flag; }
00753 inline UINT32 WN_label_level (const WN *wn) { return wn->u1u2.uu.ub.label_level; }
00754 inline UINT32& WN_label_level (WN *wn) { return wn->u1u2.uu.ub.label_level; }
00755 inline mUINT16 WN_loop_trip_est (const WN* wn) { return wn->u1u2.uu.ua.li.trip_est; }
00756 inline mUINT16& WN_loop_trip_est (WN* wn) { return wn->u1u2.uu.ua.li.trip_est; }
00757 inline mUINT16 WN_loop_depth (const WN* wn) { return wn->u1u2.uu.ua.li.loop_depth; }
00758 inline mUINT16& WN_loop_depth (WN* wn) { return wn->u1u2.uu.ua.li.loop_depth; }
00759 inline mUINT16 WN_pragma_flags (const WN* wn) { return wn->u1u2.uu.ua.pragma.pragma_flags; }
00760 inline mUINT16& WN_pragma_flags (WN* wn) { return wn->u1u2.uu.ua.pragma.pragma_flags; }
00761 inline mUINT16 WN_pragma (const WN* wn) { return wn->u1u2.uu.ua.pragma.pragma_id; }
00762 inline mUINT16& WN_pragma (WN* wn) { return wn->u1u2.uu.ua.pragma.pragma_id; }
00763
00764 inline char *WN_pragma_asm_constraint(const WN *wn) { return ST_name(&St_Table[(ST_IDX) WN_pragma_arg1(wn)]); }
00765 inline PREG_NUM WN_pragma_asm_copyout_preg(const WN *wn) { return wn->u3.pragma.up1.asm_pragma.pragma_asm_copyout_preg; }
00766 inline void WN_set_pragma_asm_copyout_preg(WN *wn, PREG_NUM r) { wn->u3.pragma.up1.asm_pragma.pragma_asm_copyout_preg = r; }
00767 inline UINT32 WN_pragma_asm_opnd_num(const WN *wn) { return wn->u3.pragma.up1.asm_pragma.pragma_asm_opnd_num; }
00768 inline void WN_set_pragma_asm_opnd_num(WN *wn, UINT32 i) { wn->u3.pragma.up1.asm_pragma.pragma_asm_opnd_num = i; }
00769
00770 inline REGION_KIND WN_region_kind (const WN* wn) { return wn->u1u2.uu.ua.region.region_kind; }
00771 inline void WN_set_region_kind (WN* wn, REGION_KIND k) { wn->u1u2.uu.ua.region.region_kind = k; }
00772 inline mUINT32 WN_region_id (const WN* wn) { return wn->u1u2.uu.ua.region.region_id; }
00773 inline void WN_set_region_id (WN* wn, mUINT32 i) { wn->u1u2.uu.ua.region.region_id = i; }
00774
00775 inline ST_IDX WN_st_idx (const WN* wn) { return wn->u1u2.uu.ub.st_idx; }
00776 inline ST_IDX& WN_st_idx (WN* wn) { return wn->u1u2.uu.ub.st_idx; }
00777 inline INTRINSIC WN_intrinsic (const WN* wn) { return wn->u1u2.uu.ub.intrinsic; }
00778 inline INTRINSIC& WN_intrinsic (WN* wn) { return wn->u1u2.uu.ub.intrinsic; }
00779 inline IOSTATEMENT WN_io_statement(const WN* wn) { return wn->u1u2.uu.ub.iostatement; }
00780 inline IOSTATEMENT& WN_io_statement(WN* wn) { return wn->u1u2.uu.ub.iostatement; }
00781 inline IOITEM WN_io_item(const WN* wn) { return wn->u1u2.uu.ub.ioitem; }
00782 inline IOITEM & WN_io_item(WN* wn) { return wn->u1u2.uu.ub.ioitem; }
00783 inline UINT32 WN_prefetch_flag (const WN* wn) { return wn->u1u2.uu.ub.prefetch_flag; }
00784 inline UINT32& WN_prefetch_flag (WN* wn) { return wn->u1u2.uu.ub.prefetch_flag; }
00785 inline UINT32 WN_loop_flag (const WN* wn) { return wn->u1u2.uu.ub.loop_flag; }
00786 inline UINT32& WN_loop_flag (WN* wn) { return wn->u1u2.uu.ub.loop_flag; }
00787 inline INT32 WN_last_label (const WN* wn) { return wn->u1u2.uu.ub.last_label; }
00788 inline INT32& WN_last_label (WN* wn) { return wn->u1u2.uu.ub.last_label; }
00789 inline INITO_IDX WN_ereg_supp (const WN* wn) { return wn->u1u2.uu.ub.ereg_supp; }
00790 inline INITO_IDX& WN_ereg_supp (WN* wn) { return wn->u1u2.uu.ub.ereg_supp; }
00791 inline WN_ESIZE WN_element_size (const WN* wn) { return wn->u1u2.element_size; }
00792 inline WN_ESIZE& WN_element_size (WN* wn) { return wn->u1u2.element_size; }
00793
00794 inline OPERATOR WN_operator (const WN* wn) { return wn->common.wn_operator; }
00795 inline void WN_set_operator (WN* wn, OPERATOR opr) { wn->common.wn_operator = opr; }
00796 inline TYPE_ID WN_rtype (const WN* wn) { return wn->common.rtype; }
00797 inline void WN_set_rtype (WN* wn, TYPE_ID ty) { wn->common.rtype = ty; }
00798 inline INT WN_kid_count (const WN* wn) { return OPERATOR_nkids(WN_operator(wn)) == -1 ? wn->common.kid_count : OPERATOR_nkids(WN_operator(wn)); }
00799 inline void WN_set_kid_count (WN* wn, UINT n) { if (OPERATOR_nkids(WN_operator(wn)) == -1) wn->common.kid_count = n; }
00800 inline UINT32 WN_field_id (const WN* wn) { return wn->common.kid_count; }
00801 inline void WN_set_field_id (WN* wn, UINT n) { wn->common.kid_count = (n > MAX_FIELD_ID) ? UNKNOWN_FIELD_ID : n; }
00802 inline UINT WN_bit_offset (const WN* wn) { return wn->common.kid_count >> 7; }
00803 inline UINT WN_bit_size (const WN* wn) { return wn->common.kid_count & 0x7f; }
00804 inline void WN_set_bit_offset_size (WN* wn, UINT ofst, UINT siz) { wn->common.kid_count = ((ofst << 7) + siz); }
00805 inline TYPE_ID WN_desc (const WN* wn) { return wn->common.desc; }
00806 inline void WN_set_desc (WN* wn, TYPE_ID ty) { wn->common.desc = ty; }
00807 inline INT32 WN_map_id (const WN* wn) { return wn->common.map_id; }
00808 inline void WN_set_map_id (WN* wn, INT32 m) { wn->common.map_id = m; }
00809
00810 inline WN* WN_kid (const WN* wn, int i) { return wn->u3.kids [i]; }
00811 inline WN*& WN_kid (WN* wn, int i) { return wn->u3.kids [i]; }
00812 inline WN* WN_kid0 (const WN* wn) { return wn->u3.kids [0]; }
00813 inline WN*& WN_kid0 (WN* wn) { return wn->u3.kids [0]; }
00814 inline WN* WN_kid1 (const WN* wn) { return wn->u3.kids [1]; }
00815 inline WN*& WN_kid1 (WN* wn) { return wn->u3.kids [1]; }
00816 #pragma set woff 1172
00817 inline WN* WN_kid2 (const WN* wn) { return wn->u3.kids [2]; }
00818 inline WN*& WN_kid2 (WN* wn) { return wn->u3.kids [2]; }
00819 inline WN* WN_kid3 (const WN* wn) { return wn->u3.kids [3]; }
00820 inline WN*& WN_kid3 (WN* wn) { return wn->u3.kids [3]; }
00821 #pragma reset woff 1172
00822 inline INT64 WN_const_val (const WN* wn) { return wn->u3.const_val; }
00823 inline INT64& WN_const_val (WN* wn) { return wn->u3.const_val; }
00824 inline UINT32 WN_label_flag (const WN* wn) { return wn->u3.label_flag_fields.label_flag; }
00825 inline UINT32& WN_label_flag (WN* wn) { return wn->u3.label_flag_fields.label_flag; }
00826 inline WN* WN_first (const WN* wn) { return wn->u3.block.first; }
00827 inline WN*& WN_first (WN* wn) { return wn->u3.block.first; }
00828 inline WN* WN_last (const WN* wn) { return wn->u3.block.last; }
00829 inline WN*& WN_last (WN* wn) { return wn->u3.block.last; }
00830 inline UINT32 WN_asm_num_inputs (const WN *wn) { return wn->u3.asm_fields.num_inputs; }
00831 inline UINT32& WN_asm_num_inputs (WN *wn) { return wn->u3.asm_fields.num_inputs; }
00832 inline UINT32 WN_asm_opnd_num (const WN *wn) { return wn->u1u2.uu.ua.asm_operand_num; }
00833 inline UINT32& WN_asm_opnd_num (WN *wn) { return wn->u1u2.uu.ua.asm_operand_num; }
00834 inline UINT32 WN_asm_num_clobbers (const WN *wn) { return wn->u3.asm_fields.num_clobbers; }
00835 inline UINT32& WN_asm_num_clobbers (WN *wn) { return wn->u3.asm_fields.num_clobbers; }
00836 inline INT64 WN_pragma_arg64 (const WN* wn) { return wn->u3.pragma.pragma_arg64; }
00837 inline INT64& WN_pragma_arg64 (WN* wn) { return wn->u3.pragma.pragma_arg64; }
00838 inline INT32 WN_pragma_arg1 (const WN* wn) { return wn->u3.pragma.up1.pragma_arg1; }
00839 inline INT32& WN_pragma_arg1 (WN* wn) { return wn->u3.pragma.up1.pragma_arg1; }
00840 inline INT32 WN_pragma_arg2 (const WN* wn) { return wn->u3.pragma.up1.pragma_arg2; }
00841 inline INT32& WN_pragma_arg2 (WN* wn) { return wn->u3.pragma.up1.pragma_arg2; }
00842 inline mINT8 WN_pragma_distr_type (const WN* wn) { return wn->u3.pragma.up2.pragma_distr_type; }
00843 inline mINT8& WN_pragma_distr_type (WN* wn) { return wn->u3.pragma.up2.pragma_distr_type; }
00844 inline mINT8 WN_pragma_index (const WN* wn) { return wn->u3.pragma.up2.pragma_index; }
00845 inline mINT8& WN_pragma_index (WN* wn) { return wn->u3.pragma.up2.pragma_index; }
00846 inline INT32 WN_pragma_preg (const WN* wn) { return wn->u3.pragma.up2.pragma_preg; }
00847 inline INT32& WN_pragma_preg (WN* wn) { return wn->u3.pragma.up2.pragma_preg; }
00848
00849
00850
00851 inline void WN_Copy_u1u2 (WN* dst, const WN* src) { dst->u1u2 = src->u1u2; }
00852 inline void WN_Copy_u3 (WN* dst, const WN* src) { dst->u3 = src->u3; }
00853
00854 #if defined(TARG_SL) || defined(TARG_SL2)
00855 inline void WN_Copy_sl_ext(WN* dst, const WN* src) { dst->sl_ext = src->sl_ext; }
00856 #endif
00857
00858 #else
00859
00860 #define WN_load_offset(x) ((x)->u1u2.uu.ua.load_offset)
00861 #define WN_lda_offset(x) ((x)->u1u2.uu.ua.lda_offset)
00862 #define WN_store_offset(x) ((x)->u1u2.uu.ua.store_offset)
00863 #define WN_idname_offset(x) ((x)->u1u2.uu.ua.idname_offset)
00864 #define WN_offset(x) ((x)->u1u2.uu.ua.idname_offset)
00865 #define WN_num_entries(x) ((x)->u1u2.uu.ua.num_entries)
00866 #define WN_cvtl_bits(x) ((x)->u1u2.uu.ua.cvtl_bits)
00867 #define WN_label_number(x) ((x)->u1u2.uu.ua.label_number)
00868 #define WN_call_flag(x) ((x)->u1u2.uu.ua.call_flag)
00869 #define WN_if_flag(x) ((x)->u1u2.uu.ua.if_flag)
00870 #define WN_io_flag(x) ((x)->u1u2.uu.ua.io_flag)
00871 #define WN_asm_flag(x) ((x)->u1u2.uu.ua.asm_flag)
00872 #define WN_asm_string(x) (ST_name(WN_st(x)))
00873 #define WN_asm_input_constraint(x) (ST_name(WN_st(x)))
00874 #define WN_loop_trip_est(x) ((x)->u1u2.uu.ua.li.trip_est)
00875 #define WN_loop_depth(x) ((x)->u1u2.uu.ua.li.loop_depth)
00876 #define WN_pragma_flags(x) ((x)->u1u2.uu.ua.pragma.pragma_flags)
00877 #define WN_pragma(x) ((x)->u1u2.uu.ua.pragma.pragma_id)
00878 #define WN_pragma_asm_constraint(x) (ST_name(&St_Table[(ST_IDX) WN_pragma_arg1(wn)]))
00879 #define WN_pragma_asm_copyout_preg(x) ((PREG_NUM) (x)->u3.pragma.up1.asm_pragma.pragma_asm_copyout_preg)
00880 #define WN_pragma_asm_opnd_num(x) ((x)->u3.pragma.up1.asm_pragma.pragma_asm_opnd_num)
00881 #define WN_region_kind(x) ((REGION_KIND)((x)->u1u2.uu.ua.region.region_kind))
00882 #define WN_set_region_kind(x,y) ((x)->u1u2.uu.ua.region.region_kind = y)
00883 #define WN_region_id(x) ((mUINT32)((x)->u1u2.uu.ua.region.region_id))
00884 #define WN_st_idx(x) ((x)->u1u2.uu.ub.st_idx)
00885 #define WN_intrinsic(x) ((x)->u1u2.uu.ub.intrinsic)
00886 #define WN_io_statement(x) ((x)->u1u2.uu.ub.iostatement)
00887 #define WN_io_item(x) ((x)->u1u2.uu.ub.ioitem)
00888 #define WN_prefetch_flag(x) ((x)->u1u2.uu.ub.prefetch_flag)
00889 #define WN_loop_flag(x) ((x)->u1u2.uu.ub.loop_flag)
00890 #define WN_last_label(x) ((x)->u1u2.uu.ub.last_label)
00891 #define WN_ereg_supp(x) ((x)->u1u2.uu.ub.ereg_supp)
00892
00893 #define WN_asm_num_inputs(x) ((x)->u3.asm_fields.num_inputs)
00894 #define WN_asm_num_clobbers(x) ((x)->u3.asm_fields.num_clobbers)
00895
00896 #define WN_asm_opnd_num(x) ((x)->u1u2.uu.ua.asm_operand_num)
00897
00898 #define WN_element_size(x) ((x)->u1u2.element_size)
00899
00900 #define WN_operator(x) ((OPERATOR) (x)->common.wn_operator)
00901 #define WN_set_operator(x,y) ((x)->common.wn_operator = y)
00902 #define WN_rtype(x) ((TYPE_ID) (x)->common.rtype)
00903 #define WN_set_rtype(x,y) ((x)->common.rtype = y)
00904 #define WN_kid_count(x) (OPERATOR_nkids(WN_operator(x)) == -1 ? (x)->common.kid_count : OPERATOR_nkids(WN_operator(x)))
00905 #define WN_set_kid_count(x,y) if (OPERATOR_nkids(WN_operator(x)) == -1) (x)->common.kid_count = y; else
00906 #define WN_field_id(x) ((x)->common.kid_count)
00907 #define WN_set_field_id(x,y) ((x)->common.kid_count = (y > MAX_FIELD_ID) ? UNKNOWN_FIELD_ID : y)
00908 #define WN_bit_offset(x) ((x)->common.kid_count >> 7)
00909 #define WN_bit_size(x) ((x)->common.kid_count & 0x7f)
00910 #define WN_set_bit_offset_size(x,y,z) ((x)->common.kid_count = ((y << 7) + z))
00911 #define WN_desc(x) ((TYPE_ID) (x)->common.desc)
00912 #define WN_set_desc(x,y) ((x)->common.desc = y)
00913 #define WN_map_id(x) ((x)->common.map_id)
00914
00915 #define WN_kid(x,i) ((x)->u3.kids[i])
00916 #define WN_kid0(x) WN_kid((x),0)
00917 #define WN_kid1(x) WN_kid((x),1)
00918 #define WN_kid2(x) WN_kid((x),2)
00919 #define WN_kid3(x) WN_kid((x),3)
00920 #define WN_const_val(x) ((x)->u3.const_val)
00921 #define WN_label_flag(x) ((x)->u3.label_flag_fields.label_flag)
00922 #define WN_first(x) ((x)->u3.block.first)
00923 #define WN_last(x) ((x)->u3.block.last)
00924 #define WN_pragma_arg64(x) ((x)->u3.pragma.pragma_arg64)
00925 #define WN_pragma_arg1(x) ((x)->u3.pragma.up1.pragma_arg1)
00926 #define WN_pragma_arg2(x) ((x)->u3.pragma.up1.pragma_arg2)
00927 #define WN_pragma_distr_type(x) ((x)->u3.pragma.up2.pragma_distr_type)
00928 #define WN_pragma_index(x) ((x)->u3.pragma.up2.pragma_index)
00929 #define WN_pragma_preg(x) ((x)->u3.pragma.up2.pragma_preg)
00930
00931 #define WN_Copy_u1u2(x,y) ((x)->u1u2 = (y)->u1u2)
00932 #define WN_Copy_u3(x,y) ((x)->u3 = (y)->u3)
00933
00934 #endif
00935
00936 #define WN_num_dim(x) (WN_kid_count(x)>>1)
00937
00938 #define WN_asm_clobbers(x) (WN_kid0(x))
00939 #define WN_asm_constraints(x) (WN_kid1(x))
00940
00941 inline OPCODE
00942 WN_opcode (const WN *wn) {
00943 return OPCODE_make_op (wn->common.wn_operator,
00944 wn->common.rtype,
00945 wn->common.desc);
00946 }
00947
00948 inline void
00949 WN_set_opcode (WN *wn, OPCODE opc) {
00950 wn->common.wn_operator = OPCODE_operator(opc);
00951 wn->common.rtype = OPCODE_rtype(opc);
00952 wn->common.desc = OPCODE_desc(opc);
00953 }
00954
00955 class STMT_WN {
00956 public:
00957 WN *prev;
00958 WN *next;
00959 mUINT64 linenum;
00960 WN wn;
00961
00962 #ifndef WN_NO_ACCESSOR_FUNCTIONS
00963 friend inline WN* WN_prev (const WN*);
00964 friend inline WN*& WN_prev (WN*);
00965 friend inline WN* WN_next (const WN*);
00966 friend inline WN*& WN_next (WN*);
00967 friend inline mUINT64 WN_linenum (const WN*);
00968 friend inline mUINT64& WN_linenum (WN*);
00969 friend inline void* WN_StartAddress (WN*);
00970 friend inline WN* WN_prev_free (const STMT_WN*);
00971 friend inline WN*& WN_prev_free (STMT_WN*);
00972 friend inline WN& WN_real_fields (STMT_WN*);
00973 #endif
00974 };
00975
00976 inline UINTPS WN_offset_in_STMT_WN(const WN *x)
00977 {
00978 return (UINTPS) &(((STMT_WN*) x)->wn) - (UINTPS) x;
00979 }
00980
00981 inline STMT_WN* WN_cast_WN_to_STMT_WN(const WN *x)
00982 {
00983 return (STMT_WN *) ((UINTPS) x - WN_offset_in_STMT_WN(x));
00984 }
00985
00986 #ifndef WN_NO_ACCESSOR_FUNCTIONS
00987 inline WN* WN_prev (const WN* wn) { return (WN_cast_WN_to_STMT_WN(wn)->prev); }
00988 inline WN*& WN_prev (WN* wn) { return (WN_cast_WN_to_STMT_WN(wn)->prev); }
00989 inline WN* WN_next (const WN* wn) { return (WN_cast_WN_to_STMT_WN(wn)->next); }
00990 inline WN*& WN_next (WN* wn) { return (WN_cast_WN_to_STMT_WN(wn)->next); }
00991 inline mUINT64 WN_linenum (const WN* wn) { return (WN_cast_WN_to_STMT_WN(wn)->linenum); }
00992 inline mUINT64& WN_linenum (WN* wn) { return (WN_cast_WN_to_STMT_WN(wn)->linenum); }
00993 inline WN* WN_prev_free (const STMT_WN* stmt_wn) { return stmt_wn->prev; }
00994 inline WN*& WN_prev_free (STMT_WN* stmt_wn) { return stmt_wn->prev; }
00995 inline WN& WN_real_fields (STMT_WN* stmt_wn) { return stmt_wn->wn; }
00996 #else
00997 #define WN_next(x) (WN_cast_WN_to_STMT_WN(x)->next)
00998 #define WN_next_func(x) (WN_cast_WN_to_STMT_WN(x)->next)
00999 #define WN_prev(x) (WN_cast_WN_to_STMT_WN(x)->prev)
01000 #define WN_linenum(x) (WN_cast_WN_to_STMT_WN(x)->linenum)
01001
01002
01003 #define WN_real_fields(x) ((x)->wn)
01004 #define WN_prev_free(x) ((x)->prev)
01005 #endif
01006
01007 #define WN_has_sym(x) (OPERATOR_has_sym(WN_operator(x)))
01008
01009
01010 inline ST *
01011 WN_st (const WN *x)
01012 {
01013 Is_True(WN_has_sym(x), ("WN_st: wn doesn't have ST field"));
01014 Is_True(ST_IDX_index(WN_st_idx(x)) != 0 ||
01015 WN_st_idx(x) == 0,
01016 ("WN_st: zero index in nonzero level disallowed"));
01017 return (WN_st_idx(x) != 0 ?
01018 &St_Table[WN_st_idx(x)] :
01019 NULL);
01020 }
01021
01022 #ifndef WN_NO_ACCESSOR_FUNCTIONS
01023 inline char * WN_asm_string(const WN *wn) { return ST_name(WN_st(wn)); }
01024 inline char * WN_asm_input_constraint(const WN *wn) { return ST_name(WN_st(wn)); }
01025 #endif
01026
01027 #define WN_parm_flag(x) WN_call_flag(x)
01028 #define WN_region_is_EH(x) (WN_region_kind(x) & REGION_KIND_EH)
01029 #define WN_label_loop_info(x) \
01030 (WN_kid_count(x)>0 ? WN_kid((x),0) : NULL)
01031 #define WN_set_label_loop_info(x,li) (WN_kid0(x) = (li))
01032
01033
01034
01035 #define WN_PRAGMA_COMPILER_GENERATED 0x01
01036 #define WN_PRAGMA_OMP 0x02
01037
01038 #define WN_pragma_compiler_generated(x) ((WN_pragma_flags(x))&WN_PRAGMA_COMPILER_GENERATED)
01039 #define WN_set_pragma_compiler_generated(x) ((WN_pragma_flags(x))|=WN_PRAGMA_COMPILER_GENERATED)
01040 #define WN_pragma_omp(x) ((WN_pragma_flags(x)) & WN_PRAGMA_OMP)
01041 #define WN_set_pragma_omp(x) ((WN_pragma_flags(x)) |= WN_PRAGMA_OMP)
01042 #define WN_reset_pragma_omp(x) ((WN_pragma_flags(x)) &= ~(WN_PRAGMA_OMP))
01043
01044
01045 #define WN_entry_name(x) WN_st_idx(x)
01046 #define WN_formal(x,i) WN_kid((x),i)
01047 #define WN_num_formals(x) (WN_kid_count(x)-3)
01048 #define WN_func_pragmas(x) WN_kid((x),WN_kid_count(x)-3)
01049 #define WN_func_varrefs(x) WN_kid((x),WN_kid_count(x)-2)
01050 #define WN_func_body(x) WN_kid((x),WN_kid_count(x)-1)
01051 #define WN_entry_first(x) WN_first(WN_func_body(x))
01052 #define WN_entry_last(x) WN_last(WN_func_body(x))
01053 #define WN_actual(x,i) WN_kid((x),i)
01054
01055
01056 #define WN_index(x) WN_kid((x),0)
01057 #define WN_start(x) WN_kid((x),1)
01058 #define WN_end(x) WN_kid((x),2)
01059 #define WN_step(x) WN_kid((x),3)
01060 #define WN_do_body(x) WN_kid((x),4)
01061 #define WN_do_loop_info(x) \
01062 (WN_kid_count(x)>5 ? WN_kid((x),5) : NULL)
01063 #define WN_set_do_loop_info(x,li) (WN_kid((x),5) = (li))
01064
01065 #define WN_while_test(x) WN_kid((x),0)
01066 #define WN_while_body(x) WN_kid((x),1)
01067
01068 #define WN_if_test(x) WN_kid((x),0)
01069 #define WN_then(x) WN_kid((x),1)
01070 #define WN_else(x) WN_kid((x),2)
01071 #define WN_else_is_empty(x) (WN_first(WN_else(x)) == NULL)
01072
01073 #define WN_region_exits(x) WN_kid((x),0)
01074 #define WN_region_pragmas(x) WN_kid((x),1)
01075 #define WN_region_body(x) WN_kid((x),2)
01076
01077 #define WN_array_index(x,i) WN_kid((x),WN_num_dim(x)+i+1)
01078 #define WN_array_dim(x,i) WN_kid((x),i+1)
01079 #define WN_array_base(x) WN_kid((x),0)
01080
01081
01082 #define WN_loop_induction(x)\
01083 (WN_kid_count(x)>0 ? WN_kid((x),0) : NULL)
01084 #define WN_set_loop_induction(x,ind) (WN_kid((x),0) = (ind))
01085 #define WN_loop_trip(x) \
01086 (WN_kid_count(x)>1 ? WN_kid((x),1) : NULL)
01087 #define WN_set_loop_trip(x,trip) (WN_kid((x),1) = (trip))
01088
01089
01090 #define WN_switch_test(x) WN_kid((x),0)
01091 #define WN_switch_table(x) WN_kid((x),1)
01092 #define WN_switch_default(x) WN_kid((x),2)
01093
01094 #ifndef KEY
01095 #if defined(_LP64) && !defined(_SGI_COMPILER_VERSION)
01096
01097 #else
01098 #define max(a,b) ((a > b) ? a : b)
01099 #endif
01100 #endif
01101
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134 #define WN_operator_is(x,y) (WN_operator(x)==(y))
01135
01136
01137 #define WN_class(x) (ST_class(WN_st(x)))
01138 #define WN_sclass(x) (ST_sclass(WN_st(x)))
01139 #define WN_type(x) (ST_type(WN_st(x)))
01140
01141 inline TCON&
01142 WN_val (const WN *x) { return ST_tcon_val (WN_st(x)); }
01143
01144 inline TYPE_ID
01145 WN_val_type (const WN *x) { return TCON_ty (WN_val (x)); }
01146
01147
01148 #define WN_has_map_id(x) (WN_map_id(x)!= -1)
01149
01150 #define WN_block_empty(x) (WN_first(x) == NULL)
01151 #define WN_block_nonempty(x) (WN_first(x) != NULL)
01152
01153
01154
01155
01156
01157
01158
01159 inline TY_IDX WN_ty(const WN *wn)
01160 {
01161 OPERATOR opr;
01162 opr = WN_operator(wn);
01163 if ((opr == OPR_LDA) || (opr == OPR_LDID) || (opr == OPR_STID) ||
01164 (opr == OPR_LDBITS) || (opr == OPR_STBITS)) {
01165 return(wn->u3.ty_fields.ty);
01166 } else if (opr == OPR_IO_ITEM) {
01167 return (wn->u1u2.uu.ua.io_item_ty);
01168 } else {
01169 return (wn->u1u2.uu.ub.ty);
01170 }
01171 }
01172
01173
01174 inline void WN_set_ty(WN *wn, TY_IDX ty)
01175 {
01176 OPERATOR opr;
01177 opr = WN_operator(wn);
01178 if ((opr == OPR_LDA) || (opr == OPR_LDID) || (opr == OPR_STID) ||
01179 (opr == OPR_LDBITS) || (opr == OPR_STBITS)) {
01180 wn->u3.ty_fields.ty = ty;
01181 } else if (opr == OPR_IO_ITEM) {
01182 wn->u1u2.uu.ua.io_item_ty = ty;
01183 } else {
01184 wn->u1u2.uu.ub.ty = ty;
01185 }
01186 }
01187
01188
01189
01190
01191 inline TY_IDX WN_load_addr_ty(const WN *wn)
01192 {
01193 OPERATOR opr;
01194 opr = WN_operator(wn);
01195 if (opr == OPR_ILOAD || opr == OPR_ILDBITS) {
01196 return(wn->u3.ty_fields.ty);
01197 } else {
01198 return (wn->u1u2.uu.ua.loadx_addr_ty);
01199 }
01200 }
01201
01202
01203 inline void WN_set_load_addr_ty(WN *wn, TY_IDX ty)
01204 {
01205 OPERATOR opr;
01206 opr = WN_operator(wn);
01207 if (opr == OPR_ILOAD || opr == OPR_ILDBITS) {
01208 wn->u3.ty_fields.ty = ty;
01209 } else {
01210 wn->u1u2.uu.ua.loadx_addr_ty = ty;
01211 }
01212 }
01213
01214
01215
01216
01217
01218
01219 inline UINT32 WN_flag(const WN *wn)
01220 {
01221 OPERATOR opr;
01222 opr = WN_operator(wn);
01223 switch (opr) {
01224 case OPR_CALL:
01225 case OPR_ICALL:
01226 case OPR_PICCALL:
01227 case OPR_INTRINSIC_CALL:
01228 case OPR_INTRINSIC_OP:
01229 case OPR_REGION:
01230 case OPR_PARM:
01231 #ifdef KEY
01232 case OPR_PURE_CALL_OP:
01233 #endif
01234 return(WN_call_flag(wn));
01235 case OPR_PREFETCH:
01236 case OPR_PREFETCHX:
01237 return(WN_prefetch_flag(wn));
01238 case OPR_IF:
01239 return (WN_if_flag(wn));
01240 case OPR_LOOP_INFO:
01241 return (WN_loop_flag(wn));
01242 case OPR_IO:
01243 return (WN_io_flag(wn));
01244 case OPR_ASM_STMT:
01245 return (WN_asm_flag(wn));
01246 default:
01247 return(WN_label_flag(wn));
01248 }
01249 }
01250
01251
01252 inline void WN_set_flag(WN *wn, UINT32 flag)
01253 {
01254 OPERATOR opr;
01255 opr = WN_operator(wn);
01256 switch (opr) {
01257 case OPR_CALL:
01258 case OPR_ICALL:
01259 case OPR_PICCALL:
01260 case OPR_INTRINSIC_CALL:
01261 case OPR_INTRINSIC_OP:
01262 case OPR_REGION:
01263 case OPR_PARM:
01264 #ifdef KEY
01265 case OPR_PURE_CALL_OP:
01266 #endif
01267 WN_call_flag(wn) = flag;
01268 break;
01269 case OPR_PREFETCH:
01270 case OPR_PREFETCHX:
01271 WN_prefetch_flag(wn) = flag;
01272 break;
01273 case OPR_IF:
01274 WN_if_flag(wn) = flag;
01275 break;
01276 case OPR_IO:
01277 WN_io_flag(wn) = flag;
01278 break;
01279 case OPR_LOOP_INFO:
01280 WN_loop_flag(wn) = flag;
01281 break;
01282 default:
01283 WN_label_flag(wn) = flag;
01284 break;
01285 }
01286 }
01287
01288
01289
01290
01291 inline void *WN_StartAddress(WN *wn)
01292 {
01293 if (OPCODE_has_next_prev(WN_opcode(wn))) {
01294 return((void *)WN_cast_WN_to_STMT_WN(wn));
01295 } else return((void *) wn);
01296 }
01297
01298
01299
01300 inline INT32 WN_Size(WN *wn)
01301 {
01302 INT16 extra_kids = MAX(0,WN_kid_count(wn)-2);
01303 if (OPCODE_has_next_prev(WN_opcode(wn))) {
01304 return(sizeof(WN) + (2+extra_kids)*sizeof(WN*) + sizeof(mUINT64));
01305 } else {
01306 return(sizeof(WN) + (0+extra_kids)*sizeof(WN*));
01307 }
01308 }
01309
01310
01311 inline void WN_Set_Linenum(WN *wn, INT64 ln)
01312 {
01313 Is_True(OPCODE_has_next_prev(WN_opcode(wn)),
01314 ("can only set line numbers for statements"));
01315 WN_linenum(wn) = ln;
01316 }
01317
01318
01319 inline INT64 WN_Get_Linenum(const WN *wn)
01320 {
01321 if (OPCODE_has_next_prev(WN_opcode(wn))) {
01322 return WN_linenum(wn);
01323 } else {
01324 return 0;
01325 }
01326 }
01327
01328
01329
01330 inline BOOL WN_Is_Volatile_Mem(const WN *wn)
01331 {
01332 OPCODE opc = WN_opcode(wn);
01333 if (OPCODE_has_1ty(opc) || OPCODE_has_2ty(opc)) {
01334 if (OPCODE_operator(opc) == OPR_ISTORE ||
01335 OPCODE_operator(opc) == OPR_MSTORE) {
01336 TY_IDX pointed = TY_pointed (Ty_Table[WN_ty (wn)]);
01337 DevAssert(pointed, ("TY_pointed of ISTORE/MSTORE type is NULL"));
01338 return TY_is_volatile(pointed);
01339 } else {
01340 return TY_is_volatile(WN_ty(wn)) ||
01341 #ifdef KEY // bug 12404
01342 OPCODE_has_2ty(opc) && TY_is_volatile(TY_pointed(WN_load_addr_ty(wn)));
01343 #else
01344 OPCODE_has_2ty(opc) && TY_is_volatile(WN_load_addr_ty(wn));
01345 #endif
01346 }
01347 }
01348 return FALSE;
01349 }
01350
01351
01352 #define WN_IF_IS_GUARD 0x1
01353 #define WN_Is_If_Guard(x) (WN_if_flag(x) & WN_IF_IS_GUARD)
01354 #define WN_Set_If_Guard(x) (WN_if_flag(x) |= WN_IF_IS_GUARD)
01355 #define WN_Reset_If_Guard(x) (WN_if_flag(x) &= ~(WN_IF_IS_GUARD))
01356
01357 #define WN_IF_IS_MPVERSION 0x2
01358 #define WN_Is_If_MpVersion(x) (WN_if_flag(x) & WN_IF_IS_MPVERSION)
01359 #define WN_Set_If_MpVersion(x) (WN_if_flag(x) |= WN_IF_IS_MPVERSION)
01360 #define WN_Reset_If_MpVersion(x) (WN_if_flag(x) &= ~(WN_IF_IS_MPVERSION))
01361
01362 #define WN_LABEL_BREAK 0x1
01363 #define WN_Label_Is_Break(x) (WN_label_flag(x) & WN_LABEL_BREAK)
01364 #define WN_Set_Label_Is_Break(x) (WN_label_flag(x) |= WN_LABEL_BREAK)
01365 #define WN_Reset_Label_Is_Break(x) (WN_label_flag(x) &= ~(WN_LABEL_BREAK))
01366
01367
01368
01369 #define WN_LOOP_INNERMOST 0x1
01370 #define WN_LOOP_WINDDOWN_REG 0x2
01371 #define WN_LOOP_WINDDOWN_CACHE 0x4
01372 #define WN_LOOP_UNIMPORTANT_MISC 0x8
01373 #define WN_LOOP_NZ_TRIP 0x10
01374
01375
01376 #define WN_LOOP_SYMB_TRIP 0x20
01377
01378
01379 #define WN_Loop_Innermost(x) (WN_loop_flag(x) & WN_LOOP_INNERMOST)
01380 #define WN_Set_Loop_Innermost(x) (WN_loop_flag(x) |= WN_LOOP_INNERMOST)
01381 #define WN_Reset_Loop_Innermost(x) (WN_loop_flag(x) &= ~WN_LOOP_INNERMOST)
01382
01383
01384
01385 #define WN_Loop_Winddown_Reg(x) (WN_loop_flag(x) & WN_LOOP_WINDDOWN_REG)
01386 #define WN_Set_Loop_Winddown_Reg(x) (WN_loop_flag(x) |= WN_LOOP_WINDDOWN_REG)
01387 #define WN_Reset_Loop_Winddown_Reg(x) \
01388 (WN_loop_flag(x) &= ~WN_LOOP_WINDDOWN_REG)
01389
01390
01391
01392 #define WN_Loop_Winddown_Cache(x) \
01393 (WN_loop_flag(x) & WN_LOOP_WINDDOWN_CACHE)
01394 #define WN_Set_Loop_Winddown_Cache(x) \
01395 (WN_loop_flag(x) |= WN_LOOP_WINDDOWN_CACHE)
01396 #define WN_Reset_Loop_Winddown_Cache(x) \
01397 (WN_loop_flag(x) &= ~WN_LOOP_WINDDOWN_CACHE)
01398
01399
01400
01401
01402
01403
01404
01405 #define WN_Loop_Unimportant_Misc(x) \
01406 (WN_loop_flag(x) & WN_LOOP_UNIMPORTANT_MISC)
01407 #define WN_Set_Loop_Unimportant_Misc(x) \
01408 (WN_loop_flag(x) |= WN_LOOP_UNIMPORTANT_MISC)
01409 #define WN_Reset_Loop_Unimportant_Misc(x) \
01410 (WN_loop_flag(x) &= ~WN_LOOP_UNIMPORTANT_MISC)
01411
01412 #define WN_Loop_Unimportant(x) \
01413 (WN_loop_flag(x) & \
01414 (WN_LOOP_WINDDOWN_CACHE | WN_LOOP_WINDDOWN_REG | WN_LOOP_UNIMPORTANT_MISC))
01415
01416 #define WN_Loop_Nz_Trip(x) (WN_loop_flag(x) & WN_LOOP_NZ_TRIP)
01417 #define WN_Set_Loop_Nz_Trip(x) (WN_loop_flag(x) |= WN_LOOP_NZ_TRIP)
01418 #define WN_Reset_Loop_Nz_Trip(x) (WN_loop_flag(x) &= ~WN_LOOP_NZ_TRIP)
01419
01420 #define WN_Loop_Symb_Trip(x) (WN_loop_flag(x) & WN_LOOP_SYMB_TRIP)
01421 #define WN_Set_Loop_Symb_Trip(x) (WN_loop_flag(x) |= WN_LOOP_SYMB_TRIP)
01422 #define WN_Reset_Loop_Symb_Trip(x) (WN_loop_flag(x) &= ~WN_LOOP_SYMB_TRIP)
01423
01424 #define WN_LABEL_HANDLER_BEGIN 0x2
01425 #define WN_Label_Is_Handler_Begin(x) (WN_label_flag(x) & \
01426 WN_LABEL_HANDLER_BEGIN)
01427 #define WN_Set_Label_Is_Handler_Begin(x) (WN_label_flag(x) |= \
01428 WN_LABEL_HANDLER_BEGIN)
01429 #define WN_Reset_Label_Is_Handler_Begin(x) (WN_label_flag(x) &= \
01430 ~(WN_LABEL_HANDLER_BEGIN))
01431
01432 #ifdef KEY
01433 #define WN_LABEL_NOT_USED 0x4
01434 #define WN_Label_Is_Not_Used(x) (WN_label_flag(x) & \
01435 WN_LABEL_NOT_USED)
01436 #define WN_Set_Label_Is_Not_Used(x) (WN_label_flag(x) |= \
01437 WN_LABEL_NOT_USED)
01438 #define WN_Reset_Label_Is_Not_Used(x) (WN_label_flag(x) &= \
01439 ~(WN_LABEL_NOT_USED))
01440 #endif
01441
01442 #define WN_Set_IO_Library(x,y) (WN_io_flag(x) = (y))
01443 #define WN_IO_Library(x) ((IOLIB) WN_io_flag(x))
01444
01445 #define WN_PARM_BY_REFERENCE 0x01
01446 #define WN_PARM_BY_VALUE 0x02
01447 #define WN_PARM_IN WN_PARM_BY_VALUE
01448 #define WN_PARM_OUT 0x04
01449 #define WN_PARM_DUMMY 0x08
01450
01451 #define WN_PARM_READ_ONLY 0x10
01452
01453 #define WN_PARM_PASSED_NOT_SAVED 0x20
01454
01455
01456 #define WN_PARM_NOT_EXPOSED_USE 0x40
01457 #define WN_PARM_IS_KILLED 0x80
01458
01459
01460 #if defined(TARG_SL)
01461 #define WN_PARM_DEREFERENCE 0x100
01462 #define WN_Parm_Dereference(x) (WN_parm_flag(x) & WN_PARM_DEREFERENCE)
01463 #define WN_Set_Parm_Dereference(x) (WN_parm_flag(x) |= WN_PARM_DEREFERENCE)
01464 #endif // TARG_SL
01465
01466 #define WN_Parm_By_Reference(x) (WN_parm_flag(x) & WN_PARM_BY_REFERENCE)
01467 #define WN_Set_Parm_By_Reference(x) (WN_parm_flag(x) |= WN_PARM_BY_REFERENCE)
01468 #define WN_Parm_By_Value(x) (WN_parm_flag(x) & WN_PARM_BY_VALUE)
01469 #define WN_Set_Parm_By_Value(x) (WN_parm_flag(x) |= WN_PARM_BY_VALUE)
01470 #define WN_Parm_In(x) (WN_parm_flag(x) & WN_PARM_IN)
01471 #define WN_Set_Parm_In(x) (WN_parm_flag(x) |= WN_PARM_IN)
01472 #define WN_Parm_Out(x) (WN_parm_flag(x) & WN_PARM_OUT)
01473 #define WN_Set_Parm_Out(x) (WN_parm_flag(x) |= WN_PARM_OUT)
01474 #define WN_Parm_Dummy(x) (WN_parm_flag(x) & WN_PARM_DUMMY)
01475 #define WN_Set_Parm_Dummy(x) (WN_parm_flag(x) |= WN_PARM_DUMMY)
01476 #define WN_Parm_Read_Only(x) (WN_parm_flag(x) & WN_PARM_READ_ONLY)
01477 #define WN_Set_Parm_Read_Only(x) (WN_parm_flag(x) |= WN_PARM_READ_ONLY)
01478 #define WN_Parm_Passed_Not_Saved(x) (WN_parm_flag(x) & WN_PARM_PASSED_NOT_SAVED)
01479 #define WN_Set_Parm_Passed_Not_Saved(x) (WN_parm_flag(x) |= WN_PARM_PASSED_NOT_SAVED)
01480 #define WN_Set_Parm_Not_Exposed_Use(x) (WN_parm_flag(x) |= WN_PARM_NOT_EXPOSED_USE)
01481 #define WN_Parm_Not_Exposed_Use(x) (WN_parm_flag(x) & WN_PARM_NOT_EXPOSED_USE)
01482 #define WN_Set_Parm_Is_Killed(x) (WN_parm_flag(x) |= WN_PARM_IS_KILLED)
01483 #define WN_Parm_Is_Killed(x) (WN_parm_flag(x) & WN_PARM_IS_KILLED)
01484
01485 #define WN_CALL_NEVER_RETURN 0x01
01486 #define WN_CALL_NON_DATA_MOD 0x02
01487 #define WN_CALL_NON_PARM_MOD 0x04
01488 #define WN_CALL_PARM_MOD 0x08
01489 #define WN_CALL_NON_DATA_REF 0x10
01490 #define WN_CALL_NON_PARM_REF 0x20
01491 #define WN_CALL_PARM_REF 0x40
01492 #define WN_CALL_INLINE 0x80
01493 #define WN_CALL_DONT_INLINE 0x100
01494 #define WN_CALL_DOES_MEM_ALLOC 0x200
01495 #define WN_CALL_DOES_MEM_FREE 0x400
01496 #define WN_CALL_FORTRAN_POINTER_RULE 0x800
01497
01498
01499 #define WN_CALL_REPLACE_BY_JUMP 0x1000
01500 #define WN_CALL_IS_VIRTUAL 0x2000
01501
01502
01503
01504
01505
01506
01507 #define WN_CALL_CONSERVATIVE (WN_CALL_NON_DATA_MOD | \
01508 WN_CALL_NON_PARM_MOD | \
01509 WN_CALL_PARM_MOD | \
01510 WN_CALL_NON_DATA_REF | \
01511 WN_CALL_NON_PARM_REF | \
01512 WN_CALL_PARM_REF)
01513
01514 #define WN_Call_Never_Return(x) (WN_call_flag(x) & WN_CALL_NEVER_RETURN)
01515 #define WN_Set_Call_Never_Return(x) (WN_call_flag(x) |= WN_CALL_NEVER_RETURN)
01516 #define WN_Reset_Call_Never_Return(x) (WN_call_flag(x) &= ~WN_CALL_NEVER_RETURN)
01517 #define WN_Call_Non_Data_Mod(x) (WN_call_flag(x) & WN_CALL_NON_DATA_MOD)
01518 #define WN_Set_Call_Non_Data_Mod(x) (WN_call_flag(x) |= WN_CALL_NON_DATA_MOD)
01519 #define WN_Reset_Call_Non_Data_Mod(x) (WN_call_flag(x) &= ~WN_CALL_NON_DATA_MOD)
01520 #define WN_Call_Non_Data_Ref(x) (WN_call_flag(x) & WN_CALL_NON_DATA_REF)
01521 #define WN_Set_Call_Non_Data_Ref(x) (WN_call_flag(x) |= WN_CALL_NON_DATA_REF)
01522 #define WN_Reset_Call_Non_Data_Ref(x) (WN_call_flag(x) &= ~WN_CALL_NON_DATA_REF)
01523 #define WN_Call_Non_Parm_Mod(x) (WN_call_flag(x) & WN_CALL_NON_PARM_MOD)
01524 #define WN_Set_Call_Non_Parm_Mod(x) (WN_call_flag(x) |= WN_CALL_NON_PARM_MOD)
01525 #define WN_Reset_Call_Non_Parm_Mod(x) (WN_call_flag(x) &= ~WN_CALL_NON_PARM_MOD)
01526 #define WN_Call_Non_Parm_Ref(x) (WN_call_flag(x) & WN_CALL_NON_PARM_REF)
01527 #define WN_Set_Call_Non_Parm_Ref(x) (WN_call_flag(x) |= WN_CALL_NON_PARM_REF)
01528 #define WN_Reset_Call_Non_Parm_Ref(x) (WN_call_flag(x) &= ~WN_CALL_NON_PARM_REF)
01529 #define WN_Call_Parm_Mod(x) (WN_call_flag(x) & WN_CALL_PARM_MOD)
01530 #define WN_Set_Call_Parm_Mod(x) (WN_call_flag(x) |= WN_CALL_PARM_MOD)
01531 #define WN_Reset_Call_Parm_Mod(x) (WN_call_flag(x) &= ~WN_CALL_PARM_MOD)
01532 #define WN_Call_Parm_Ref(x) (WN_call_flag(x) & WN_CALL_PARM_REF)
01533 #define WN_Set_Call_Parm_Ref(x) (WN_call_flag(x) |= WN_CALL_PARM_REF)
01534 #define WN_Reset_Call_Parm_Ref(x) (WN_call_flag(x) &= ~WN_CALL_PARM_REF)
01535 #define WN_Call_Inline(x) (WN_call_flag(x) & WN_CALL_INLINE)
01536 #define WN_Set_Call_Inline(x) (WN_call_flag(x) |= WN_CALL_INLINE)
01537 #define WN_Reset_Call_Inline(x) (WN_call_flag(x) &= ~WN_CALL_INLINE)
01538 #define WN_Call_Dont_Inline(x) (WN_call_flag(x) & WN_CALL_DONT_INLINE)
01539 #define WN_Set_Call_Dont_Inline(x) (WN_call_flag(x) |= WN_CALL_DONT_INLINE)
01540 #define WN_Reset_Call_Dont_Inline(x) (WN_call_flag(x) &= ~WN_CALL_DONT_INLINE)
01541 #define WN_Call_Does_Mem_Alloc(x) (WN_call_flag(x) & WN_CALL_DOES_MEM_ALLOC)
01542 #define WN_Set_Call_Does_Mem_Alloc(x) (WN_call_flag(x) |= WN_CALL_DOES_MEM_ALLOC)
01543 #define WN_Reset_Call_Does_Mem_Alloc(x) (WN_call_flag(x) &= ~WN_CALL_DOES_MEM_ALLOC)
01544 #define WN_Call_Does_Mem_Free(x) (WN_call_flag(x) & WN_CALL_DOES_MEM_FREE)
01545 #define WN_Set_Call_Does_Mem_Free(x) (WN_call_flag(x) |= WN_CALL_DOES_MEM_FREE)
01546 #define WN_Reset_Call_Does_Mem_Free(x) (WN_call_flag(x) &= ~WN_CALL_DOES_MEM_FREE)
01547 #define WN_Call_Fortran_Pointer_Rule(x) (WN_call_flag(x) & WN_CALL_FORTRAN_POINTER_RULE)
01548 #define WN_Set_Call_Fortran_Pointer_Rule(x) \
01549 (WN_call_flag(x) |= WN_CALL_FORTRAN_POINTER_RULE)
01550 #define WN_Reset_Call_Fortran_Pointer_Rule(x) \
01551 (WN_call_flag(x) &= ~WN_CALL_FORTRAN_POINTER_RULE)
01552 #define WN_Call_Replace_By_Jump(x) (WN_call_flag(x) & WN_CALL_REPLACE_BY_JUMP)
01553 #define WN_Set_Call_Replace_By_Jump(x) (WN_call_flag(x) |= WN_CALL_REPLACE_BY_JUMP)
01554 #define WN_Reset_Call_Replace_By_Jump(x) (WN_call_flag(x) &= ~WN_CALL_REPLACE_BY_JUMP)
01555
01556 #define WN_Set_Call_Default_Flags(x) (WN_call_flag(x) |= WN_CALL_CONSERVATIVE)
01557 #define WN_Call_No_Side_Effect(x) ((WN_call_flag(x) & (WN_CALL_NON_DATA_MOD | WN_CALL_NON_PARM_MOD | WN_CALL_PARM_MOD)) == 0)
01558 #define WN_Call_Pure(x) ((WN_call_flag(x) & (WN_CALL_NON_DATA_MOD | WN_CALL_NON_PARM_MOD | WN_CALL_PARM_MOD | WN_CALL_NON_DATA_REF | WN_CALL_NON_PARM_REF)) == 0)
01559
01560 #define WN_Call_Is_Virtual(x) (WN_call_flag(x) & WN_CALL_IS_VIRTUAL)
01561 #define WN_Set_Call_Is_Virtual(x) (WN_call_flag(x) |= WN_CALL_IS_VIRTUAL)
01562 #define WN_Reset_Call_Is_Virtual(x) (WN_call_flag(x) &= ~WN_CALL_IS_VIRTUAL)
01563
01564
01565
01566 #define WN_ASM_VOLATILE 0x0001
01567 #define WN_ASM_CLOBBERS_MEM 0x0002
01568 #define WN_ASM_CLOBBERS_CC 0x0004
01569
01570 #define WN_Asm_Volatile(x) (WN_asm_flag(x) & WN_ASM_VOLATILE)
01571 #define WN_Set_Asm_Volatile(x) (WN_asm_flag(x) |= WN_ASM_VOLATILE)
01572 #define WN_Reset_Asm_Volatile(x) (WN_asm_flag(x) &= ~WN_ASM_VOLATILE)
01573 #define WN_Asm_Clobbers_Mem(x) (WN_asm_flag(x) & WN_ASM_CLOBBERS_MEM)
01574 #define WN_Set_Asm_Clobbers_Mem(x) (WN_asm_flag(x) |= WN_ASM_CLOBBERS_MEM)
01575 #define WN_Reset_Asm_Clobbers_Mem(x) (WN_asm_flag(x) &= ~WN_ASM_CLOBBERS_MEM)
01576 #define WN_Asm_Clobbers_Cc(x) (WN_asm_flag(x) & WN_ASM_CLOBBERS_CC)
01577 #define WN_Set_Asm_Clobbers_Cc(x) (WN_asm_flag(x) |= WN_ASM_CLOBBERS_CC)
01578 #define WN_Reset_Asm_Clobbers_Cc(x) (WN_asm_flag(x) &= ~WN_ASM_CLOBBERS_CC)
01579
01580
01581
01582
01583
01584
01585
01586
01587
01588
01589 inline mINT16 WN_num_actuals(const WN *wn)
01590 {
01591 INT32 n= WN_kid_count(wn);
01592 INT32 i;
01593 OPERATOR opr = WN_operator(wn);
01594
01595
01596
01597
01598 if (opr == OPR_ICALL || opr == OPR_PICCALL) n--;
01599
01600 for(i= n-1; i>=0; i--)
01601 {
01602 WN *kid = WN_kid(wn,i);
01603 OPERATOR kid_opr = WN_operator(kid);
01604 if ( (kid_opr != OPR_PARM) || !WN_Parm_Dummy(kid) )
01605 {
01606 return i+1;
01607 }
01608 }
01609 return 0;
01610 }
01611
01612
01613
01614
01615
01616
01617
01618
01619
01620
01621
01622
01623
01624
01625
01626
01627
01628
01629
01630
01631 #define PF_GET_READ(flag) (((~(flag)) >> 24) & 0x1)
01632 #define PF_GET_WRITE(flag) (((flag) >> 24) & 0x1)
01633 #define PF_GET_STRIDE_1L(flag) ((flag) & 0xff)
01634 #define PF_GET_STRIDE_2L(flag) (((flag) >> 8) & 0xff)
01635 #define PF_GET_CONFIDENCE(flag) (((flag) >> 28) & 0xf)
01636 #define PF_GET_MANUAL(flag) (((flag) >> 25) & 0x1)
01637 #ifdef KEY //bug 10953
01638 #define PF_GET_KEEP_ANYWAY(flag) (((flag) >> 26) & 0x1)
01639 #define PF_GET_NON_TEMPORAL(flag) (((flag) >> 27) & 0x1)
01640 #endif
01641
01642 #define PF_SET_READ(flag) flag &= 0xfeffffff
01643 #define PF_SET_WRITE(flag) flag |= 0x01000000
01644 #define PF_SET_STRIDE_1L(flag, x) flag = (((flag)&0xffffff00) | ((x)&0xff))
01645 #define PF_SET_STRIDE_2L(flag, x) flag = (((flag)&0xffff00ff) | ((x)&0xff)<<8)
01646 #define PF_SET_CONFIDENCE(flag, x) flag = (((flag)&0x0fffffff) | ((x)&0xf)<<28)
01647 #define PF_SET_MANUAL(flag) flag |= 0x02000000
01648 #define PF_UNSET_MANUAL(flag) flag &= 0xfdffffff
01649 #ifdef KEY //bug 10953
01650 #define PF_SET_KEEP_ANYWAY(flag) flag |= 0x04000000
01651 #define PF_UNSET_KEEP_ANYWAY(flag) flag &= 0xfbffffff
01652 #define PF_SET_NON_TEMPORAL(flag) flag |= 0x08000000
01653 #define PF_UNSET_NON_TEMPORAL(flag) flag &= 0xf7ffffff
01654 #endif
01655
01656 #define WN_pf_read(wn) (((~(WN_prefetch_flag(wn))) >> 24) & 0x1)
01657 #define WN_pf_write(wn) (((WN_prefetch_flag(wn)) >> 24) & 0x1)
01658 #define WN_pf_stride_1L(wn) ((WN_prefetch_flag(wn)) & 0xff)
01659 #define WN_pf_stride_2L(wn) (((WN_prefetch_flag(wn)) >> 8) & 0xff)
01660 #define WN_pf_confidence(wn) (((WN_prefetch_flag(wn)) >> 28) & 0xf)
01661 #define WN_pf_manual(wn) (((WN_prefetch_flag(wn)) >> 25) & 0x1)
01662
01663 #define WN_pf_set_read(wn) WN_prefetch_flag(wn) &= 0xfeffffff
01664 #define WN_pf_set_write(wn) WN_prefetch_flag(wn) |= 0x01000000
01665 #define WN_pf_set_stride_1L(wn, x) WN_prefetch_flag(wn) = (((WN_prefetch_flag(wn))&0xffffff00) | ((x)&0xff))
01666 #define WN_pf_set_stride_2L(wn, x) WN_prefetch_flag(wn) = (((WN_prefetch_flag(wn))&0xffff00ff) | ((x)&0xff)<<8)
01667 #define WN_pf_set_confidence(wn, x) WN_prefetch_flag(wn) = (((WN_prefetch_flag(wn))&0x0fffffff) | ((x)&0xf)<<28)
01668 #define WN_pf_set_manual(wn) WN_prefetch_flag(wn) |= 0x02000000
01669 #define WN_pf_unset_manual(wn) WN_prefetch_flag(wn) &= 0xfdffffff
01670
01671
01672
01673
01674 #endif