+2018-02-01 Cherry Zhang <cherryyz@google.com>
+
+ * lang.opt (fgo-optimize): Remove RejectNegative.
+ * go-c.h (go_enable_optimize): Update declaration to take value
+ argument.
+ * go-lang.c (go_langhook_handle_option): Pass value to
+ go_enable_optimize.
+ * gccgo.texi (Invoking gccgo): Update -fgo-optimize-allocs doc.
+
2018-01-30 Ian Lance Taylor <iant@golang.org>
* go-gcc.cc (Gcc_backend::convert_tree): New private method.
by default, but in the future may be off by default on systems that do
not require it.
-@item -fgo-optimize-allocs
-@cindex @option{-fgo-optimize-allocs}
-Use escape analysis to allocate objects on the stack rather than the
-heap when possible. In the future this may be the default.
+@item -fno-go-optimize-allocs
+@cindex @option{-fno-go-optimize-allocs}
+Disable escape analysis, which tries to allocate objects on the stack
+rather than the heap.
@item -fgo-debug-escape@var{n}
@cindex @option{-fgo-debug-escape}
interface. */
extern int go_enable_dump (const char*);
-extern int go_enable_optimize (const char*);
+extern int go_enable_optimize (const char*, int);
extern void go_add_search_path (const char*);
go_langhook_handle_option (
size_t scode,
const char *arg,
- int value ATTRIBUTE_UNUSED,
+ int value,
int kind ATTRIBUTE_UNUSED,
location_t loc ATTRIBUTE_UNUSED,
const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
break;
case OPT_fgo_optimize_:
- ret = go_enable_optimize (arg) ? true : false;
+ ret = go_enable_optimize (arg, value) ? true : false;
break;
case OPT_fgo_pkgpath_:
-023c3d4358d101c71ac1436065690eaec2ce138e
+e148068360699f24118950b728f23a5c98e1f85e
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
// The -fgo-optimize-alloc flag activates this escape analysis.
-Go_optimize optimize_allocation_flag("allocs");
+Go_optimize optimize_allocation_flag("allocs", true);
// A helper function to compute whether a function name has a
// matching hash value.
// Create a new optimization.
-Go_optimize::Go_optimize(const char* name)
- : next_(optimizations), name_(name), is_enabled_(false)
+Go_optimize::Go_optimize(const char* name, bool enabled)
+ : next_(optimizations), name_(name), is_enabled_(enabled)
{
optimizations = this;
}
// Enable an optimization by name.
bool
-Go_optimize::enable_by_name(const char* name)
+Go_optimize::enable_by_name(const char* name, bool value)
{
bool is_all = strcmp(name, "all") == 0;
bool found = false;
{
if (is_all || strcmp(name, p->name_) == 0)
{
- p->is_enabled_ = true;
+ p->is_enabled_ = value;
found = true;
}
}
return found;
}
-// Enable an optimization. Return 1 if this is a real name, 0 if not.
+// Enable/disable an optimization. Return 1 if this is a real name, 0 if not.
GO_EXTERN_C
int
-go_enable_optimize(const char* name)
+go_enable_optimize(const char* name, int value)
{
- return Go_optimize::enable_by_name(name) ? 1 : 0;
+ return Go_optimize::enable_by_name(name, (bool)value) ? 1 : 0;
}
class Go_optimize
{
public:
- Go_optimize(const char* name);
+ Go_optimize(const char*, bool);
// Whether this optimizaiton was enabled.
bool
is_enabled() const
{ return this->is_enabled_; }
- // Enable an optimization by name. Return true if found.
+ // Enable/disable an optimization by name. Return true if found.
static bool
- enable_by_name(const char*);
+ enable_by_name(const char*, bool);
private:
// The next optimize flag. These are not in any order.
-fgo-dump-<type> Dump Go frontend internal information.
fgo-optimize-
-Go Joined RejectNegative
+Go Joined
-fgo-optimize-<type> Turn on optimization passes in the frontend.
fgo-pkgpath=