//===----- CGCall.h - Encapsulate calling convention details ----*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // These classes wrap the information about a call or function // definition used to handle ABI compliancy. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_LIB_CODEGEN_CGCALL_H #define LLVM_CLANG_LIB_CODEGEN_CGCALL_H #include "CGPointerAuthInfo.h" #include "CGValue.h" #include "EHScopeStack.h" #include "clang/AST/ASTFwd.h" #include "clang/AST/CanonicalType.h" #include "clang/AST/GlobalDecl.h" #include "clang/AST/Type.h" #include "llvm/ADT/STLForwardCompat.h" #include "llvm/IR/Value.h" namespace llvm { class Type; class Value; } // namespace llvm namespace clang { class Decl; class FunctionDecl; class TargetOptions; class VarDecl; namespace CodeGen { /// Abstract information about a function or function prototype. class CGCalleeInfo { … }; /// All available information about a concrete callee. class CGCallee { … }; struct CallArg { … }; /// CallArgList - Type for representing both the value and type of /// arguments in a call. class CallArgList : public SmallVector<CallArg, 8> { … }; /// FunctionArgList - Type for representing both the decl and type /// of parameters to a function. The decl must be either a /// ParmVarDecl or ImplicitParamDecl. class FunctionArgList : public SmallVector<const VarDecl *, 16> { … }; /// ReturnValueSlot - Contains the address where the return value of a /// function can be stored, and whether the address is volatile or not. class ReturnValueSlot { … }; /// Adds attributes to \p F according to our \p CodeGenOpts and \p LangOpts, as /// though we had emitted it ourselves. We remove any attributes on F that /// conflict with the attributes we add here. /// /// This is useful for adding attrs to bitcode modules that you want to link /// with but don't control, such as CUDA's libdevice. When linking with such /// a bitcode library, you might want to set e.g. its functions' /// "unsafe-fp-math" attribute to match the attr of the functions you're /// codegen'ing. Otherwise, LLVM will interpret the bitcode module's lack of /// unsafe-fp-math attrs as tantamount to unsafe-fp-math=false, and then LLVM /// will propagate unsafe-fp-math=false up to every transitive caller of a /// function in the bitcode library! /// /// With the exception of fast-math attrs, this will only make the attributes /// on the function more conservative. But it's unsafe to call this on a /// function which relies on particular fast-math attributes for correctness. /// It's up to you to ensure that this is safe. void mergeDefaultFunctionDefinitionAttributes(llvm::Function &F, const CodeGenOptions &CodeGenOpts, const LangOptions &LangOpts, const TargetOptions &TargetOpts, bool WillInternalize); enum class FnInfoOpts { … }; inline FnInfoOpts operator|(FnInfoOpts A, FnInfoOpts B) { … } inline FnInfoOpts operator&(FnInfoOpts A, FnInfoOpts B) { … } inline FnInfoOpts &operator|=(FnInfoOpts &A, FnInfoOpts B) { … } inline FnInfoOpts &operator&=(FnInfoOpts &A, FnInfoOpts B) { … } } // end namespace CodeGen } // end namespace clang #endif