OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [config/] [m32c/] [m32c.abi] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
   Target Definitions for R8C/M16C/M32C
2
   Copyright (C) 2005
3
   Free Software Foundation, Inc.
4
   Contributed by Red Hat.
5
 
6
   This file is part of GCC.
7
 
8
   GCC is free software; you can redistribute it and/or modify it
9
   under the terms of the GNU General Public License as published
10
   by the Free Software Foundation; either version 2, or (at your
11
   option) any later version.
12
 
13
   GCC is distributed in the hope that it will be useful, but WITHOUT
14
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15
   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16
   License for more details.
17
 
18
   You should have received a copy of the GNU General Public License
19
   along with GCC; see the file COPYING.  If not, write to the Free
20
   Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
21
   02110-1301, USA.
22
 
23
 
24
These are just some random notes I used during development of this
25
port.  Please don't consider these to be "official" specifications,
26
just additional information to help make the code easier to
27
understand.
28
 
29
 
30
Frame
31
=====
32
 
33
        +--------------------
34
        | incoming args
35
        +--------------------
36
        | return Address
37
osp ->  +--------------------
38
        | saved fp
39
fp ->   +--------------------
40
        | local data
41
        +--------------------
42
        | saved regs
43
        +--------------------
44
        | outgoing args (opt)
45
sp ->   +--------------------
46
 
47
Argument Passing
48
================
49
 
50
r8c, m16c
51
---------
52
 
53
First arg may be passed in r1l or r1 if it (1) fits (QImode or
54
HImode), (2) is named, and (3) is an integer or pointer type (no
55
structs, floats, etc).  Otherwise, it's passed on the stack.
56
 
57
Second arg may be passed in r2, same restrictions (but not QImode),
58
even if the first arg is passed on the stack.
59
 
60
Third and further args are passed on the stack.  No padding is used,
61
stack "alignment" is 8 bits.
62
 
63
m32cm, m32c
64
-----------
65
First arg may be passed in r0l or r0, same restrictions as above.
66
 
67
Second and further args are passed on the stack.  Padding is used
68
after QImode parameters (i.e. lower-addressed byte is the value,
69
higher-addressed byte is the padding), stack "alignment" is 16 bits.
70
 
71
 
72
Return Value
73
============
74
 
75
r8c, m16c
76
---------
77
 
78
QImode in r0l
79
HImode in r0
80
near pointer in r0
81
(desired)
82
SImode in r2r0
83
far pointer in r2r0
84
(actual)
85
Anything bigger than 16 bits is returned in memory, at mem0 (mem0
86
through mem15 are provided by libgcc.a)
87
 
88
Aggregate values (regardless of size) are returned by pushing a
89
pointer to a temporary area on the stack after the args are pushed.
90
The function fills in this area with the value.  Note that this
91
pointer on the stack does not affect how register arguments, if any,
92
are configured.
93
 
94
m32cm, m32c
95
-----------
96
Same.
97
 
98
 
99
Registers Preserved Across Calls
100
================================
101
 
102
r8c, m16c
103
---------
104
sb, fb, sp (i.e. nearly all registers are call clobbered)
105
 
106
m32cm, m32c
107
-----------
108
r1, r2, r3, a0, a1, sb, fb, sp
109
(except when used for return values)
110
 
111
 
112
Interrupt Handlers
113
==================
114
 
115
The stack frame is slightly different for interrupt handlers, because
116
(1) we don't have a usable parent frame, and (2) we have to use
117
special instructions to return and thus must save/restore everything
118
differently.
119
 
120
        +--------------------
121
        | program state
122
osp ->  +--------------------
123
        | return address
124
        +--------------------
125
        | saved r0..fp (pushm)
126
fp ->   +--------------------
127
        | local data
128
        +--------------------
129
        | saved regs mem0..mem15
130
        +--------------------
131
        | outgoing args (opt)
132
sp ->   +--------------------
133
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.