1 /* go-backend.c -- Go frontend interface to gcc backend.
2 Copyright (C) 2010 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
22 #include "coretypes.h"
29 /* This file holds all the cases where the Go frontend needs
30 information from gcc's backend. */
32 /* Return the alignment in bytes of a value of type T. */
35 go_type_alignment (tree t)
37 return TYPE_ALIGN_UNIT (t);
40 /* Return the alignment in bytes of a struct field of type T. */
43 go_field_alignment (tree t)
49 #ifdef BIGGEST_FIELD_ALIGNMENT
50 if (v > BIGGEST_FIELD_ALIGNMENT)
51 v = BIGGEST_FIELD_ALIGNMENT;
54 #ifdef ADJUST_FIELD_ALIGN
57 field = build_decl (UNKNOWN_LOCATION, FIELD_DECL, NULL, t);
58 v = ADJUST_FIELD_ALIGN (field, v);
62 return v / BITS_PER_UNIT;
65 /* Return the size and alignment of a trampoline. */
68 go_trampoline_info (unsigned int *size, unsigned int *alignment)
70 *size = TRAMPOLINE_SIZE;
71 *alignment = TRAMPOLINE_ALIGNMENT;