12755751fSHerbert Dürr /**************************************************************
22755751fSHerbert Dürr  *
32755751fSHerbert Dürr  * Licensed to the Apache Software Foundation (ASF) under one
42755751fSHerbert Dürr  * or more contributor license agreements.  See the NOTICE file
52755751fSHerbert Dürr  * distributed with this work for additional information
62755751fSHerbert Dürr  * regarding copyright ownership.  The ASF licenses this file
72755751fSHerbert Dürr  * to you under the Apache License, Version 2.0 (the
82755751fSHerbert Dürr  * "License"); you may not use this file except in compliance
92755751fSHerbert Dürr  * with the License.  You may obtain a copy of the License at
102755751fSHerbert Dürr  *
112755751fSHerbert Dürr  *   http://www.apache.org/licenses/LICENSE-2.0
122755751fSHerbert Dürr  *
132755751fSHerbert Dürr  * Unless required by applicable law or agreed to in writing,
142755751fSHerbert Dürr  * software distributed under the License is distributed on an
152755751fSHerbert Dürr  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
162755751fSHerbert Dürr  * KIND, either express or implied.  See the License for the
172755751fSHerbert Dürr  * specific language governing permissions and limitations
182755751fSHerbert Dürr  * under the License.
192755751fSHerbert Dürr  *
202755751fSHerbert Dürr  *************************************************************/
212755751fSHerbert Dürr 
222755751fSHerbert Dürr 
232755751fSHerbert Dürr 
242755751fSHerbert Dürr #ifndef _BRIDGES_CPP_UNO_X86_64_ABI_HXX_
252755751fSHerbert Dürr #define _BRIDGES_CPP_UNO_X86_64_ABI_HXX_
262755751fSHerbert Dürr 
272755751fSHerbert Dürr // This is an implementation of the x86-64 ABI as described in 'System V
282755751fSHerbert Dürr // Application Binary Interface, AMD64 Architecture Processor Supplement'
292755751fSHerbert Dürr // (http://www.x86-64.org/documentation/abi-0.95.pdf)
302755751fSHerbert Dürr 
312755751fSHerbert Dürr #include <typelib/typedescription.hxx>
322755751fSHerbert Dürr 
332755751fSHerbert Dürr namespace x86_64
342755751fSHerbert Dürr {
352755751fSHerbert Dürr 
362755751fSHerbert Dürr /* 6 general purpose registers are used for parameter passing */
372755751fSHerbert Dürr const sal_uInt32 MAX_GPR_REGS = 6;
382755751fSHerbert Dürr 
392755751fSHerbert Dürr /* 8 SSE registers are used for parameter passing */
402755751fSHerbert Dürr const sal_uInt32 MAX_SSE_REGS = 8;
412755751fSHerbert Dürr 
422755751fSHerbert Dürr /* Count number of required registers.
432755751fSHerbert Dürr 
442755751fSHerbert Dürr  Examine the argument and return set number of register required in each
452755751fSHerbert Dürr  class.
462755751fSHerbert Dürr 
472755751fSHerbert Dürr  Return false iff parameter should be passed in memory.
482755751fSHerbert Dürr */
492755751fSHerbert Dürr bool examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool bInReturn, int &nUsedGPR, int &nUsedSSE );
502755751fSHerbert Dürr 
512755751fSHerbert Dürr /** Does function that returns this type use a hidden parameter, or registers?
522755751fSHerbert Dürr 
532755751fSHerbert Dürr  The value can be returned either in a hidden 1st parameter (which is a
542755751fSHerbert Dürr  pointer to a structure allocated by the caller), or in registers (rax, rdx
552755751fSHerbert Dürr  for the integers, xmm0, xmm1 for the floating point numbers).
562755751fSHerbert Dürr */
572755751fSHerbert Dürr bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef );
582755751fSHerbert Dürr 
592755751fSHerbert Dürr void fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_uInt64* pGPR, const double* pSSE, void *pStruct );
602755751fSHerbert Dürr 
612755751fSHerbert Dürr } // namespace x86_64
622755751fSHerbert Dürr 
632755751fSHerbert Dürr #endif // _BRIDGES_CPP_UNO_X86_64_ABI_HXX_
64