1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  *   Licensed to the Apache Software Foundation (ASF) under one or more
12  *   contributor license agreements. See the NOTICE file distributed
13  *   with this work for additional information regarding copyright
14  *   ownership. The ASF licenses this file to you under the Apache
15  *   License, Version 2.0 (the "License"); you may not use this file
16  *   except in compliance with the License. You may obtain a copy of
17  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #pragma once
21 
22 // This is an implementation of the x86-64 ABI as described in 'System V
23 // Application Binary Interface, AMD64 Architecture Processor Supplement'
24 // (http://www.x86-64.org/documentation/abi-0.95.pdf)
25 
26 #include <typelib/typedescription.hxx>
27 
28 namespace x86_64
29 {
30 
31 /* 6 general purpose registers are used for parameter passing */
32 const sal_uInt32 MAX_GPR_REGS = 6;
33 
34 /* 8 SSE registers are used for parameter passing */
35 const sal_uInt32 MAX_SSE_REGS = 8;
36 
37 /* Count number of required registers.
38 
39  Examine the argument and return set number of register required in each
40  class.
41 
42  Return false iff parameter should be passed in memory.
43 */
44 bool examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool bInReturn, int &nUsedGPR, int &nUsedSSE ) noexcept;
45 
46 /** Does function that returns this type use a hidden parameter, or registers?
47 
48  The value can be returned either in a hidden 1st parameter (which is a
49  pointer to a structure allocated by the caller), or in registers (rax, rdx
50  for the integers, xmm0, xmm1 for the floating point numbers).
51 */
52 bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef ) noexcept;
53 
54 void fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_uInt64* pGPR, const double* pSSE, void *pStruct ) noexcept;
55 
56 } // namespace x86_64
57 
58 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
59