| 1 | /* emx.c: Functions for emx as target system.
|
|---|
| 2 |
|
|---|
| 3 | Original version by Eberhard Mattes, based on i386.c.
|
|---|
| 4 | Heavily modified by Andrew Zabolotny and Knut St. Osmundsen.
|
|---|
| 5 |
|
|---|
| 6 | This file is part of GNU CC.
|
|---|
| 7 |
|
|---|
| 8 | GNU CC is free software; you can redistribute it and/or modify
|
|---|
| 9 | it under the terms of the GNU General Public License as published by
|
|---|
| 10 | the Free Software Foundation; either version 2, or (at your option)
|
|---|
| 11 | any later version.
|
|---|
| 12 |
|
|---|
| 13 | GNU CC is distributed in the hope that it will be useful,
|
|---|
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 16 | GNU General Public License for more details.
|
|---|
| 17 |
|
|---|
| 18 | You should have received a copy of the GNU General Public License
|
|---|
| 19 | along with GNU CC; see the file COPYING. If not, write to
|
|---|
| 20 | the Free Software Foundation, 59 Temple Place - Suite 330,
|
|---|
| 21 | Boston, MA 02111-1307, USA. */
|
|---|
| 22 |
|
|---|
| 23 | #include "config.h"
|
|---|
| 24 | #include "system.h"
|
|---|
| 25 | #include "rtl.h"
|
|---|
| 26 | #include "regs.h"
|
|---|
| 27 | #include "hard-reg-set.h"
|
|---|
| 28 | #include "output.h"
|
|---|
| 29 | #include "tree.h"
|
|---|
| 30 | #include "toplev.h"
|
|---|
| 31 | #include "flags.h"
|
|---|
| 32 | #include "i386-protos.h"
|
|---|
| 33 |
|
|---|
| 34 | /* The size of the target's pointer type. */
|
|---|
| 35 | #ifndef PTR_SIZE
|
|---|
| 36 | #define PTR_SIZE (POINTER_SIZE / BITS_PER_UNIT)
|
|---|
| 37 | #endif
|
|---|
| 38 |
|
|---|
| 39 | /** @todo remove debug code */
|
|---|
| 40 | /*#define BIRD_DEBUG - DO NOT COMMIT WITH THIS DEFINED!!! */
|
|---|
| 41 |
|
|---|
| 42 | #ifdef BIRD_DEBUG
|
|---|
| 43 | static const char *code(tree node)
|
|---|
| 44 | {
|
|---|
| 45 | if (node)
|
|---|
| 46 | {
|
|---|
| 47 | switch (TREE_CODE (node))
|
|---|
| 48 | {
|
|---|
| 49 | case FUNCTION_TYPE: return "FUNCTION_TYPE";
|
|---|
| 50 | case FUNCTION_DECL: return "FUNCTION_DECL";
|
|---|
| 51 | case METHOD_TYPE: return "METHOD_TYPE";
|
|---|
| 52 | case FIELD_DECL: return "FIELD_DECL";
|
|---|
| 53 | case TYPE_DECL: return "TYPE_DECL";
|
|---|
| 54 | case VAR_DECL: return "VAR_DECL";
|
|---|
| 55 | case PARM_DECL: return "PARM_DECL";
|
|---|
| 56 | case RESULT_DECL: return "RESULT_DECL";
|
|---|
| 57 | case CONST_DECL: return "CONST_DECL";
|
|---|
| 58 | case POINTER_TYPE: return "POINTER_TYPE";
|
|---|
| 59 | case VOID_TYPE: return "VOID_TYPE";
|
|---|
| 60 | case INTEGER_TYPE: return "INTEGER_TYPE";
|
|---|
| 61 | case CHAR_TYPE: return "CHAR_TYPE";
|
|---|
| 62 | case SET_TYPE: return "SET_TYPE";
|
|---|
| 63 | case ARRAY_TYPE: return "ARRAY_TYPE";
|
|---|
| 64 | case RECORD_TYPE: return "RECORD_TYPE";
|
|---|
| 65 | case QUAL_UNION_TYPE: return "QUAL_UNION_TYPE";
|
|---|
| 66 | case UNION_TYPE: return "UNION_TYPE";
|
|---|
| 67 | default:
|
|---|
| 68 | break;
|
|---|
| 69 | }
|
|---|
| 70 | }
|
|---|
| 71 | return "";
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 | const char *birddump_callingconv(tree node);
|
|---|
| 75 | const char *birddump_callingconv(tree node)
|
|---|
| 76 | {
|
|---|
| 77 | static const char *apsz[] = {"system", "optlink", "stdcall"};
|
|---|
| 78 | static const char *psznone = "none";
|
|---|
| 79 | static const char *pszdefault = "default";
|
|---|
| 80 | tree attr;
|
|---|
| 81 | unsigned i;
|
|---|
| 82 |
|
|---|
| 83 | if (!node)
|
|---|
| 84 | return psznone;
|
|---|
| 85 |
|
|---|
| 86 | attr = (DECL_P (node) ? DECL_ATTRIBUTES (node) : TYPE_ATTRIBUTES (node));
|
|---|
| 87 | if (!attr)
|
|---|
| 88 | return pszdefault;
|
|---|
| 89 |
|
|---|
| 90 | for (i = 0; i < sizeof(apsz) / sizeof(apsz[0]); i++)
|
|---|
| 91 | if (node && attr && lookup_attribute (apsz[i], attr))
|
|---|
| 92 | return apsz[i];
|
|---|
| 93 |
|
|---|
| 94 | return pszdefault;
|
|---|
| 95 | }
|
|---|
|
|---|