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 #ifndef wn_INCLUDED
00041 #define wn_INCLUDED
00042
00043 #ifndef WN_RCS_ID
00044 #define WN_RCS_ID
00045 #endif
00046
00047
00048 #include "defs.h"
00049 #include "opcode.h"
00050 #include "mempool.h"
00051 #include "srcpos.h"
00052
00053 #include "wn_core.h"
00054
00055 #include "wn_map.h"
00056 #include "wio.h"
00057 #include "wn_pragmas.h"
00058
00059 #include "stab.h"
00060
00061
00658 extern BOOL Types_Are_Compatible(TYPE_ID ltype, WN *wn);
00659 extern BOOL IPO_Types_Are_Compatible(TYPE_ID ltype, TYPE_ID rtype);
00660 extern BOOL Is_Const_Parm (WN *, INT );
00661
00662
00663 #ifdef KEY
00664 extern "C" INT32 New_Region_Id (void);
00665 #endif // KEY
00666
00667 extern void Dont_Use_WN_Free_List (void);
00668 extern MEM_POOL *WN_mem_pool_ptr;
00669
00670 extern WN *WN_Create(OPERATOR opr, TYPE_ID rtype, TYPE_ID desc, mINT16 kid_count);
00671 inline WN *
00672 WN_Create(OPCODE opcode, mINT16 kid_count) {
00673 return WN_Create (OPCODE_operator(opcode), OPCODE_rtype(opcode),
00674 OPCODE_desc(opcode), kid_count);
00675 }
00676
00677 extern WN *
00678 WN_Create_Generic (OPERATOR opr, TYPE_ID rtype, TYPE_ID desc,
00679 mINT16 kid_count, WN *next, WN *prev,
00680 ST_IDX st, INT32 label_number, INT32 num_entries,
00681 TY_IDX ty, TY_IDX load_addr_ty, WN_OFFSET offset,
00682 INT16 cvtl_bits, INT32 num_dim, WN_ESIZE element_size,
00683 INT64 const_value, UINT32 flag, INTRINSIC intrinsic);
00684 inline WN *
00685 WN_Create_Generic (OPCODE opcode, mINT16 kid_count, WN *next, WN *prev,
00686 ST_IDX st, INT32 label_number, INT32 num_entries,
00687 TY_IDX ty, TY_IDX load_addr_ty, WN_OFFSET offset,
00688 INT16 cvtl_bits, INT32 num_dim, WN_ESIZE element_size,
00689 INT64 const_value, UINT32 flag, INTRINSIC intrinsic) {
00690 return WN_Create_Generic (OPCODE_operator(opcode), OPCODE_rtype(opcode),
00691 OPCODE_desc(opcode), kid_count, next, prev,
00692 st, label_number, num_entries,
00693 ty, load_addr_ty, offset, cvtl_bits, num_dim,
00694 element_size, const_value, flag, intrinsic);
00695 }
00696
00697 extern void IPA_WN_Delete(WN_MAP_TAB *maptab, WN *wn);
00698
00699 #define WN_Delete(wn) \
00700 IPA_WN_Delete(Current_Map_Tab, (wn))
00701
00702 extern void IPA_WN_DELETE_Tree(WN_MAP_TAB *maptab, WN *tree);
00703
00704 extern void WN_Register_Delete_Cleanup_Function(void (*cleanup_fn)(WN *wn));
00705
00706 extern void WN_Remove_Delete_Cleanup_Function(void (*cleanup_fn)(WN *wn));
00707
00708 #ifdef KEY // bug 9651
00709 extern void WN_Reset_Num_Delete_Cleanup_Fns(void);
00710 #endif
00711
00712 extern BOOL WN_Equiv(WN *wn1, WN *wn2);
00713
00714 extern WN *WN_CreateBlock(void);
00715
00716 extern WN *WN_CreateDO(WN *index,
00717 WN *start,
00718 WN *end,
00719 WN *step,
00720 WN *body,
00721 WN *loop_info);
00722
00723 extern WN *WN_CreateDoWhile(WN *test,
00724 WN *body);
00725
00726 extern WN *WN_CreateWhileDo(WN *test,
00727 WN *body);
00728
00729 extern WN *WN_CreateIf(WN *test,
00730 WN *if_then,
00731 WN *if_else);
00732
00733 extern WN *WN_CreateEntry (INT16 nkids, ST_IDX name, WN *body, WN *pragmas,
00734 WN *varrefs);
00735
00736 extern WN *WN_CreateRegion(REGION_KIND kind,
00737 WN *body,
00738 WN *pragmas,
00739 WN *exits,
00740 INT region_id,
00741 INITO_IDX ereg_supp);
00742 extern WN *WN_CreateRegionExit (INT32 label_number);
00743
00744
00745
00746 extern void Set_Max_Region_Id (INT id);
00747
00748 extern WN *WN_CreateGoto(INT32 label_number);
00749
00750 extern WN *WN_CreateGotoOuterBlock (INT32 label_number, SYMTAB_IDX label_level);
00751
00752 extern WN *WN_CreateAgoto(WN *addr);
00753
00754 extern WN *WN_CreateAltentry(ST_IDX entry);
00755
00756 #define WN_CreateCondbr WN_CreateTruebr
00757 extern WN *WN_CreateTruebr(INT32 label_number, WN *exp);
00758 extern WN *WN_CreateFalsebr(INT32 label_number, WN *exp);
00759
00760 extern WN *WN_CreateReturn(void);
00761 extern WN *WN_CreateReturn_Val (OPERATOR opr, TYPE_ID rtype, TYPE_ID desc, WN * val);
00762 inline WN *
00763 WN_CreateReturn_Val (OPCODE opc, WN * val) {
00764 return WN_CreateReturn_Val (OPCODE_operator (opc),
00765 OPCODE_rtype (opc),
00766 OPCODE_desc (opc),
00767 val);
00768 }
00769
00770 extern WN *WN_CreateLabel(INT32 label_number, UINT32 label_flag, WN *loop_info);
00771
00772 extern WN *WN_CreateCompgoto(INT32 num_entries,
00773 WN *value, WN *block, WN *deflt, INT32 last_label);
00774
00775 extern WN *WN_CreateSwitch(INT32 num_entries,
00776 WN *value, WN *block, WN *deflt, INT32 last_label);
00777
00778 extern WN *WN_CreateCasegoto(INT64 case_value, INT32 case_label_number);
00779
00780 extern WN *WN_CreateXgoto (INT32 num_entries, WN *value, WN *block, ST_IDX st);
00781
00782 extern WN *WN_CreateIstore(OPERATOR opr,
00783 TYPE_ID rtype,
00784 TYPE_ID desc,
00785 WN_OFFSET offset,
00786 TY_IDX ty,
00787 WN *value,
00788 WN *addr,
00789 UINT field_id = 0);
00790 inline WN *
00791 WN_CreateIstore (OPCODE opc, WN_OFFSET offset, TY_IDX ty, WN *value, WN *addr,
00792 UINT field_id = 0) {
00793 return WN_CreateIstore (OPCODE_operator(opc), OPCODE_rtype(opc),
00794 OPCODE_desc(opc), offset, ty, value, addr, field_id);
00795 }
00796
00797 extern WN *WN_CreateIstorex(OPERATOR opr,
00798 TYPE_ID rtype,
00799 TYPE_ID desc,
00800 TY_IDX ty,
00801 WN *value,
00802 WN *addr1,
00803 WN *addr2);
00804 inline WN *
00805 WN_CreateIstorex(OPCODE opc, TY_IDX ty, WN *value, WN *addr1, WN *addr2) {
00806 return WN_CreateIstorex (OPCODE_operator(opc), OPCODE_rtype(opc),
00807 OPCODE_desc(opc), ty, value, addr1, addr2);
00808 }
00809
00810 extern WN *WN_CreateMstore(WN_OFFSET offset,
00811 TY_IDX ty,
00812 WN *value,
00813 WN *addr,
00814 WN *num_bytes);
00815
00816 extern WN *WN_CreateStid(OPERATOR opr,
00817 TYPE_ID rtype,
00818 TYPE_ID desc,
00819 WN_OFFSET offset,
00820 ST *st,
00821 TY_IDX ty,
00822 WN *value,
00823 UINT field_id = 0);
00824 inline WN *
00825 WN_CreateStid(OPCODE opc, WN_OFFSET offset, ST *st, TY_IDX ty, WN *value, UINT field_id = 0) {
00826 return WN_CreateStid (OPCODE_operator(opc), OPCODE_rtype(opc),
00827 OPCODE_desc(opc), offset, st, ty, value, field_id);
00828 }
00829
00830 extern WN *WN_CreatePrefetch( WN_OFFSET offset, UINT32 flag, WN *addr);
00831 extern WN *WN_CreatePrefetchx(UINT32 flag, WN *addr1, WN *addr2);
00832
00833 extern WN *WN_CreateIo(IOSTATEMENT iostatement, mINT16 kid_count);
00834 extern WN *WN_CreateIoItem0(IOITEM ioitem, TY_IDX ty);
00835 extern WN *WN_CreateIoItem1(IOITEM ioitem, WN *kid0, TY_IDX ty);
00836 extern WN *WN_CreateIoItem2(IOITEM ioitem, WN *kid0, WN *kid1, TY_IDX ty);
00837 extern WN *WN_CreateIoItem3(IOITEM ioitem, WN *kid0, WN *kid1, WN *kid2, TY_IDX ty);
00838 extern WN *WN_CreateIoItemN(IOITEM ioitem, mINT16 kid_count, TY_IDX ty);
00839
00840 extern WN *WN_CreateEval(WN *exp);
00841
00842 extern WN *WN_CreatePragma(WN_PRAGMA_ID pragma_name, ST_IDX st,
00843 INT32 arg1, INT32 arg2);
00844 extern WN *WN_CreatePragma(WN_PRAGMA_ID pragma_name, ST_IDX st,
00845 INT32 arg1, PREG_NUM asm_copyout_preg,
00846 UINT32 asm_opnd_num);
00847 extern WN *WN_CreateXpragma(WN_PRAGMA_ID pragma_name, ST_IDX st,
00848 INT16 kid_count);
00849
00850 extern WN *WN_CreateExp0(OPERATOR opr, TYPE_ID rtype, TYPE_ID desc);
00851 inline WN *
00852 WN_CreateExp0 (OPCODE opc) {
00853 return WN_CreateExp0 (OPCODE_operator(opc), OPCODE_rtype(opc),
00854 OPCODE_desc(opc));
00855 }
00856
00857 extern WN *WN_CreateExp1(OPERATOR opr,
00858 TYPE_ID rtype,
00859 TYPE_ID desc,
00860 WN *kid0);
00861 inline WN *
00862 WN_CreateExp1 (OPCODE opc, WN *kid0) {
00863 return WN_CreateExp1 (OPCODE_operator(opc), OPCODE_rtype(opc),
00864 OPCODE_desc(opc), kid0);
00865 }
00866
00867 extern WN *WN_CreateExp2(OPERATOR opr,
00868 TYPE_ID rtype,
00869 TYPE_ID desc,
00870 WN *kid0,
00871 WN *kid1);
00872 inline WN*
00873 WN_CreateExp2 (OPCODE opc, WN *kid0, WN *kid1) {
00874 return WN_CreateExp2 (OPCODE_operator(opc), OPCODE_rtype(opc),
00875 OPCODE_desc(opc), kid0, kid1);
00876 }
00877
00878 extern WN *WN_CreateExp3(OPERATOR opr,
00879 TYPE_ID rtype,
00880 TYPE_ID desc,
00881 WN *kid0,
00882 WN *kid1,
00883 WN *kid2);
00884 inline WN *
00885 WN_CreateExp3 (OPCODE opc, WN *kid0, WN *kid1, WN *kid2) {
00886 return WN_CreateExp3 (OPCODE_operator(opc), OPCODE_rtype(opc),
00887 OPCODE_desc(opc), kid0, kid1, kid2);
00888 }
00889
00890 extern WN *WN_CreateIload(OPERATOR opr,
00891 TYPE_ID rtype,
00892 TYPE_ID desc,
00893 WN_OFFSET offset,
00894 TY_IDX ty,
00895 TY_IDX load_addr_ty,
00896 WN *addr,
00897 UINT field_id = 0);
00898 inline WN*
00899 WN_CreateIload (OPCODE opc, WN_OFFSET offset, TY_IDX ty,
00900 TY_IDX load_addr_ty, WN *addr, UINT field_id = 0) {
00901 return WN_CreateIload (OPCODE_operator(opc), OPCODE_rtype(opc),
00902 OPCODE_desc(opc), offset, ty, load_addr_ty, addr,
00903 field_id);
00904 }
00905
00906 extern WN *WN_CreateIloadx(OPERATOR opr,
00907 TYPE_ID rtype,
00908 TYPE_ID desc,
00909 TY_IDX ty,
00910 TY_IDX load_addr_ty,
00911 WN *addr1,
00912 WN *addr2);
00913 inline WN*
00914 WN_CreateIloadx (OPCODE opc, TY_IDX ty, TY_IDX load_addr_ty,
00915 WN *addr1, WN *addr2) {
00916 return WN_CreateIloadx (OPCODE_operator(opc), OPCODE_rtype(opc),
00917 OPCODE_desc(opc), ty, load_addr_ty, addr1, addr2);
00918 }
00919
00920 extern WN *WN_CreateMload(WN_OFFSET offset,
00921 TY_IDX ty,
00922 WN *addr,
00923 WN *num_bytes);
00924
00925 extern WN *WN_CreateLdid(OPERATOR opr,
00926 TYPE_ID rtype,
00927 TYPE_ID desc,
00928 WN_OFFSET offset,
00929 ST_IDX st,
00930 TY_IDX ty,
00931 UINT field_id = 0);
00932 inline WN*
00933 WN_CreateLdid (OPCODE opc, WN_OFFSET offset, ST_IDX st, TY_IDX ty, UINT field_id = 0) {
00934 return WN_CreateLdid (OPCODE_operator(opc), OPCODE_rtype(opc),
00935 OPCODE_desc(opc), offset, st, ty, field_id);
00936 }
00937
00938 extern WN *WN_CreateLda(OPERATOR opr,
00939 TYPE_ID rtype,
00940 TYPE_ID desc,
00941 WN_OFFSET offset,
00942 TY_IDX ty,
00943 ST_IDX st,
00944 UINT field_id = 0);
00945 inline WN*
00946 WN_CreateLda (OPCODE opc, WN_OFFSET offset, TY_IDX ty, ST_IDX st,
00947 UINT field_id = 0) {
00948 return WN_CreateLda (OPCODE_operator(opc), OPCODE_rtype(opc),
00949 OPCODE_desc(opc), offset, ty, st, field_id);
00950 }
00951
00952 extern WN *WN_CreateIlda(OPERATOR opr,
00953 TYPE_ID rtype,
00954 TYPE_ID desc,
00955 WN_OFFSET offset,
00956 TY_IDX ty);
00957
00958 extern WN *WN_CreateLdaLabel(OPERATOR opr,
00959 TYPE_ID rtype,
00960 TYPE_ID desc,
00961 mUINT32 label_number);
00962
00963 extern WN *WN_CreateIdname(WN_OFFSET offset,
00964 ST_IDX st);
00965
00966 extern WN *WN_CreateConst (OPERATOR opr, TYPE_ID rtype, TYPE_ID desc, ST_IDX st);
00967 inline WN*
00968 WN_CreateConst (OPCODE opc, ST_IDX st) {
00969 return WN_CreateConst (OPCODE_operator(opc), OPCODE_rtype(opc),
00970 OPCODE_desc(opc), st);
00971 }
00972
00973 extern WN *WN_CreateIntconst(OPERATOR opr,
00974 TYPE_ID rtype,
00975 TYPE_ID desc,
00976 INT64 const_val);
00977 inline WN *
00978 WN_CreateIntconst (OPCODE opc, INT64 const_val) {
00979 return WN_CreateIntconst (OPCODE_operator(opc), OPCODE_rtype(opc),
00980 OPCODE_desc(opc), const_val);
00981 }
00982
00983 extern WN *WN_CreateCvtl(OPERATOR opr,
00984 TYPE_ID rtype,
00985 TYPE_ID desc,
00986 INT16 cvtl_bits,
00987 WN *kid0);
00988 inline WN *
00989 WN_CreateCvtl (OPCODE opc, INT16 cvtl_bits, WN *kid0) {
00990 return WN_CreateCvtl (OPCODE_operator(opc), OPCODE_rtype(opc),
00991 OPCODE_desc(opc), cvtl_bits, kid0);
00992 }
00993
00994 extern WN *WN_Create_Intrinsic(OPERATOR opr,
00995 TYPE_ID rtype,
00996 TYPE_ID desc,
00997 INTRINSIC intrinsic,
00998 INT32 n,
00999 WN *kids[]);
01000 inline WN *
01001 WN_Create_Intrinsic (OPCODE opc, INTRINSIC intrinsic, INT32 n, WN *kids[]) {
01002 return WN_Create_Intrinsic (OPCODE_operator(opc), OPCODE_rtype(opc),
01003 OPCODE_desc(opc), intrinsic, n, kids);
01004 }
01005
01006 extern WN *WN_CreateParm(TYPE_ID rtype,
01007 WN *parm_node,
01008 TY_IDX ty,
01009 UINT32 flag);
01010
01011 extern WN *WN_CreateComma(OPERATOR opr, TYPE_ID rtype, TYPE_ID desc, WN *block, WN *value);
01012 inline WN *
01013 WN_CreateComma (OPCODE opc, WN *block, WN *value) {
01014 return WN_CreateComma (OPCODE_operator(opc), OPCODE_rtype(opc),
01015 OPCODE_desc(opc), block, value);
01016 }
01017
01018 extern WN *WN_CreateRcomma(OPERATOR opr, TYPE_ID rtype, TYPE_ID desc, WN *value, WN *block);
01019 inline WN *
01020 WN_CreateRcomma (OPCODE opc, WN *value, WN *block) {
01021 return WN_CreateRcomma (OPCODE_operator(opc), OPCODE_rtype(opc),
01022 OPCODE_desc(opc), value, block);
01023 }
01024
01025 extern WN *WN_CreateComment (const char *s);
01026 extern STR_IDX WN_GetComment (const WN *wn);
01027
01028 extern WN *WN_CreateAsm_Stmt (INT16 kid_count, char *asm_string);
01029
01030 extern WN *WN_CreateAsm_Input (char *constraint, UINT32 opnd_num, WN *opnd_expr);
01031
01032 extern WN *WN_CopyNode(const WN* src_wn);
01033
01034
01035 #if 0
01036 #define WN_Move_Maps(dst,src) \
01037 IPA_WN_Move_Maps(Current_Map_Tab, (dst), (src))
01038 extern void IPA_WN_Move_Maps(WN_MAP_TAB *maptab, WN *dst, WN *src);
01039 #endif
01040
01041 extern void IPA_WN_Move_Maps_PU(WN_MAP_TAB *src, WN_MAP_TAB *dst, WN *wn);
01042
01043
01044 extern void WN_Mem_Push(void);
01045
01046 extern void WN_Mem_Pop(void);
01047
01048 extern WN *WN_Ldid(TYPE_ID desc,
01049 WN_OFFSET offset,
01050 ST_IDX sym,
01051 TY_IDX align,
01052 UINT field_id = 0);
01053
01054 extern WN *WN_RLdid(TYPE_ID rtype,
01055 TYPE_ID desc,
01056 WN_OFFSET offset,
01057 ST_IDX sym,
01058 TY_IDX align);
01059
01060 extern WN *WN_LdidPreg(TYPE_ID desc,
01061 WN_OFFSET pregno);
01062
01063 extern WN *WN_Iload(TYPE_ID desc,
01064 WN_OFFSET offset,
01065 TY_IDX align,
01066 WN *addr,
01067 UINT field_id = 0);
01068
01069 extern WN *WN_RIload(TYPE_ID rtype,
01070 TYPE_ID desc,
01071 WN_OFFSET offset,
01072 TY_IDX align,
01073 #ifndef KEY
01074 WN *addr);
01075 #else
01076 WN *addri,
01077 UINT field_id = 0);
01078 #endif
01079
01080 extern WN *WN_IloadLdid(TYPE_ID desc,
01081 WN_OFFSET offset,
01082 TY_IDX align,
01083 ST *sym,
01084 WN_OFFSET symOffset);
01085
01086 extern WN *WN_Istore(TYPE_ID desc,
01087 WN_OFFSET offset,
01088 TY_IDX align,
01089 WN *addr,
01090 WN *value,
01091 UINT field_id = 0);
01092
01093 extern WN *WN_Unary(OPERATOR opr,
01094 TYPE_ID rtype,
01095 WN *l);
01096
01097 extern WN *WN_Binary(OPERATOR opr,
01098 TYPE_ID rtype,
01099 WN *l,
01100 WN *r);
01101
01102 extern WN *WN_Ternary(OPERATOR opr,
01103 TYPE_ID rtype,
01104 WN *kid0,
01105 WN *kid1,
01106 WN *kid2);
01107
01108 extern WN *WN_Stid(TYPE_ID desc,
01109 WN_OFFSET offset,
01110 ST *sym,
01111 TY_IDX align,
01112 WN *value,
01113 UINT field_id = 0);
01114
01115 extern WN *WN_StidIntoPreg(TYPE_ID desc,
01116 WN_OFFSET offset,
01117 ST *sym,
01118 WN *value);
01119
01120 #define WN_StidPreg(desc,pregno,value) WN_StidIntoPreg((desc),(pregno),MTYPE_To_PREG(desc),(value))
01121
01122 extern WN *WN_Binary(OPERATOR opr,
01123 TYPE_ID rtype,
01124 WN *l,
01125 WN *r);
01126
01127 extern WN *WN_Intconst(TYPE_ID rtype,
01128 INT64 value);
01129
01130 extern WN *WN_RotateIntconst(WN *tree,
01131 INT32 rotate);
01132
01133 extern WN *WN_Inverse(TYPE_ID type,
01134 WN *tree);
01135
01136 extern WN *WN_Floatconst(TYPE_ID type,
01137 double value);
01138
01139 extern WN *WN_UVConst(TYPE_ID type);
01140
01141 extern WN * WN_Zerocon (TYPE_ID ty);
01142
01143 extern WN *WN_Cvt(TYPE_ID desc,
01144 TYPE_ID rtype,
01145 WN *kid0);
01146
01147 extern WN *WN_Trunc(TYPE_ID desc,
01148 TYPE_ID rtype,
01149 WN *kid0);
01150
01151 extern WN *WN_Rnd(TYPE_ID desc,
01152 TYPE_ID rtype,
01153 WN *kid0);
01154
01155 extern WN *WN_Ceil(TYPE_ID desc,
01156 TYPE_ID rtype,
01157 WN *kid0);
01158
01159 extern WN *WN_Floor(TYPE_ID desc,
01160 TYPE_ID rtype,
01161 WN *kid0);
01162
01163 extern WN *WN_Relational(OPERATOR opr,
01164 TYPE_ID desc,
01165 WN *kid0,
01166 WN *kid1);
01167
01168 extern WN *WN_ConstPowerOf2(TYPE_ID rtype,
01169 INT32 n);
01170
01171 extern WN *WN_Lda(TYPE_ID rtype,
01172 WN_OFFSET ldaOffset,
01173 ST *sym,
01174 UINT field_id = 0);
01175
01176
01177 extern WN *WN_LdaString(const char *str,
01178 WN_OFFSET ldaOffset,
01179 INT32 len);
01180
01181 extern WN *WN_LdaLabel(TYPE_ID rtype,
01182 INT32 label_number);
01183
01184 extern WN *WN_Icall(TYPE_ID rtype,
01185 TYPE_ID desc,
01186 INT32 n,
01187 TY_IDX ty);
01188
01189 extern WN *WN_generic_call(OPERATOR opr,
01190 TYPE_ID rtype,
01191 TYPE_ID desc,
01192 INT32 n,
01193 ST_IDX sym);
01194
01195 extern WN *WN_generic_intrinsic(OPERATOR opr,
01196 TYPE_ID rtype,
01197 TYPE_ID desc,
01198 INT32 n,
01199 INTRINSIC intrinsic);
01200
01201 #define WN_Call(type,desc,n,s) WN_generic_call(OPR_CALL,type,desc,n,s)
01202 #define WN_Piccall(type,desc,n,s) WN_generic_call(OPR_PICCALL,type,desc,n,s)
01203
01204 extern WN *WN_CreateLoopInfo (WN *induction, WN *trip, UINT16 trip_est, UINT16 depth, INT32 flags);
01205
01206 extern WN *WN_CreateExcScopeBegin(INT32 id, INT16 nkids, struct inito* ereg_supp);
01207
01208 extern WN *WN_CreateExcScopeEnd(INT32 id);
01209
01210 extern WN *WN_CreateBarrier (BOOL forward, INT16 nkids);
01211
01212 extern WN *WN_CreateTrap (INT32 value);
01213
01214 extern WN *WN_CreateAssert (INT32 value, WN *condition);
01215
01216 extern void WN_CopyMap( WN *dst,
01217 WN_MAP map,
01218 const WN *src);
01219
01220 extern WN *WN_Tas(TYPE_ID rtype,
01221 TY_IDX ty,
01222 WN *l);
01223
01224 extern WN *WN_Iloadx(TYPE_ID rtype,
01225 TY_IDX ty,
01226 TY_IDX addr_ty,
01227 WN *base,
01228 WN *index);
01229
01230 extern WN *WN_Istorex(TYPE_ID desc,
01231 TY_IDX ty,
01232 WN *value,
01233 WN *base,
01234 WN *index);
01235
01236 #define WN_Neg(type,l) WN_Unary(OPR_NEG,type,l)
01237 #define WN_Abs(type,l) WN_Unary(OPR_ABS,type,l)
01238 #define WN_Recip(type,l) WN_Unary(OPR_RECIP,type,l)
01239 #define WN_Sqrt(type,l) WN_Unary(OPR_SQRT,type,l)
01240 #define WN_Rsqrt(type,l) WN_Unary(OPR_RSQRT,type,l)
01241 #define WN_Paren(type,l) WN_Unary(OPR_PAREN,type,l)
01242
01243 #define WN_Select(type,rel,t,f) WN_Ternary(OPR_SELECT,type,rel,t,f)
01244 #define WN_Cselect(type,rel,t,f) WN_Ternary(OPR_CSELECT,type,rel,t,f)
01245 #define WN_Add(type,l,r) WN_Binary(OPR_ADD,type,l,r)
01246 #define WN_Sub(type,l,r) WN_Binary(OPR_SUB,type,l,r)
01247 #define WN_Mpy(type,l,r) WN_Binary(OPR_MPY,type,l,r)
01248 #define WN_Div(type,l,r) WN_Binary(OPR_DIV,type,l,r)
01249 #define WN_Madd(type,l,r,a) WN_Ternary(OPR_MADD,type,l,r,a)
01250 #define WN_Msub(type,l,r,a) WN_Ternary(OPR_MSUB,type,l,r,a)
01251 #define WN_Nmadd(type,l,r,a) WN_Ternary(OPR_NMADD,type,l,r,a)
01252 #define WN_Nmsub(type,l,r,a) WN_Ternary(OPR_NMSUB,type,l,r,a)
01253
01254
01255
01256 #define WN_EQ(type,l,r) WN_Relational(OPR_EQ,type,l,r)
01257 #define WN_NE(type,l,r) WN_Relational(OPR_NE,type,l,r)
01258 #define WN_LT(type,l,r) WN_Relational(OPR_LT,type,l,r)
01259 #define WN_LE(type,l,r) WN_Relational(OPR_LE,type,l,r)
01260 #define WN_GT(type,l,r) WN_Relational(OPR_GT,type,l,r)
01261 #define WN_GE(type,l,r) WN_Relational(OPR_GE,type,l,r)
01262
01263 #define WN_LNOT(l) WN_Unary(OPR_LNOT,Boolean_type,l)
01264 #define WN_LAND(l,r) WN_Binary(OPR_LAND,Boolean_type,l,r)
01265 #define WN_LIOR(l,r) WN_Binary(OPR_LIOR,Boolean_type,l,r)
01266 #define WN_CAND(l,r) WN_Binary(OPR_CAND,Boolean_type,l,r)
01267 #define WN_CIOR(l,r) WN_Binary(OPR_CIOR,Boolean_type,l,r)
01268
01269 #define WN_Lshr(type,l,r) WN_Binary(OPR_LSHR,type,l,r)
01270 #define WN_Ashr(type,l,r) WN_Binary(OPR_ASHR,type,l,r)
01271 #define WN_Shl(type,l,r) WN_Binary(OPR_SHL,type,l,r)
01272
01273 #define WN_Bnot(type,l) WN_Unary(OPR_BNOT,type,l)
01274 #define WN_Band(type,l,r) WN_Binary(OPR_BAND,type,l,r)
01275 #define WN_Bior(type,l,r) WN_Binary(OPR_BIOR,type,l,r)
01276 #define WN_Bxor(type,l,r) WN_Binary(OPR_BXOR,type,l,r)
01277
01278 #define WN_Realpart(t,l) WN_Unary(OPR_REALPART,t,l)
01279 #define WN_Imagpart(t,l) WN_Unary(OPR_IMAGPART,t,l)
01280 #define WN_Complex(type,l,r) WN_Binary(OPR_COMPLEX,type,l,r)
01281
01282 extern WN * WN_Int_Type_Conversion( WN *wn, TYPE_ID to_type );
01283 extern WN * WN_Float_Type_Conversion( WN *wn, TYPE_ID to_type );
01284 extern WN * WN_Type_Conversion( WN *wn, TYPE_ID to_type );
01285
01286 extern INT32 WN_Size_and_StartAddress (WN *wn, void **StartAddress);
01287
01288 extern BOOL WN_verifier(WN *);
01289
01290
01291
01292
01293
01294
01295
01296
01297 extern BOOL WN_Tree_Has_Duplicate_Labels(
01298 WN *pu_wn,
01299 MEM_POOL *tmp_pool
01300 );
01301
01302
01303
01304
01305
01306
01307
01308
01309
01310
01311
01312
01313
01314 extern BOOL WN_Rename_Duplicate_Labels (
01315 WN *orig_wn,
01316 WN *copied_wn,
01317 WN *pu_wn,
01318 MEM_POOL *tmp_pool
01319 );
01320
01321
01322 inline WN *
01323 WN_Create_Generic (OPERATOR opr, TYPE_ID rtype, TYPE_ID desc,
01324 mINT16 kid_count, WN *next, WN *prev,
01325 ST *st, INT32 label_number, INT32 num_entries,
01326 TY_IDX ty, TY_IDX load_addr_ty, WN_OFFSET offset,
01327 INT16 cvtl_bits, INT32 num_dim, WN_ESIZE element_size,
01328 INT64 const_value, UINT32 flag, INTRINSIC intrinsic)
01329 {
01330 return WN_Create_Generic (opr, rtype, desc,
01331 kid_count, next, prev, ST_st_idx (st),
01332 label_number, num_entries, ty, load_addr_ty,
01333 offset, cvtl_bits, num_dim, element_size,
01334 const_value, flag, intrinsic);
01335 }
01336
01337 inline WN *
01338 WN_Create_Generic (OPCODE opcode, mINT16 kid_count, WN *next, WN *prev,
01339 ST *st, INT32 label_number, INT32 num_entries,
01340 TY_IDX ty, TY_IDX load_addr_ty, WN_OFFSET offset,
01341 INT16 cvtl_bits, INT32 num_dim, WN_ESIZE element_size,
01342 INT64 const_value, UINT32 flag, INTRINSIC intrinsic)
01343 {
01344 return WN_Create_Generic (OPCODE_operator(opcode), OPCODE_rtype(opcode),
01345 OPCODE_desc(opcode), kid_count, next, prev, st,
01346 label_number, num_entries, ty, load_addr_ty,
01347 offset, cvtl_bits, num_dim, element_size,
01348 const_value, flag, intrinsic);
01349 }
01350
01351 inline WN *
01352 WN_CreateEntry (INT16 nkids, ST *name, WN *body, WN *pragmas, WN *varrefs)
01353 {
01354 return WN_CreateEntry (nkids, ST_st_idx (name), body, pragmas, varrefs);
01355 }
01356
01357
01358 inline WN *
01359 WN_CreateRegionExit (ST *st, INT32 label_number)
01360 {
01361 return WN_CreateRegionExit (label_number);
01362 }
01363
01364 inline WN *
01365 WN_CreateRegionExit (ST_IDX st, INT32 label_number)
01366 {
01367 return WN_CreateRegionExit (label_number);
01368 }
01369
01370
01371 inline WN *
01372 WN_CreateGoto (ST *st, INT32 label_number)
01373 {
01374 return WN_CreateGoto (label_number);
01375 }
01376
01377 inline WN *
01378 WN_CreateGoto (ST_IDX st, INT32 label_number)
01379 {
01380 return WN_CreateGoto (label_number);
01381 }
01382
01383
01384 inline WN *
01385 WN_CreateLabel (ST_IDX st, INT32 label_number, UINT32 label_flag, WN *loop_info)
01386 {
01387 return WN_CreateLabel (label_number, label_flag, loop_info);
01388 }
01389
01390 inline WN *
01391 WN_CreateAltentry (ST *entry)
01392 {
01393 return WN_CreateAltentry (ST_st_idx (entry));
01394 }
01395
01396 inline WN *
01397 WN_CreateXgoto (INT32 num_entries, WN *value, WN *block, ST *st)
01398 {
01399 return WN_CreateXgoto (num_entries, value, block, ST_st_idx (st));
01400 }
01401
01402 inline WN *
01403 WN_CreateStid (OPERATOR opr, TYPE_ID rtype, TYPE_ID desc,
01404 WN_OFFSET offset, ST_IDX st, TY_IDX ty, WN *value,
01405 UINT field_id = 0)
01406 {
01407 return WN_CreateStid (opr, rtype, desc, offset, &St_Table[st], ty, value, field_id);
01408 }
01409
01410 inline WN *
01411 WN_CreateStid (OPCODE opc, WN_OFFSET offset, ST_IDX st, TY_IDX ty, WN *value,
01412 UINT field_id = 0)
01413 {
01414 return WN_CreateStid (OPCODE_operator(opc), OPCODE_rtype(opc),
01415 OPCODE_desc(opc), offset, st, ty, value, field_id);
01416 }
01417
01418 inline WN *
01419 WN_CreatePragma (WN_PRAGMA_ID pragma_name, ST *st, INT32 arg1, INT32 arg2)
01420 {
01421 return WN_CreatePragma (pragma_name, ST_st_idx (st), arg1, arg2);
01422 }
01423
01424 inline WN *
01425 WN_CreatePragma (WN_PRAGMA_ID pragma_name,
01426 ST *st,
01427 INT32 arg1,
01428 PREG_NUM asm_copyout_preg,
01429 UINT32 asm_opnd_num)
01430 {
01431 return WN_CreatePragma (pragma_name, ST_st_idx (st),
01432 arg1, asm_copyout_preg, asm_opnd_num);
01433 }
01434
01435 inline WN *
01436 WN_CreateXpragma (WN_PRAGMA_ID pragma_name, ST *st, INT16 kid_count)
01437 {
01438 return WN_CreateXpragma (pragma_name, ST_st_idx (st), kid_count);
01439 }
01440
01441 inline WN *
01442 WN_CreateLdid (OPERATOR opr, TYPE_ID rtype, TYPE_ID desc,
01443 WN_OFFSET offset, ST *st, TY_IDX ty, UINT field_id = 0)
01444 {
01445 return WN_CreateLdid (opr, rtype, desc, offset, ST_st_idx (st), ty, field_id);
01446 }
01447
01448 inline WN *
01449 WN_CreateLdid (OPCODE opc, WN_OFFSET offset, ST *st, TY_IDX ty, UINT field_id = 0)
01450 {
01451 return WN_CreateLdid (OPCODE_operator(opc), OPCODE_rtype(opc),
01452 OPCODE_desc(opc), offset, st, ty, field_id);
01453 }
01454
01455 inline WN *
01456 WN_CreateLda (OPERATOR opr, TYPE_ID rtype, TYPE_ID desc,
01457 WN_OFFSET offset, TY_IDX ty, ST *st, UINT field_id = 0)
01458 {
01459 return WN_CreateLda(opr, rtype, desc, offset, ty, ST_st_idx (st), field_id);
01460 }
01461
01462 inline WN *
01463 WN_CreateLda (OPCODE opc, WN_OFFSET offset, TY_IDX ty, ST *st)
01464 {
01465 return WN_CreateLda (OPCODE_operator(opc), OPCODE_rtype(opc),
01466 OPCODE_desc(opc), offset, ty, st);
01467 }
01468
01469 inline WN *
01470 WN_CreateIdname (WN_OFFSET offset, ST *st)
01471 {
01472 return WN_CreateIdname (offset, ST_st_idx (st));
01473 }
01474
01475 inline WN *
01476 WN_CreateConst (OPERATOR opr, TYPE_ID rtype, TYPE_ID desc, ST *st )
01477 {
01478 return WN_CreateConst (opr, rtype, desc, ST_st_idx (st));
01479 }
01480
01481 inline WN *
01482 WN_CreateConst (OPCODE opc, ST *st )
01483 {
01484 return WN_CreateConst (OPCODE_operator(opc), OPCODE_rtype(opc),
01485 OPCODE_desc(opc), st);
01486 }
01487
01488 inline WN *
01489 WN_Ldid (TYPE_ID desc, WN_OFFSET offset, ST *sym, TY_IDX align, UINT field_id = 0)
01490 {
01491 return WN_Ldid (desc, offset, ST_st_idx (sym), align, field_id);
01492 }
01493
01494 inline WN *
01495 WN_RLdid (TYPE_ID rtype, TYPE_ID desc, WN_OFFSET offset, ST *sym, TY_IDX align)
01496 {
01497 return WN_RLdid (rtype, desc, offset, ST_st_idx (sym), align);
01498 }
01499
01500 inline WN *
01501 WN_generic_call (OPERATOR opr, TYPE_ID rtype, TYPE_ID desc, INT32 n, ST *sym)
01502 {
01503 return WN_generic_call (opr, rtype, desc, n, ST_st_idx (sym));
01504 }
01505
01506
01507 extern WN* WN_CreateAffirm (WN* condition);
01508 extern WN* WN_CreateAlloca (WN* size);
01509 extern WN* WN_CreateDealloca (INT32 n);
01510 extern WN* WN_CreateLdma (TYPE_ID rtype, WN_OFFSET offset, TY_IDX ty, ST_IDX st);
01511
01512 extern void WN_set_st_addr_saved (WN *);
01513
01514 extern BOOL WN_has_side_effects (const WN*);
01515
01516 extern WN *WN_Rrotate (TYPE_ID desc, WN *src, WN *cnt);
01517
01518 #if defined(TARG_SL)
01519 extern WN* WN_CreateFork(INT32 label_number, BOOL major);
01520 extern BOOL WN_Intrinsic_OP_Slave(WN * wn);
01521 #endif // TARG_SL
01522 #endif
01523
01524
01525