- if (store) {
- /* we found a Store as single user: Now check for Load */
- left = get_irn_n(irn, 2);
- right = get_irn_n(irn, 3);
-
- /* Extra check for commutative ops: put the interesting load right */
-
- /* right != NoMem means, we have a "binary" operation */
- if (node_is_comm(irn) &&
- ! is_NoMem(left) &&
- (pred_is_specific_node(left, is_ia32_Load) ||
- pred_is_specific_node(left, is_ia32_fLoad)))
- {
- if ((addr_b == get_irn_n(get_Proj_pred(left), 0)) &&
- (addr_i == get_irn_n(get_Proj_pred(left), 1)))
- {
- /* We exchange left and right, so it's easier to kill */
- /* the correct Load later and to handle unary operations. */
- set_irn_n(irn, 2, right);
- set_irn_n(irn, 3, left);
-
- temp = left;
- left = right;
- right = temp;
- }
- }
-
- /* skip the Proj for easier access */
- right = get_Proj_pred(right);
-
- /* Compare Load and Store address */
- if ((addr_b == get_irn_n(left, 0)) && (addr_i == get_irn_n(left, 1)))
- {
- /* Left Load is from same address, so we can */
- /* disconnect the Load and Store here */
-
- /* set new base, index and attributes */
- set_irn_n(irn, 0, addr_b);
- set_irn_n(irn, 1, addr_i);
- add_ia32_am_offs(irn, get_ia32_am_offs(left));
- set_ia32_am_scale(irn, get_ia32_am_scale(left));
- set_ia32_am_flavour(irn, get_ia32_am_flavour(left));
- set_ia32_op_type(irn, ia32_AddrModeD);
-
- /* connect to Load memory */
- if (get_irn_arity(irn) == 5) {
- /* binary AMop */
- set_irn_n(irn, 4, get_irn_n(left, 2));
- }
- else {
- /* unary AMop */
- set_irn_n(irn, 3, get_irn_n(left, 2));
- }
-
- /* disconnect from Load */
- set_irn_n(irn, 2, noreg_gp);
-
- /* connect the memory Proj of the Store to the op */
- mem_proj = get_mem_proj(store);
- set_Proj_pred(mem_proj, irn);
- set_Proj_proj(mem_proj, 1);
- }
- } /* if (store) */
- else if (get_ia32_am_support(irn) & ia32_am_Source) {
- /* There was no store, check if we still can optimize for source address mode */
- check_am_src = 1;
- }
- } /* if (support AM Dest) */
- else {
- /* op doesn't support am AM Dest -> check for AM Source */
- check_am_src = 1;
- }