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 #include <alloca.h>
00042 #include "defs.h"
00043 #include "config.h"
00044 #include "mempool.h"
00045 #include "tracing.h"
00046 #include "timing.h"
00047 #include "cgir.h"
00048 #include "pu_info.h"
00049 #include "cg.h"
00050 #include "cg_flags.h"
00051 #include "ttype.h"
00052 #include "targ_sim.h"
00053 #include "bb_set.h"
00054 #include "freq.h"
00055 #include "cgtarget.h"
00056 #include "whirl2ops.h"
00057 #include "dominate.h"
00058 #include "findloops.h"
00059 #include "cg_vector.h"
00060 #include "gtn_universe.h"
00061 #include "gtn_set.h"
00062 #include "data_layout.h"
00063 #include "op.h"
00064 #include "cflow.h"
00065 #include "reg_live.h"
00066
00067
00068
00069 void
00070 Add_Float_Stores ()
00071 {
00072 OP *op, *next;
00073 BB *bb;
00074 int i;
00075 ST *mem4, *mem8;
00076
00077 mem4 = NULL;
00078 mem8 = NULL;
00079
00080 for (bb = REGION_First_BB; bb != NULL; bb = BB_next(bb)) {
00081 for (op = BB_first_op(bb); op != NULL; op = next) {
00082 next = OP_next(op);
00083
00084 if (!TOP_is_x87(OP_code(op)) ||
00085 OP_load(op) ||
00086 OP_store(op)) {
00087 continue;
00088 }
00089
00090 for (i = 0; i < OP_results(op); i++) {
00091 TN *tn = OP_result(op, i);
00092 if (!TN_is_float(tn))
00093 continue;
00094 Is_True(TN_register_class(tn) == ISA_REGISTER_CLASS_x87,
00095 ("Add_Float_Stores: x87 result uses non-x87 reg class"));
00096
00097
00098
00099 ST **mem_p;
00100 if (TN_size(tn) == 4)
00101 mem_p = &mem4;
00102 else if (TN_size(tn) == 8)
00103 mem_p = &mem8;
00104 else
00105 continue;
00106
00107
00108 if (*mem_p == NULL) {
00109 TY_IDX ty = MTYPE_To_TY(TN_size(tn) == 4 ?
00110 Spill_Float32_Mtype : Spill_Float_Mtype);
00111 *mem_p = Gen_Temp_Symbol(ty, "x87_store");
00112 }
00113
00114
00115 OPS ops = OPS_EMPTY;
00116 OP *new_op;
00117 CGTARG_Store_To_Memory(tn, *mem_p, &ops);
00118 Set_OP_volatile(OPS_first(&ops));
00119 CGTARG_Load_From_Memory(tn, *mem_p, &ops);
00120 FOR_ALL_OPS_OPs(&ops, new_op) OP_srcpos(new_op) = OP_srcpos(op);
00121 BB_Insert_Ops_After(bb, op, &ops);
00122 }
00123 }
00124 }
00125 }