diff mbox series

[5/5] replace convert_load_instruction() by replace_with_pseudo()

Message ID 20201129144922.56209-6-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series use replace_with_pseudo() for simplify_memops() | expand

Commit Message

Luc Van Oostenryck Nov. 29, 2020, 2:49 p.m. UTC
These two functions are now exactly the same, so replace the
first one by the second one.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 flow.c   | 7 +------
 flow.h   | 1 -
 memops.c | 7 ++++---
 ssa.c    | 9 +++++----
 4 files changed, 10 insertions(+), 14 deletions(-)
diff mbox series

Patch

diff --git a/flow.c b/flow.c
index 20827acce88b..95e44ac104f6 100644
--- a/flow.c
+++ b/flow.c
@@ -16,6 +16,7 @@ 
 #include "parse.h"
 #include "expression.h"
 #include "linearize.h"
+#include "simplify.h"
 #include "flow.h"
 #include "target.h"
 #include "flowgraph.h"
@@ -453,12 +454,6 @@  void convert_instruction_target(struct instruction *insn, pseudo_t src)
 	target->users = NULL;
 }
 
-void convert_load_instruction(struct instruction *insn, pseudo_t src)
-{
-	convert_instruction_target(insn, src);
-	kill_instruction(insn);
-}
-
 static int overlapping_memop(struct instruction *a, struct instruction *b)
 {
 	unsigned int a_start = bytes_to_bits(a->offset);
diff --git a/flow.h b/flow.h
index c55362de848e..46d76a780484 100644
--- a/flow.h
+++ b/flow.h
@@ -38,7 +38,6 @@  static inline int kill_instruction_force(struct instruction *insn)
 }
 
 void check_access(struct instruction *insn);
-void convert_load_instruction(struct instruction *, pseudo_t);
 int dominates(pseudo_t pseudo, struct instruction *insn, struct instruction *dom, int local);
 
 extern void vrfy_flow(struct entrypoint *ep);
diff --git a/memops.c b/memops.c
index 6620688264ad..7efade22c9b5 100644
--- a/memops.c
+++ b/memops.c
@@ -14,6 +14,7 @@ 
 #include "parse.h"
 #include "expression.h"
 #include "linearize.h"
+#include "simplify.h"
 #include "flow.h"
 
 /*
@@ -40,7 +41,7 @@  static void rewrite_load_instruction(struct instruction *insn, struct pseudo_lis
 	 * and convert the load into a LNOP and replace the
 	 * pseudo.
 	 */
-	convert_load_instruction(insn, new);
+	replace_with_pseudo(insn, new);
 	FOR_EACH_PTR(dominators, phi) {
 		kill_instruction(phi->def);
 	} END_FOR_EACH_PTR(phi);
@@ -167,7 +168,7 @@  static void simplify_loads(struct basic_block *bb)
 					if (!compatible_loads(insn, dom))
 						goto next_load;
 					/* Yeehaa! Found one! */
-					convert_load_instruction(insn, dom->target);
+					replace_with_pseudo(insn, dom->target);
 					goto next_load;
 				}
 			} END_FOR_EACH_PTR_REVERSE(dom);
@@ -181,7 +182,7 @@  static void simplify_loads(struct basic_block *bb)
 				if (!dominators) {
 					if (local) {
 						assert(pseudo->type != PSEUDO_ARG);
-						convert_load_instruction(insn, value_pseudo(0));
+						replace_with_pseudo(insn, value_pseudo(0));
 					}
 					goto next_load;
 				}
diff --git a/ssa.c b/ssa.c
index 3e8800507f63..a2e27030e4b6 100644
--- a/ssa.c
+++ b/ssa.c
@@ -11,7 +11,8 @@ 
 #include "dominate.h"
 #include "flowgraph.h"
 #include "linearize.h"
-#include "flow.h"			// for convert_load_instruction()
+#include "simplify.h"
+#include "flow.h"
 
 
 // Is it possible and desirable for this to be promoted to a pseudo?
@@ -109,7 +110,7 @@  static void rewrite_local_var(struct basic_block *bb, pseudo_t addr, int nbr_sto
 		case OP_LOAD:
 			if (!val)
 				val = undef_pseudo();
-			convert_load_instruction(insn, val);
+			replace_with_pseudo(insn, val);
 			break;
 		case OP_STORE:
 			val = insn->target;
@@ -150,7 +151,7 @@  static bool rewrite_single_store(struct instruction *store)
 
 		// undefs ?
 
-		convert_load_instruction(insn, store->target);
+		replace_with_pseudo(insn, store->target);
 	} END_FOR_EACH_PTR(pu);
 
 	// is there some unconverted loads?
@@ -292,7 +293,7 @@  static void ssa_rename_insn(struct basic_block *bb, struct instruction *insn)
 		if (!var || !var->torename)
 			break;
 		val = lookup_var(bb, var);
-		convert_load_instruction(insn, val);
+		replace_with_pseudo(insn, val);
 		break;
 	case OP_PHI:
 		var = insn->type;