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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [config/] [m32c/] [m32c.abi] - Blame information for rev 709

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 709 jeremybenn
   Target Definitions for R8C/M16C/M32C
2
   Copyright (C) 2005, 2007
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 3, 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 COPYING3.  If not see
20
   .
21
 
22
 
23
These are just some random notes I used during development of this
24
port.  Please don't consider these to be "official" specifications,
25
just additional information to help make the code easier to
26
understand.
27
 
28
 
29
Frame
30
=====
31
 
32
        +--------------------
33
        | incoming args
34
        +--------------------
35
        | return Address
36
osp ->  +--------------------
37
        | saved fp
38
fp ->   +--------------------
39
        | local data
40
        +--------------------
41
        | saved regs
42
        +--------------------
43
        | outgoing args (opt)
44
sp ->   +--------------------
45
 
46
Argument Passing
47
================
48
 
49
r8c, m16c
50
---------
51
 
52
First arg may be passed in r1l or r1 if it (1) fits (QImode or
53
HImode), (2) is named, and (3) is an integer or pointer type (no
54
structs, floats, etc).  Otherwise, it's passed on the stack.
55
 
56
Second arg may be passed in r2, same restrictions (but not QImode),
57
even if the first arg is passed on the stack.
58
 
59
Third and further args are passed on the stack.  No padding is used,
60
stack "alignment" is 8 bits.
61
 
62
m32cm, m32c
63
-----------
64
First arg may be passed in r0l or r0, same restrictions as above.
65
 
66
Second and further args are passed on the stack.  Padding is used
67
after QImode parameters (i.e. lower-addressed byte is the value,
68
higher-addressed byte is the padding), stack "alignment" is 16 bits.
69
 
70
 
71
Return Value
72
============
73
 
74
r8c, m16c
75
---------
76
 
77
QImode in r0l
78
HImode in r0
79
near pointer in r0
80
(desired)
81
SImode in r2r0
82
far pointer in r2r0
83
(actual)
84
Anything bigger than 16 bits is returned in memory, at mem0 (mem0
85
through mem15 are provided by libgcc.a)
86
 
87
Aggregate values (regardless of size) are returned by pushing a
88
pointer to a temporary area on the stack after the args are pushed.
89
The function fills in this area with the value.  Note that this
90
pointer on the stack does not affect how register arguments, if any,
91
are configured.
92
 
93
m32cm, m32c
94
-----------
95
Same.
96
 
97
 
98
Registers Preserved Across Calls
99
================================
100
 
101
r8c, m16c
102
---------
103
sb, fb, sp (i.e. nearly all registers are call clobbered)
104
 
105
m32cm, m32c
106
-----------
107
r1, r2, r3, a0, a1, sb, fb, sp
108
(except when used for return values)
109
 
110
 
111
Interrupt Handlers
112
==================
113
 
114
The stack frame is slightly different for interrupt handlers, because
115
(1) we don't have a usable parent frame, and (2) we have to use
116
special instructions to return and thus must save/restore everything
117
differently.
118
 
119
        +--------------------
120
        | program state
121
osp ->  +--------------------
122
        | return address
123
        +--------------------
124
        | saved r0..fp (pushm)
125
fp ->   +--------------------
126
        | local data
127
        +--------------------
128
        | saved regs mem0..mem15
129
        +--------------------
130
        | outgoing args (opt)
131
sp ->   +--------------------
132
 

powered by: WebSVN 2.1.0

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