summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGABI.cpp
blob: 374ca8a55940c71d39a5a5b3bc83b19c2d9e2200 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//===----- CGABI.h - ABI types-----------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "CGABI.h"

namespace flang {
namespace CodeGen {

ABIArgInfo FortranABI::GetArgABI(QualType ArgType) {
  if(ArgType->isCharacterType())
    return ABIArgInfo(ABIArgInfo::ExpandCharacterPutLengthToAdditionalArgsAsInt);
  else if(ArgType->isFunctionType())
    return ABIArgInfo(ABIArgInfo::Value);

  return ABIArgInfo(ABIArgInfo::Reference);
}

ABIRetInfo FortranABI::GetRetABI(QualType RetType) {
  if(RetType.isNull() || RetType->isVoidType())
    return ABIRetInfo(ABIRetInfo::Nothing);
  if(RetType->isCharacterType())
    return ABIRetInfo(ABIRetInfo::CharacterValueAsArg);

  return ABIRetInfo(ABIRetInfo::Value);
}

ABIArgInfo LibflangABI::GetArgABI(QualType ArgType) {
  if(ArgType->isComplexType() ||
     ArgType->isCharacterType())
    return ABIArgInfo(ABIArgInfo::Expand);
  return ABIArgInfo(ABIArgInfo::Value);
}

ABIRetInfo LibflangABI::GetRetABI(QualType RetType) {
  return FortranABI::GetRetABI(RetType);
}

ABIArgInfo LibflangTransferABI::GetArgABI(QualType ArgType) {
  if(ArgType->isCharacterType())
    return LibflangABI::GetArgABI(ArgType);

  return ABIArgInfo(ABIArgInfo::ReferenceAsVoidExtraSize);
}

}
} // end namespace flang