github.com/ronhuafeng/gofrontend@v0.0.0-20220715151246-ff23266b8bc5/go/runtime.h (about) 1 // runtime.h -- runtime functions called by generated code -*- C++ -*- 2 3 // Copyright 2011 The Go Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 7 #ifndef GO_RUNTIME_H 8 #define GO_RUNTIME_H 9 10 class Gogo; 11 class Type; 12 class Named_object; 13 class Call_expression; 14 15 class Runtime 16 { 17 public: 18 19 // The runtime functions which may be called by generated code. 20 enum Function 21 { 22 23 #define DEF_GO_RUNTIME(CODE, NAME, PARAMS, RESULTS) CODE , 24 25 #include "runtime.def" 26 27 #undef DEF_GO_RUNTIME 28 29 // Number of runtime functions. 30 NUMBER_OF_FUNCTIONS 31 }; 32 33 // Make a call to a runtime function. 34 static Call_expression* 35 make_call(Function, Location, int, ...); 36 37 // Convert all the types used by runtime functions to the backend 38 // representation. 39 static void 40 convert_types(Gogo*); 41 42 // Return the runtime code for a named builtin function. 43 static Function 44 name_to_code(const std::string&); 45 46 private: 47 static Named_object* 48 runtime_declaration(Function); 49 }; 50 51 #endif // !defined(GO_BUILTINS_H)