Go patch committed: Remove stack_allocation_expression

Message ID CAOyqgcWM9i6Ms9LqzpD=qhpaNsdTu4V6woStQ4JZkXb-CJOo4Q@mail.gmail.com
State New
Headers show
Series
  • Go patch committed: Remove stack_allocation_expression
Related show

Commit Message

Ian Lance Taylor June 8, 2018, 11:55 p.m.
This patch to the Go frontend by Cherry Zhang removes
stack_allocation_expression from the backend interface.  Now that we
consistently use temporary variables for temporaries,
stack_allocation_expression is no longer used.  Bootstrapped and ran
Go testsuite on x86_64-pc-linux-gnu.  Committed to mainline.

Ian

2018-06-08  Cherry Zhang  <cherryyz@google.com>

* go-gcc.cc (class Gcc_backend): Remove
stack_allocation_expression method.

Patch

Index: gcc/go/go-gcc.cc
===================================================================
--- gcc/go/go-gcc.cc	(revision 261203)
+++ gcc/go/go-gcc.cc	(working copy)
@@ -352,9 +352,6 @@  class Gcc_backend : public Backend
                   const std::vector<Bexpression*>& args,
                   Bexpression* static_chain, Location);
 
-  Bexpression*
-  stack_allocation_expression(int64_t size, Location);
-
   // Statements.
 
   Bstatement*
@@ -1999,20 +1996,6 @@  Gcc_backend::call_expression(Bfunction*,
   return this->make_expression(ret);
 }
 
-// Return an expression that allocates SIZE bytes on the stack.
-
-Bexpression*
-Gcc_backend::stack_allocation_expression(int64_t size, Location location)
-{
-  tree alloca = builtin_decl_explicit(BUILT_IN_ALLOCA);
-  tree size_tree = build_int_cst(integer_type_node, size);
-  tree ret = build_call_expr_loc(location.gcc_location(), alloca, 1, size_tree);
-  tree memset = builtin_decl_explicit(BUILT_IN_MEMSET);
-  ret = build_call_expr_loc(location.gcc_location(), memset, 3,
-                            ret, integer_zero_node, size_tree);
-  return this->make_expression(ret);
-}
-
 // An expression as a statement.
 
 Bstatement*
Index: gcc/go/gofrontend/backend.h
===================================================================
--- gcc/go/gofrontend/backend.h	(revision 261203)
+++ gcc/go/gofrontend/backend.h	(working copy)
@@ -379,10 +379,6 @@  class Backend
                   const std::vector<Bexpression*>& args,
 		  Bexpression* static_chain, Location) = 0;
 
-  // Return an expression that allocates SIZE bytes on the stack.
-  virtual Bexpression*
-  stack_allocation_expression(int64_t size, Location) = 0;
-
   // Statements.
 
   // Create an error statement.  This is used for cases which should