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
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 #ifndef cgexp_INCLUDED
00080 #define cgexp_INCLUDED
00081
00082 #include "variants.h"
00083 #include "cgtarget.h"
00084
00085 extern void Init_CG_Expand (void);
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 extern void Exp_OP (OPCODE opcode, TN *result, TN *op1, TN *op2, TN *op3,
00098 VARIANT variant, OPS *ops);
00099 #define Exp_OP0(c,r,ops) Exp_OP(c,r,NULL,NULL,NULL,V_NONE,ops)
00100 #define Exp_OP1(c,r,o1,ops) Exp_OP(c,r,o1,NULL,NULL,V_NONE,ops)
00101 #define Exp_OP1v(c,r,o1,v,ops) Exp_OP(c,r,o1,NULL,NULL,v,ops)
00102 #define Exp_OP2(c,r,o1,o2,ops) Exp_OP(c,r,o1,o2,NULL,V_NONE,ops)
00103 #define Exp_OP2v(c,r,o1,o2,v,ops) Exp_OP(c,r,o1,o2,NULL,v,ops)
00104 #define Exp_OP3(c,r,o1,o2,o3,ops) Exp_OP(c,r,o1,o2,o3,V_NONE,ops)
00105 #define Exp_OP3v(c,r,o1,o2,o3,v,ops) Exp_OP(c,r,o1,o2,o3,v,ops)
00106
00107
00108
00109
00110
00111 #if defined(TARG_SL)
00112 extern void Exp_Lda (
00113 TYPE_ID mtype, TN *tgt_tn, ST *sym, INT64 ofst, OPERATOR call_opr, OPS *ops, BOOL is_internal_mem_ofst = FALSE);
00114 #else
00115 extern void Exp_Lda (
00116 TYPE_ID mtype, TN *tgt_tn, ST *sym, INT64 ofst, OPERATOR call_opr, OPS *ops);
00117 #endif
00118
00119
00120
00121
00122 extern void Exp_Load (
00123 TYPE_ID rtype, TYPE_ID desc, TN *tgt_tn, ST *sym, INT64 ofst, OPS *ops,
00124 VARIANT variant);
00125
00126
00127 extern void Exp_Store (
00128 TYPE_ID mtype, TN *src_tn, ST *sym, INT64 ofst, OPS *ops,
00129 VARIANT variant);
00130
00131
00132 #ifdef TARG_X8664
00133 extern void Exp_COPY (TN *tgt_tn, TN *src_tn, OPS *ops, BOOL copy_pair=FALSE);
00134 #else
00135 extern void Exp_COPY (TN *tgt_tn, TN *src_tn, OPS *ops);
00136 #endif
00137
00138 #if defined(TARG_X8664) || defined(TARG_MIPS)
00139
00140 extern void Exp_COPY_Ext (TOP opcode, TN *tgt_tn, TN *src_tn, OPS *ops);
00141 #endif
00142
00143
00144
00145
00146
00147
00148 extern void Exp_Simulated_Op (const OP *op, OPS *ops, INT pc_value);
00149
00150
00151
00152
00153 extern INT Simulated_Op_Real_Ops (const OP *op);
00154 extern INT Simulated_Op_Real_Inst_Words (const OP *op);
00155
00156
00157
00158
00159
00160 extern TN * Exp_Intrinsic_Call (
00161 INTRINSIC id, TN *op0, TN *op1, TN *op2, OPS *ops,
00162 LABEL_IDX *label, OPS *loop_ops);
00163
00164 #if defined(TARG_SL)
00165
00166 extern TN * Exp_SL_Intrinsic_Call (INTRINSIC id, WN *intrncall, OPS *ops,
00167 LABEL_IDX *label, OPS *loop_ops, TN* result = NULL);
00168 TN*
00169 Build_SL_Intrinsic_OP( INTRINSIC id, WN* intrncall, OPS *ops, TN* result =NULL);
00170 #endif
00171
00172 #ifdef TARG_X8664
00173
00174 extern void Exp_Savexmms_Intrinsic(WN *intrncall, TN *rax_tn, LABEL_IDX *label,
00175 OPS *ops);
00176
00177 extern void Exp_Landingpadentry_Intrinsic (ST *dest1, ST *dest2, OPS* ops);
00178
00179 extern void Exp_Fetch_and_And( TN*, TN*, TYPE_ID, OPS* );
00180 extern void Exp_Fetch_and_Or( TN*, TN*, TYPE_ID, OPS* );
00181 extern void Exp_Fetch_and_Xor( TN*, TN*, TYPE_ID, OPS* );
00182 extern TN* Exp_Compare_and_Swap( TN*, TN*, TN*, TYPE_ID, OPS* );
00183
00184
00185 extern void Exp_Intrinsic_Op (INTRINSIC id, TN *result, TN *op0, TN *op1, TN *op2, TYPE_ID mtype, OPS *ops);
00186
00187 #elif defined(TARG_IA64)
00188 extern void Exp_Intrinsic_Op (INTRINSIC id, TN *result, TN *op0, TN *op1, OPS *ops);
00189 #else
00190
00191 extern void Exp_Intrinsic_Op (INTRINSIC id, TN *result, TN *op0, TN *op1, TYPE_ID mtype, OPS *ops);
00192 #endif // TARG_X8664
00193
00194
00195
00196 #ifdef TARG_SL
00197 extern void Exp_Immediate (TN *dest, TN *src, TYPE_ID rtype, OPS *);
00198 #else
00199 extern void Exp_Immediate (TN *dest, TN *src, BOOL is_signed, OPS *);
00200 #endif
00201
00202
00203 #define Exp_ADD(mtype,dest,src1,src2,ops) \
00204 Exp_OP2 (OPCODE_make_op(OPR_ADD,mtype,MTYPE_V), dest,src1,src2,ops)
00205 #define Exp_SUB(mtype,dest,src1,src2,ops) \
00206 Exp_OP2 (OPCODE_make_op(OPR_SUB,mtype,MTYPE_V), dest,src1,src2,ops)
00207 #define Exp_MPY(mtype,dest,src1,src2,ops) \
00208 Exp_OP2 (OPCODE_make_op(OPR_MPY,mtype,MTYPE_V), dest,src1,src2,ops)
00209 #define Exp_BAND(mtype,dest,src1,src2,ops) \
00210 Exp_OP2 (OPCODE_make_op(OPR_BAND,mtype,MTYPE_V), dest,src1,src2,ops)
00211
00212
00213 extern BOOL Check_Select_Expansion (OPCODE compare);
00214
00215 #ifdef TARG_X8664
00216
00217 extern void Exp_Stid_And_VComp (
00218 OPCODE stid, TN *result, TN *cmp_kid1, TN *cmp_kid2,
00219 OPCODE compare, OPS *ops);
00220
00221
00222 extern void Exp_Select_And_VLdid (
00223 OPCODE select, TN *result, TN *true_tn, TN *false_tn,
00224 OPCODE compare, TN *vldid, OPS *ops);
00225 #endif
00226
00227
00228 #if defined(TARG_SL)
00229 extern void Exp_Select_And_Condition (
00230 WN* wn_select, OPCODE select, TN *result, TN *true_tn, TN *false_tn,
00231 OPCODE compare, TN *cmp_kid1, TN *cmp_kid2, VARIANT variant, OPS *ops);
00232 #else
00233 extern void Exp_Select_And_Condition (
00234 OPCODE select, TN *result, TN *true_tn, TN *false_tn,
00235 OPCODE compare, TN *cmp_kid1, TN *cmp_kid2, VARIANT variant, OPS *ops);
00236 #endif
00237
00238 #if defined(TARG_SL)
00239 extern BOOL Exp_Opt_Select_And_Condition (WN * select, TN * result, TN * true_tn,
00240 TN * false_tn, TN * cmp_kid1, TN * cmp_kid2, OPS * ops);
00241 extern void Exp_2inst_MC_Zero (TOP mc_op, TN* dest_tn, TN* true_tn, TN* false_tn,
00242 TN* cond_tn, TYPE_ID true_type, TYPE_ID false_type, INT unsignedflag, OPS* ops );
00243 #endif
00244
00245 #if defined(TARG_SL)
00246 extern LABEL_IDX Exp_Select_Part1(
00247 OPCODE select, TN *result, TN *true_tn, TN *false_tn,
00248 OPCODE compare, TN *cmp_kid1, TN *cmp_kid2, OPS *ops);
00249 #endif
00250
00251
00252
00253
00254
00255
00256
00257
00258 extern BOOL Reuse_Temp_TNs;
00259 #define Get_Temp_TN(tn) (Reuse_Temp_TNs ? tn : Build_TN_Like(tn))
00260
00261
00262
00263
00264
00265 extern void Exp_Local_Jump(BB *bb, INT64 offset, OPS *ops);
00266
00267
00268
00269
00270
00271
00272 extern BOOL Exp_Is_Large_Stack_Sym(ST* sym, INT64 ofst);
00273
00274
00275 extern void Exp_Prefetch (TOP opc, TN *src1, TN *src2, VARIANT variant, OPS *ops);
00276
00277
00278 extern void Exp_Extract_Bits (TYPE_ID rtype, TYPE_ID desc, UINT bit_offset,
00279 UINT bit_size, TN *tgt_tn, TN *src_tn, OPS *ops);
00280
00281
00282 extern void Exp_Deposit_Bits (TYPE_ID rtype, TYPE_ID desc,
00283 UINT bit_offset, UINT bit_size,
00284 TN *tgt_tn, TN *src1_tn, TN *src2_tn, OPS *ops);
00285
00286 #ifdef TARG_X8664
00287
00288 extern void Exp_Set_Bits (TYPE_ID rtype, TYPE_ID desc,
00289 UINT bit_offset, UINT bit_size,
00290 TN *tgt_tn, TN *src1_tn, OPS *ops);
00291
00292
00293 extern void Exp_Return (TN *return_address, int sp_adjust, OPS *ops);
00294 #else
00295 extern void Exp_Return (TN *return_address, OPS *ops);
00296 #endif
00297
00298
00299 extern void Exp_Call (OPERATOR opr, TN *return_address, TN *target, OPS *ops);
00300
00301
00302 extern void Exp_Indirect_Branch (TN *targ_reg, OPS *ops);
00303
00304
00305 extern void Exp_Noop (OPS *ops);
00306
00307
00308 extern void Exp_Spadjust (TN *dest, TN *size, VARIANT variant, OPS *ops);
00309
00310
00311
00312
00313 extern void Exp_Pred_Calc(TN* result, OP* cmp_op, COMPARE_TYPE ctype,
00314 BOOL false_result, OPS* ops);
00315
00316
00317
00318
00319
00320
00321 extern void Exp_Generic_Pred_Calc(TN* result1, TN *result2, COMPARE_TYPE ctype,
00322 TN *qual_pred, OPS *ops);
00323
00324
00325
00326
00327 extern void Exp_True_False_Preds_For_Block(BB *bb,
00328 TN* &true_tn, TN * &false_tn);
00329 #ifdef KEY
00330
00331
00332
00333 extern void HB_Reinit_Pred ();
00334 #endif
00335
00336 #ifdef TARG_X8664
00337 extern void Expand_Start();
00338 extern void Expand_Finish();
00339 extern void Expand_Cmov (TOP top, TN *result, TN *src, TN *rflags, OPS *ops,
00340 TN *result2 = NULL, TN *src2 = NULL);
00341 #endif
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351 extern void Exp_Pred_Set(TN *dest, TN *cdest, INT val, OPS *ops);
00352 extern void Exp_Pred_Copy(TN *dest, TN *cdest, TN *src, OPS *ops);
00353 extern void Exp_Pred_Complement(TN *dest, TN *cdest, TN *src, OPS *ops);
00354 extern void Exp_Pred_Compare(TN *dest, TN *cdest, TN *src1, TN *src2,
00355 VARIANT variant, OPS *ops);
00356
00357
00358
00359
00360 extern BOOL Target_Has_Immediate_Operand (WN *parent, WN *expr);
00361
00362 #if defined(TARG_SL)
00363 extern TN * Expand_Expr (WN *expr, WN *parent, TN *result, INTRINSIC intrn_id = INTRINSIC_INVALID);
00364
00365
00366
00367
00368 extern void Expand_Start();
00369 extern void Expand_Finish();
00370 #endif
00371
00372 #ifdef TARG_X8664
00373 extern void CG_Set_Is_Stack_Used();
00374 #endif
00375
00376 #endif