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