clang 24.0.0git
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
19#include "llvm/ADT/FloatingPointMode.h"
20
21namespace clang {
22class CallExpr;
23class TargetCXXABI;
24} // namespace clang
25
27
28/// The order in which the arguments of a call must be evaluated.
29enum class EvaluationOrder {
30 ///! No language constraints on evaluation order.
32 ///! Language semantics require left-to-right evaluation.
34 ///! Language semantics require right-to-left evaluation.
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.
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.
49 const TargetCXXABI &ABI);
50
51/// Returns the canonical formal type of the given C++ method.
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.
56llvm::FPClassTest getNoFPClassTestMask(const LangOptions &LangOpts);
57
58} // namespace clang::CodeGenUtils
59
60#endif // LLVM_CLANG_CODEGENUTILS_CALLUTILS_H
Defines the clang::ASTContext interface.
Represents a static or instance method of a struct/union/class.
Definition DeclCXX.h:2150
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition Expr.h:3012
Represents a canonical, potentially-qualified type.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
The basic abstraction for the target C++ ABI.
CanQual< FunctionProtoType > getFormalType(const CXXMethodDecl *MD)
Returns the canonical formal type of the given C++ method.
Definition CallUtils.cpp:15
EvaluationOrder getCallArgEvaluationOrder(const CallExpr *E)
Returns the argument evaluation order the language requires for the given call.
Definition CallUtils.cpp:30
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
EvaluationOrder
The order in which the arguments of a call must be evaluated.
Definition CallUtils.h:29
@ ForceLeftToRight
! Language semantics require left-to-right evaluation.
Definition CallUtils.h:33
@ Default
! No language constraints on evaluation order.
Definition CallUtils.h:31
@ ForceRightToLeft
! Language semantics require right-to-left evaluation.
Definition CallUtils.h:35
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
Top level wrappers for InstallAPI frontend operations.