xref: /trunk/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/abi.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1*b682cb18SJim Jagielski /**************************************************************
2*b682cb18SJim Jagielski  *
3*b682cb18SJim Jagielski  * Licensed to the Apache Software Foundation (ASF) under one
4*b682cb18SJim Jagielski  * or more contributor license agreements.  See the NOTICE file
5*b682cb18SJim Jagielski  * distributed with this work for additional information
6*b682cb18SJim Jagielski  * regarding copyright ownership.  The ASF licenses this file
7*b682cb18SJim Jagielski  * to you under the Apache License, Version 2.0 (the
8*b682cb18SJim Jagielski  * "License"); you may not use this file except in compliance
9*b682cb18SJim Jagielski  * with the License.  You may obtain a copy of the License at
10*b682cb18SJim Jagielski  *
11*b682cb18SJim Jagielski  *   http://www.apache.org/licenses/LICENSE-2.0
12*b682cb18SJim Jagielski  *
13*b682cb18SJim Jagielski  * Unless required by applicable law or agreed to in writing,
14*b682cb18SJim Jagielski  * software distributed under the License is distributed on an
15*b682cb18SJim Jagielski  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b682cb18SJim Jagielski  * KIND, either express or implied.  See the License for the
17*b682cb18SJim Jagielski  * specific language governing permissions and limitations
18*b682cb18SJim Jagielski  * under the License.
19*b682cb18SJim Jagielski  *
20*b682cb18SJim Jagielski  *************************************************************/
21*b682cb18SJim Jagielski 
22*b682cb18SJim Jagielski 
23*b682cb18SJim Jagielski 
24*b682cb18SJim Jagielski #ifndef _BRIDGES_CPP_UNO_X86_64_ABI_HXX_
25*b682cb18SJim Jagielski #define _BRIDGES_CPP_UNO_X86_64_ABI_HXX_
26*b682cb18SJim Jagielski 
27*b682cb18SJim Jagielski // This is an implementation of the x86-64 ABI as described in 'System V
28*b682cb18SJim Jagielski // Application Binary Interface, AMD64 Architecture Processor Supplement'
29*b682cb18SJim Jagielski // (http://www.x86-64.org/documentation/abi-0.95.pdf)
30*b682cb18SJim Jagielski 
31*b682cb18SJim Jagielski #include <typelib/typedescription.hxx>
32*b682cb18SJim Jagielski 
33*b682cb18SJim Jagielski namespace x86_64
34*b682cb18SJim Jagielski {
35*b682cb18SJim Jagielski 
36*b682cb18SJim Jagielski /* 6 general purpose registers are used for parameter passing */
37*b682cb18SJim Jagielski const sal_uInt32 MAX_GPR_REGS = 6;
38*b682cb18SJim Jagielski 
39*b682cb18SJim Jagielski /* 8 SSE registers are used for parameter passing */
40*b682cb18SJim Jagielski const sal_uInt32 MAX_SSE_REGS = 8;
41*b682cb18SJim Jagielski 
42*b682cb18SJim Jagielski /* Count number of required registers.
43*b682cb18SJim Jagielski 
44*b682cb18SJim Jagielski  Examine the argument and return set number of register required in each
45*b682cb18SJim Jagielski  class.
46*b682cb18SJim Jagielski 
47*b682cb18SJim Jagielski  Return false iff parameter should be passed in memory.
48*b682cb18SJim Jagielski */
49*b682cb18SJim Jagielski bool examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool bInReturn, int &nUsedGPR, int &nUsedSSE );
50*b682cb18SJim Jagielski 
51*b682cb18SJim Jagielski /** Does function that returns this type use a hidden parameter, or registers?
52*b682cb18SJim Jagielski 
53*b682cb18SJim Jagielski  The value can be returned either in a hidden 1st parameter (which is a
54*b682cb18SJim Jagielski  pointer to a structure allocated by the caller), or in registers (rax, rdx
55*b682cb18SJim Jagielski  for the integers, xmm0, xmm1 for the floating point numbers).
56*b682cb18SJim Jagielski */
57*b682cb18SJim Jagielski bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef );
58*b682cb18SJim Jagielski 
59*b682cb18SJim Jagielski void fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_uInt64* pGPR, const double* pSSE, void *pStruct );
60*b682cb18SJim Jagielski 
61*b682cb18SJim Jagielski } // namespace x86_64
62*b682cb18SJim Jagielski 
63*b682cb18SJim Jagielski #endif // _BRIDGES_CPP_UNO_X86_64_ABI_HXX_
64