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