clang
24.0.0git
include
clang
CodeGenUtils
CallUtils.h
Go to the documentation of this file.
1
//===--- CallUtils.h - Shared call emission queries -------------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This file holds the AST and language option queries that both classic
10
// CodeGen and CIR CodeGen need while building a call and its argument and
11
// return value attributes.
12
//
13
//===----------------------------------------------------------------------===//
14
15
#ifndef LLVM_CLANG_CODEGENUTILS_CALLUTILS_H
16
#define LLVM_CLANG_CODEGENUTILS_CALLUTILS_H
17
18
#include "
clang/AST/ASTContext.h
"
19
#include "llvm/ADT/FloatingPointMode.h"
20
21
namespace
clang
{
22
class
CallExpr
;
23
class
TargetCXXABI
;
24
}
// namespace clang
25
26
namespace
clang::CodeGenUtils
{
27
28
/// The order in which the arguments of a call must be evaluated.
29
enum class
EvaluationOrder
{
30
///! No language constraints on evaluation order.
31
Default
,
32
///! Language semantics require left-to-right evaluation.
33
ForceLeftToRight
,
34
///! Language semantics require right-to-left evaluation.
35
ForceRightToLeft
36
};
37
38
/// Returns the argument evaluation order the language requires for the given
39
/// call. C++17 requires that arguments to a call using assignment syntax be
40
/// evaluated right-to-left, and that arguments to certain other operators be
41
/// evaluated left-to-right.
42
EvaluationOrder
getCallArgEvaluationOrder
(
const
CallExpr
*E);
43
44
/// Returns true if call arguments should be emitted left-to-right, given the
45
/// order the language requires and the C++ ABI's default. The MS C++ ABI
46
/// evaluates right-to-left because arguments are destroyed left-to-right in
47
/// the callee; a language-required order overrides that.
48
bool
shouldEvaluateArgsLeftToRight
(
EvaluationOrder
Order,
49
const
TargetCXXABI
&ABI);
50
51
/// Returns the canonical formal type of the given C++ method.
52
CanQual<FunctionProtoType>
getFormalType
(
const
CXXMethodDecl
*MD);
53
54
/// Returns the set of floating-point value kinds that the language options
55
/// promise never reach a function's arguments or return value.
56
llvm::FPClassTest
getNoFPClassTestMask
(
const
LangOptions
&LangOpts);
57
58
}
// namespace clang::CodeGenUtils
59
60
#endif
// LLVM_CLANG_CODEGENUTILS_CALLUTILS_H
ASTContext.h
Defines the clang::ASTContext interface.
clang::CXXMethodDecl
Represents a static or instance method of a struct/union/class.
Definition
DeclCXX.h:2150
clang::CallExpr
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition
Expr.h:3012
clang::CanQual
Represents a canonical, potentially-qualified type.
Definition
CanonicalType.h:66
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition
LangOptions.h:480
clang::TargetCXXABI
The basic abstraction for the target C++ ABI.
Definition
TargetCXXABI.h:28
clang::CodeGenUtils
Definition
CallUtils.h:26
clang::CodeGenUtils::getFormalType
CanQual< FunctionProtoType > getFormalType(const CXXMethodDecl *MD)
Returns the canonical formal type of the given C++ method.
Definition
CallUtils.cpp:15
clang::CodeGenUtils::getCallArgEvaluationOrder
EvaluationOrder getCallArgEvaluationOrder(const CallExpr *E)
Returns the argument evaluation order the language requires for the given call.
Definition
CallUtils.cpp:30
clang::CodeGenUtils::getNoFPClassTestMask
llvm::FPClassTest getNoFPClassTestMask(const LangOptions &LangOpts)
Returns the set of floating-point value kinds that the language options promise never reach a functio...
Definition
CallUtils.cpp:21
clang::CodeGenUtils::EvaluationOrder
EvaluationOrder
The order in which the arguments of a call must be evaluated.
Definition
CallUtils.h:29
clang::CodeGenUtils::EvaluationOrder::ForceLeftToRight
@ ForceLeftToRight
! Language semantics require left-to-right evaluation.
Definition
CallUtils.h:33
clang::CodeGenUtils::EvaluationOrder::Default
@ Default
! No language constraints on evaluation order.
Definition
CallUtils.h:31
clang::CodeGenUtils::EvaluationOrder::ForceRightToLeft
@ ForceRightToLeft
! Language semantics require right-to-left evaluation.
Definition
CallUtils.h:35
clang::CodeGenUtils::shouldEvaluateArgsLeftToRight
bool shouldEvaluateArgsLeftToRight(EvaluationOrder Order, const TargetCXXABI &ABI)
Returns true if call arguments should be emitted left-to-right, given the order the language requires...
Definition
CallUtils.cpp:55
clang
Top level wrappers for InstallAPI frontend operations.
Definition
CalledOnceCheck.h:17
Generated on
for clang by
1.14.0