* Go patch committed: Define Backend_function_type
@ 2014-01-14 23:21 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2014-01-14 23:21 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 346 bytes --]
This patch from Chris Manghane adds a Backend_function_type: a function
type that is implemented as a function pointer rather than as the
pointer to a struct that is the implementation of a Go function. This
will be used in other backend conversions. Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1969 bytes --]
diff -r 3515c11d7573 go/types.cc
--- a/go/types.cc Thu Jan 09 22:40:50 2014 -0800
+++ b/go/types.cc Tue Jan 14 15:16:02 2014 -0800
@@ -4066,6 +4066,17 @@
return new Function_type(receiver, parameters, results, location);
}
+// Make a backend function type.
+
+Backend_function_type*
+Type::make_backend_function_type(Typed_identifier* receiver,
+ Typed_identifier_list* parameters,
+ Typed_identifier_list* results,
+ Location location)
+{
+ return new Backend_function_type(receiver, parameters, results, location);
+}
+
// Class Pointer_type.
// Traversal.
diff -r 3515c11d7573 go/types.h
--- a/go/types.h Thu Jan 09 22:40:50 2014 -0800
+++ b/go/types.h Tue Jan 14 15:16:02 2014 -0800
@@ -19,6 +19,7 @@
class Complex_type;
class String_type;
class Function_type;
+class Backend_function_type;
class Struct_field;
class Struct_field_list;
class Struct_type;
@@ -484,6 +485,12 @@
Typed_identifier_list* results,
Location);
+ static Backend_function_type*
+ make_backend_function_type(Typed_identifier* receiver,
+ Typed_identifier_list* parameters,
+ Typed_identifier_list* results,
+ Location);
+
static Pointer_type*
make_pointer_type(Type*);
@@ -1896,6 +1903,23 @@
Btype* fnbtype_;
};
+// The type of a function's backend representation.
+
+class Backend_function_type : public Function_type
+{
+ public:
+ Backend_function_type(Typed_identifier* receiver,
+ Typed_identifier_list* parameters,
+ Typed_identifier_list* results, Location location)
+ : Function_type(receiver, parameters, results, location)
+ { }
+
+ protected:
+ Btype*
+ do_get_backend(Gogo* gogo)
+ { return this->get_backend_fntype(gogo); }
+};
+
// The type of a pointer.
class Pointer_type : public Type
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-01-14 23:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-14 23:21 Go patch committed: Define Backend_function_type Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).