[AArch64] Add cost handling of CALLER_SAVE_REGS and POINTER_REGS
[official-gcc.git] / libgo / runtime / go-unsafe-pointer.c
blob729e9a19736694439ede233745c2cb035f879e64
1 /* go-unsafe-pointer.c -- unsafe.Pointer type descriptor for Go.
3 Copyright 2009 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. */
7 #include <stddef.h>
9 #include "runtime.h"
10 #include "go-type.h"
11 #include "mgc0.h"
13 /* A pointer with a zero value. */
14 static void *zero_pointer;
16 /* This file provides the type descriptor for the unsafe.Pointer type.
17 The unsafe package is defined by the compiler itself, which means
18 that there is no package to compile to define the type
19 descriptor. */
21 extern const struct __go_type_descriptor unsafe_Pointer
22 __asm__ (GOSYM_PREFIX "__go_tdn_unsafe.Pointer");
24 extern const uintptr unsafe_Pointer_gc[]
25 __asm__ (GOSYM_PREFIX "__go_tdn_unsafe.Pointer$gc");
27 /* Used to determine the field alignment. */
28 struct field_align
30 char c;
31 void *p;
34 /* The reflection string. */
35 #define REFLECTION "unsafe.Pointer"
36 static const String reflection_string =
38 (const byte *) REFLECTION,
39 sizeof REFLECTION - 1
42 const uintptr unsafe_Pointer_gc[] = {sizeof(void*), GC_APTR, 0, GC_END};
44 const struct __go_type_descriptor unsafe_Pointer =
46 /* __code */
47 GO_UNSAFE_POINTER,
48 /* __align */
49 __alignof (void *),
50 /* __field_align */
51 offsetof (struct field_align, p) - 1,
52 /* __size */
53 sizeof (void *),
54 /* __hash */
55 78501163U,
56 /* __hashfn */
57 __go_type_hash_identity,
58 /* __equalfn */
59 __go_type_equal_identity,
60 /* __gc */
61 unsafe_Pointer_gc,
62 /* __reflection */
63 &reflection_string,
64 /* __uncommon */
65 NULL,
66 /* __pointer_to_this */
67 NULL,
68 /* __zero */
69 &zero_pointer
72 /* We also need the type descriptor for the pointer to unsafe.Pointer,
73 since any package which refers to that type descriptor will expect
74 it to be defined elsewhere. */
76 extern const struct __go_ptr_type pointer_unsafe_Pointer
77 __asm__ (GOSYM_PREFIX "__go_td_pN14_unsafe.Pointer");
79 /* The reflection string. */
80 #define PREFLECTION "*unsafe.Pointer"
81 static const String preflection_string =
83 (const byte *) PREFLECTION,
84 sizeof PREFLECTION - 1,
87 const struct __go_ptr_type pointer_unsafe_Pointer =
89 /* __common */
91 /* __code */
92 GO_PTR,
93 /* __align */
94 __alignof (void *),
95 /* __field_align */
96 offsetof (struct field_align, p) - 1,
97 /* __size */
98 sizeof (void *),
99 /* __hash */
100 1256018616U,
101 /* __hashfn */
102 __go_type_hash_identity,
103 /* __equalfn */
104 __go_type_equal_identity,
105 /* __gc */
106 unsafe_Pointer_gc,
107 /* __reflection */
108 &preflection_string,
109 /* __uncommon */
110 NULL,
111 /* __pointer_to_this */
112 NULL,
113 /* __zero */
114 &zero_pointer
116 /* __element_type */
117 &unsafe_Pointer