aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/go-gcc.cc
diff options
context:
space:
mode:
authorChris Manghane <cmang@google.com>2013-10-11 22:17:47 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2013-10-11 22:17:47 +0000
commitb7d93b468a08d46d5bd7d0ed9e08695eef89ce24 (patch)
tree99f0ea46175de93ca5f449a6f4e1c690d5ff89c1 /gcc/go/go-gcc.cc
parentef3cfba23d0f9c518cc71ff053994e77e80f1d1a (diff)
downloadgcc-b7d93b468a08d46d5bd7d0ed9e08695eef89ce24.zip
gcc-b7d93b468a08d46d5bd7d0ed9e08695eef89ce24.tar.gz
gcc-b7d93b468a08d46d5bd7d0ed9e08695eef89ce24.tar.bz2
compiler: Use backend interface for function code expressions.
* go-gcc.cc (Gcc_backend::function_code_expression): New function. From-SVN: r203467
Diffstat (limited to 'gcc/go/go-gcc.cc')
-rw-r--r--gcc/go/go-gcc.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index 6b77d94..81e9ad1 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -232,6 +232,9 @@ class Gcc_backend : public Backend
Bexpression*
convert_expression(Btype* type, Bexpression* expr, Location);
+ Bexpression*
+ function_code_expression(Bfunction*, Location);
+
// Statements.
Bstatement*
@@ -981,6 +984,19 @@ Gcc_backend::convert_expression(Btype* type, Bexpression* expr, Location)
return tree_to_expr(ret);
}
+// Get the address of a function.
+
+Bexpression*
+Gcc_backend::function_code_expression(Bfunction* bfunc, Location location)
+{
+ tree func = bfunc->get_tree();
+ if (func == error_mark_node)
+ return this->error_expression();
+
+ tree ret = build_fold_addr_expr_loc(location.gcc_location(), func);
+ return this->make_expression(ret);
+}
+
// An expression as a statement.
Bstatement*