xref: /freebsd/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.h (revision e8d8bef961a50d4dc22501cde4fb9fb0be1b2532)
10b57cec5SDimitry Andric //===---- TargetInfo.h - Encapsulate target details -------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric // These classes wrap the information about a call or function
100b57cec5SDimitry Andric // definition used to handle ABI compliancy.
110b57cec5SDimitry Andric //
120b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric #ifndef LLVM_CLANG_LIB_CODEGEN_TARGETINFO_H
150b57cec5SDimitry Andric #define LLVM_CLANG_LIB_CODEGEN_TARGETINFO_H
160b57cec5SDimitry Andric 
170b57cec5SDimitry Andric #include "CodeGenModule.h"
180b57cec5SDimitry Andric #include "CGValue.h"
190b57cec5SDimitry Andric #include "clang/AST/Type.h"
200b57cec5SDimitry Andric #include "clang/Basic/LLVM.h"
210b57cec5SDimitry Andric #include "clang/Basic/SyncScope.h"
220b57cec5SDimitry Andric #include "llvm/ADT/SmallString.h"
230b57cec5SDimitry Andric #include "llvm/ADT/StringRef.h"
240b57cec5SDimitry Andric 
250b57cec5SDimitry Andric namespace llvm {
260b57cec5SDimitry Andric class Constant;
270b57cec5SDimitry Andric class GlobalValue;
280b57cec5SDimitry Andric class Type;
290b57cec5SDimitry Andric class Value;
300b57cec5SDimitry Andric }
310b57cec5SDimitry Andric 
320b57cec5SDimitry Andric namespace clang {
330b57cec5SDimitry Andric class Decl;
340b57cec5SDimitry Andric 
350b57cec5SDimitry Andric namespace CodeGen {
360b57cec5SDimitry Andric class ABIInfo;
370b57cec5SDimitry Andric class CallArgList;
380b57cec5SDimitry Andric class CodeGenFunction;
390b57cec5SDimitry Andric class CGBlockInfo;
400b57cec5SDimitry Andric class CGFunctionInfo;
410b57cec5SDimitry Andric 
420b57cec5SDimitry Andric /// TargetCodeGenInfo - This class organizes various target-specific
430b57cec5SDimitry Andric /// codegeneration issues, like target-specific attributes, builtins and so
440b57cec5SDimitry Andric /// on.
450b57cec5SDimitry Andric class TargetCodeGenInfo {
465ffd83dbSDimitry Andric   std::unique_ptr<ABIInfo> Info = nullptr;
470b57cec5SDimitry Andric 
480b57cec5SDimitry Andric public:
495ffd83dbSDimitry Andric   TargetCodeGenInfo(std::unique_ptr<ABIInfo> Info) : Info(std::move(Info)) {}
500b57cec5SDimitry Andric   virtual ~TargetCodeGenInfo();
510b57cec5SDimitry Andric 
520b57cec5SDimitry Andric   /// getABIInfo() - Returns ABI info helper for the target.
530b57cec5SDimitry Andric   const ABIInfo &getABIInfo() const { return *Info; }
540b57cec5SDimitry Andric 
550b57cec5SDimitry Andric   /// setTargetAttributes - Provides a convenient hook to handle extra
560b57cec5SDimitry Andric   /// target-specific attributes for the given global.
570b57cec5SDimitry Andric   virtual void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV,
580b57cec5SDimitry Andric                                    CodeGen::CodeGenModule &M) const {}
590b57cec5SDimitry Andric 
605ffd83dbSDimitry Andric   /// emitTargetMetadata - Provides a convenient hook to handle extra
615ffd83dbSDimitry Andric   /// target-specific metadata for the given globals.
625ffd83dbSDimitry Andric   virtual void emitTargetMetadata(
635ffd83dbSDimitry Andric       CodeGen::CodeGenModule &CGM,
645ffd83dbSDimitry Andric       const llvm::MapVector<GlobalDecl, StringRef> &MangledDeclNames) const {}
655ffd83dbSDimitry Andric 
665ffd83dbSDimitry Andric   /// Any further codegen related checks that need to be done on a function call
675ffd83dbSDimitry Andric   /// in a target specific manner.
685ffd83dbSDimitry Andric   virtual void checkFunctionCallABI(CodeGenModule &CGM, SourceLocation CallLoc,
695ffd83dbSDimitry Andric                                     const FunctionDecl *Caller,
705ffd83dbSDimitry Andric                                     const FunctionDecl *Callee,
715ffd83dbSDimitry Andric                                     const CallArgList &Args) const {}
720b57cec5SDimitry Andric 
730b57cec5SDimitry Andric   /// Determines the size of struct _Unwind_Exception on this platform,
740b57cec5SDimitry Andric   /// in 8-bit units.  The Itanium ABI defines this as:
750b57cec5SDimitry Andric   ///   struct _Unwind_Exception {
760b57cec5SDimitry Andric   ///     uint64 exception_class;
770b57cec5SDimitry Andric   ///     _Unwind_Exception_Cleanup_Fn exception_cleanup;
780b57cec5SDimitry Andric   ///     uint64 private_1;
790b57cec5SDimitry Andric   ///     uint64 private_2;
800b57cec5SDimitry Andric   ///   };
810b57cec5SDimitry Andric   virtual unsigned getSizeOfUnwindException() const;
820b57cec5SDimitry Andric 
830b57cec5SDimitry Andric   /// Controls whether __builtin_extend_pointer should sign-extend
840b57cec5SDimitry Andric   /// pointers to uint64_t or zero-extend them (the default).  Has
850b57cec5SDimitry Andric   /// no effect for targets:
860b57cec5SDimitry Andric   ///   - that have 64-bit pointers, or
870b57cec5SDimitry Andric   ///   - that cannot address through registers larger than pointers, or
880b57cec5SDimitry Andric   ///   - that implicitly ignore/truncate the top bits when addressing
890b57cec5SDimitry Andric   ///     through such registers.
900b57cec5SDimitry Andric   virtual bool extendPointerWithSExt() const { return false; }
910b57cec5SDimitry Andric 
920b57cec5SDimitry Andric   /// Determines the DWARF register number for the stack pointer, for
930b57cec5SDimitry Andric   /// exception-handling purposes.  Implements __builtin_dwarf_sp_column.
940b57cec5SDimitry Andric   ///
950b57cec5SDimitry Andric   /// Returns -1 if the operation is unsupported by this target.
960b57cec5SDimitry Andric   virtual int getDwarfEHStackPointer(CodeGen::CodeGenModule &M) const {
970b57cec5SDimitry Andric     return -1;
980b57cec5SDimitry Andric   }
990b57cec5SDimitry Andric 
1000b57cec5SDimitry Andric   /// Initializes the given DWARF EH register-size table, a char*.
1010b57cec5SDimitry Andric   /// Implements __builtin_init_dwarf_reg_size_table.
1020b57cec5SDimitry Andric   ///
1030b57cec5SDimitry Andric   /// Returns true if the operation is unsupported by this target.
1040b57cec5SDimitry Andric   virtual bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
1050b57cec5SDimitry Andric                                        llvm::Value *Address) const {
1060b57cec5SDimitry Andric     return true;
1070b57cec5SDimitry Andric   }
1080b57cec5SDimitry Andric 
1090b57cec5SDimitry Andric   /// Performs the code-generation required to convert a return
1100b57cec5SDimitry Andric   /// address as stored by the system into the actual address of the
1110b57cec5SDimitry Andric   /// next instruction that will be executed.
1120b57cec5SDimitry Andric   ///
1130b57cec5SDimitry Andric   /// Used by __builtin_extract_return_addr().
1140b57cec5SDimitry Andric   virtual llvm::Value *decodeReturnAddress(CodeGen::CodeGenFunction &CGF,
1150b57cec5SDimitry Andric                                            llvm::Value *Address) const {
1160b57cec5SDimitry Andric     return Address;
1170b57cec5SDimitry Andric   }
1180b57cec5SDimitry Andric 
1190b57cec5SDimitry Andric   /// Performs the code-generation required to convert the address
1200b57cec5SDimitry Andric   /// of an instruction into a return address suitable for storage
1210b57cec5SDimitry Andric   /// by the system in a return slot.
1220b57cec5SDimitry Andric   ///
1230b57cec5SDimitry Andric   /// Used by __builtin_frob_return_addr().
1240b57cec5SDimitry Andric   virtual llvm::Value *encodeReturnAddress(CodeGen::CodeGenFunction &CGF,
1250b57cec5SDimitry Andric                                            llvm::Value *Address) const {
1260b57cec5SDimitry Andric     return Address;
1270b57cec5SDimitry Andric   }
1280b57cec5SDimitry Andric 
1290b57cec5SDimitry Andric   /// Corrects the low-level LLVM type for a given constraint and "usual"
1300b57cec5SDimitry Andric   /// type.
1310b57cec5SDimitry Andric   ///
1320b57cec5SDimitry Andric   /// \returns A pointer to a new LLVM type, possibly the same as the original
1330b57cec5SDimitry Andric   /// on success; 0 on failure.
1340b57cec5SDimitry Andric   virtual llvm::Type *adjustInlineAsmType(CodeGen::CodeGenFunction &CGF,
1350b57cec5SDimitry Andric                                           StringRef Constraint,
1360b57cec5SDimitry Andric                                           llvm::Type *Ty) const {
1370b57cec5SDimitry Andric     return Ty;
1380b57cec5SDimitry Andric   }
1390b57cec5SDimitry Andric 
1400b57cec5SDimitry Andric   /// Adds constraints and types for result registers.
1410b57cec5SDimitry Andric   virtual void addReturnRegisterOutputs(
1420b57cec5SDimitry Andric       CodeGen::CodeGenFunction &CGF, CodeGen::LValue ReturnValue,
1430b57cec5SDimitry Andric       std::string &Constraints, std::vector<llvm::Type *> &ResultRegTypes,
1440b57cec5SDimitry Andric       std::vector<llvm::Type *> &ResultTruncRegTypes,
1450b57cec5SDimitry Andric       std::vector<CodeGen::LValue> &ResultRegDests, std::string &AsmString,
1460b57cec5SDimitry Andric       unsigned NumOutputs) const {}
1470b57cec5SDimitry Andric 
1480b57cec5SDimitry Andric   /// doesReturnSlotInterfereWithArgs - Return true if the target uses an
1490b57cec5SDimitry Andric   /// argument slot for an 'sret' type.
1500b57cec5SDimitry Andric   virtual bool doesReturnSlotInterfereWithArgs() const { return true; }
1510b57cec5SDimitry Andric 
1520b57cec5SDimitry Andric   /// Retrieve the address of a function to call immediately before
1530b57cec5SDimitry Andric   /// calling objc_retainAutoreleasedReturnValue.  The
1540b57cec5SDimitry Andric   /// implementation of objc_autoreleaseReturnValue sniffs the
1550b57cec5SDimitry Andric   /// instruction stream following its return address to decide
1560b57cec5SDimitry Andric   /// whether it's a call to objc_retainAutoreleasedReturnValue.
1570b57cec5SDimitry Andric   /// This can be prohibitively expensive, depending on the
1580b57cec5SDimitry Andric   /// relocation model, and so on some targets it instead sniffs for
1590b57cec5SDimitry Andric   /// a particular instruction sequence.  This functions returns
1600b57cec5SDimitry Andric   /// that instruction sequence in inline assembly, which will be
1610b57cec5SDimitry Andric   /// empty if none is required.
1620b57cec5SDimitry Andric   virtual StringRef getARCRetainAutoreleasedReturnValueMarker() const {
1630b57cec5SDimitry Andric     return "";
1640b57cec5SDimitry Andric   }
1650b57cec5SDimitry Andric 
166*e8d8bef9SDimitry Andric   /// Determine whether a call to objc_retainAutoreleasedReturnValue or
167*e8d8bef9SDimitry Andric   /// objc_unsafeClaimAutoreleasedReturnValue should be marked as 'notail'.
168*e8d8bef9SDimitry Andric   virtual bool markARCOptimizedReturnCallsAsNoTail() const { return false; }
1690b57cec5SDimitry Andric 
1700b57cec5SDimitry Andric   /// Return a constant used by UBSan as a signature to identify functions
1710b57cec5SDimitry Andric   /// possessing type information, or 0 if the platform is unsupported.
1720b57cec5SDimitry Andric   virtual llvm::Constant *
1730b57cec5SDimitry Andric   getUBSanFunctionSignature(CodeGen::CodeGenModule &CGM) const {
1740b57cec5SDimitry Andric     return nullptr;
1750b57cec5SDimitry Andric   }
1760b57cec5SDimitry Andric 
1770b57cec5SDimitry Andric   /// Determine whether a call to an unprototyped functions under
1780b57cec5SDimitry Andric   /// the given calling convention should use the variadic
1790b57cec5SDimitry Andric   /// convention or the non-variadic convention.
1800b57cec5SDimitry Andric   ///
1810b57cec5SDimitry Andric   /// There's a good reason to make a platform's variadic calling
1820b57cec5SDimitry Andric   /// convention be different from its non-variadic calling
1830b57cec5SDimitry Andric   /// convention: the non-variadic arguments can be passed in
1840b57cec5SDimitry Andric   /// registers (better for performance), and the variadic arguments
1850b57cec5SDimitry Andric   /// can be passed on the stack (also better for performance).  If
1860b57cec5SDimitry Andric   /// this is done, however, unprototyped functions *must* use the
1870b57cec5SDimitry Andric   /// non-variadic convention, because C99 states that a call
1880b57cec5SDimitry Andric   /// through an unprototyped function type must succeed if the
1890b57cec5SDimitry Andric   /// function was defined with a non-variadic prototype with
1900b57cec5SDimitry Andric   /// compatible parameters.  Therefore, splitting the conventions
1910b57cec5SDimitry Andric   /// makes it impossible to call a variadic function through an
1920b57cec5SDimitry Andric   /// unprototyped type.  Since function prototypes came out in the
1930b57cec5SDimitry Andric   /// late 1970s, this is probably an acceptable trade-off.
1940b57cec5SDimitry Andric   /// Nonetheless, not all platforms are willing to make it, and in
1950b57cec5SDimitry Andric   /// particularly x86-64 bends over backwards to make the
1960b57cec5SDimitry Andric   /// conventions compatible.
1970b57cec5SDimitry Andric   ///
1980b57cec5SDimitry Andric   /// The default is false.  This is correct whenever:
1990b57cec5SDimitry Andric   ///   - the conventions are exactly the same, because it does not
2000b57cec5SDimitry Andric   ///     matter and the resulting IR will be somewhat prettier in
2010b57cec5SDimitry Andric   ///     certain cases; or
2020b57cec5SDimitry Andric   ///   - the conventions are substantively different in how they pass
2030b57cec5SDimitry Andric   ///     arguments, because in this case using the variadic convention
2040b57cec5SDimitry Andric   ///     will lead to C99 violations.
2050b57cec5SDimitry Andric   ///
2060b57cec5SDimitry Andric   /// However, some platforms make the conventions identical except
2070b57cec5SDimitry Andric   /// for passing additional out-of-band information to a variadic
2080b57cec5SDimitry Andric   /// function: for example, x86-64 passes the number of SSE
2090b57cec5SDimitry Andric   /// arguments in %al.  On these platforms, it is desirable to
2100b57cec5SDimitry Andric   /// call unprototyped functions using the variadic convention so
2110b57cec5SDimitry Andric   /// that unprototyped calls to varargs functions still succeed.
2120b57cec5SDimitry Andric   ///
2130b57cec5SDimitry Andric   /// Relatedly, platforms which pass the fixed arguments to this:
2140b57cec5SDimitry Andric   ///   A foo(B, C, D);
2150b57cec5SDimitry Andric   /// differently than they would pass them to this:
2160b57cec5SDimitry Andric   ///   A foo(B, C, D, ...);
2170b57cec5SDimitry Andric   /// may need to adjust the debugger-support code in Sema to do the
2180b57cec5SDimitry Andric   /// right thing when calling a function with no know signature.
2190b57cec5SDimitry Andric   virtual bool isNoProtoCallVariadic(const CodeGen::CallArgList &args,
2200b57cec5SDimitry Andric                                      const FunctionNoProtoType *fnType) const;
2210b57cec5SDimitry Andric 
2220b57cec5SDimitry Andric   /// Gets the linker options necessary to link a dependent library on this
2230b57cec5SDimitry Andric   /// platform.
2240b57cec5SDimitry Andric   virtual void getDependentLibraryOption(llvm::StringRef Lib,
2250b57cec5SDimitry Andric                                          llvm::SmallString<24> &Opt) const;
2260b57cec5SDimitry Andric 
2270b57cec5SDimitry Andric   /// Gets the linker options necessary to detect object file mismatches on
2280b57cec5SDimitry Andric   /// this platform.
2290b57cec5SDimitry Andric   virtual void getDetectMismatchOption(llvm::StringRef Name,
2300b57cec5SDimitry Andric                                        llvm::StringRef Value,
2310b57cec5SDimitry Andric                                        llvm::SmallString<32> &Opt) const {}
2320b57cec5SDimitry Andric 
2330b57cec5SDimitry Andric   /// Get LLVM calling convention for OpenCL kernel.
2340b57cec5SDimitry Andric   virtual unsigned getOpenCLKernelCallingConv() const;
2350b57cec5SDimitry Andric 
2360b57cec5SDimitry Andric   /// Get target specific null pointer.
2370b57cec5SDimitry Andric   /// \param T is the LLVM type of the null pointer.
2380b57cec5SDimitry Andric   /// \param QT is the clang QualType of the null pointer.
2390b57cec5SDimitry Andric   /// \return ConstantPointerNull with the given type \p T.
2400b57cec5SDimitry Andric   /// Each target can override it to return its own desired constant value.
2410b57cec5SDimitry Andric   virtual llvm::Constant *getNullPointer(const CodeGen::CodeGenModule &CGM,
2420b57cec5SDimitry Andric       llvm::PointerType *T, QualType QT) const;
2430b57cec5SDimitry Andric 
2440b57cec5SDimitry Andric   /// Get target favored AST address space of a global variable for languages
2450b57cec5SDimitry Andric   /// other than OpenCL and CUDA.
2460b57cec5SDimitry Andric   /// If \p D is nullptr, returns the default target favored address space
2470b57cec5SDimitry Andric   /// for global variable.
2480b57cec5SDimitry Andric   virtual LangAS getGlobalVarAddressSpace(CodeGenModule &CGM,
2490b57cec5SDimitry Andric                                           const VarDecl *D) const;
2500b57cec5SDimitry Andric 
2510b57cec5SDimitry Andric   /// Get the AST address space for alloca.
2520b57cec5SDimitry Andric   virtual LangAS getASTAllocaAddressSpace() const { return LangAS::Default; }
2530b57cec5SDimitry Andric 
2540b57cec5SDimitry Andric   /// Perform address space cast of an expression of pointer type.
2550b57cec5SDimitry Andric   /// \param V is the LLVM value to be casted to another address space.
2560b57cec5SDimitry Andric   /// \param SrcAddr is the language address space of \p V.
2570b57cec5SDimitry Andric   /// \param DestAddr is the targeted language address space.
2580b57cec5SDimitry Andric   /// \param DestTy is the destination LLVM pointer type.
2590b57cec5SDimitry Andric   /// \param IsNonNull is the flag indicating \p V is known to be non null.
2600b57cec5SDimitry Andric   virtual llvm::Value *performAddrSpaceCast(CodeGen::CodeGenFunction &CGF,
2610b57cec5SDimitry Andric                                             llvm::Value *V, LangAS SrcAddr,
2620b57cec5SDimitry Andric                                             LangAS DestAddr, llvm::Type *DestTy,
2630b57cec5SDimitry Andric                                             bool IsNonNull = false) const;
2640b57cec5SDimitry Andric 
2650b57cec5SDimitry Andric   /// Perform address space cast of a constant expression of pointer type.
2660b57cec5SDimitry Andric   /// \param V is the LLVM constant to be casted to another address space.
2670b57cec5SDimitry Andric   /// \param SrcAddr is the language address space of \p V.
2680b57cec5SDimitry Andric   /// \param DestAddr is the targeted language address space.
2690b57cec5SDimitry Andric   /// \param DestTy is the destination LLVM pointer type.
2700b57cec5SDimitry Andric   virtual llvm::Constant *performAddrSpaceCast(CodeGenModule &CGM,
2710b57cec5SDimitry Andric                                                llvm::Constant *V,
2720b57cec5SDimitry Andric                                                LangAS SrcAddr, LangAS DestAddr,
2730b57cec5SDimitry Andric                                                llvm::Type *DestTy) const;
2740b57cec5SDimitry Andric 
2750b57cec5SDimitry Andric   /// Get address space of pointer parameter for __cxa_atexit.
2760b57cec5SDimitry Andric   virtual LangAS getAddrSpaceOfCxaAtexitPtrParam() const {
2770b57cec5SDimitry Andric     return LangAS::Default;
2780b57cec5SDimitry Andric   }
2790b57cec5SDimitry Andric 
2800b57cec5SDimitry Andric   /// Get the syncscope used in LLVM IR.
2810b57cec5SDimitry Andric   virtual llvm::SyncScope::ID getLLVMSyncScopeID(const LangOptions &LangOpts,
2820b57cec5SDimitry Andric                                                  SyncScope Scope,
2830b57cec5SDimitry Andric                                                  llvm::AtomicOrdering Ordering,
2840b57cec5SDimitry Andric                                                  llvm::LLVMContext &Ctx) const;
2850b57cec5SDimitry Andric 
2860b57cec5SDimitry Andric   /// Interface class for filling custom fields of a block literal for OpenCL.
2870b57cec5SDimitry Andric   class TargetOpenCLBlockHelper {
2880b57cec5SDimitry Andric   public:
2890b57cec5SDimitry Andric     typedef std::pair<llvm::Value *, StringRef> ValueTy;
2900b57cec5SDimitry Andric     TargetOpenCLBlockHelper() {}
2910b57cec5SDimitry Andric     virtual ~TargetOpenCLBlockHelper() {}
2920b57cec5SDimitry Andric     /// Get the custom field types for OpenCL blocks.
2930b57cec5SDimitry Andric     virtual llvm::SmallVector<llvm::Type *, 1> getCustomFieldTypes() = 0;
2940b57cec5SDimitry Andric     /// Get the custom field values for OpenCL blocks.
2950b57cec5SDimitry Andric     virtual llvm::SmallVector<ValueTy, 1>
2960b57cec5SDimitry Andric     getCustomFieldValues(CodeGenFunction &CGF, const CGBlockInfo &Info) = 0;
2970b57cec5SDimitry Andric     virtual bool areAllCustomFieldValuesConstant(const CGBlockInfo &Info) = 0;
2980b57cec5SDimitry Andric     /// Get the custom field values for OpenCL blocks if all values are LLVM
2990b57cec5SDimitry Andric     /// constants.
3000b57cec5SDimitry Andric     virtual llvm::SmallVector<llvm::Constant *, 1>
3010b57cec5SDimitry Andric     getCustomFieldValues(CodeGenModule &CGM, const CGBlockInfo &Info) = 0;
3020b57cec5SDimitry Andric   };
3030b57cec5SDimitry Andric   virtual TargetOpenCLBlockHelper *getTargetOpenCLBlockHelper() const {
3040b57cec5SDimitry Andric     return nullptr;
3050b57cec5SDimitry Andric   }
3060b57cec5SDimitry Andric 
3070b57cec5SDimitry Andric   /// Create an OpenCL kernel for an enqueued block. The kernel function is
3080b57cec5SDimitry Andric   /// a wrapper for the block invoke function with target-specific calling
3090b57cec5SDimitry Andric   /// convention and ABI as an OpenCL kernel. The wrapper function accepts
3100b57cec5SDimitry Andric   /// block context and block arguments in target-specific way and calls
3110b57cec5SDimitry Andric   /// the original block invoke function.
3120b57cec5SDimitry Andric   virtual llvm::Function *
3130b57cec5SDimitry Andric   createEnqueuedBlockKernel(CodeGenFunction &CGF,
3140b57cec5SDimitry Andric                             llvm::Function *BlockInvokeFunc,
3150b57cec5SDimitry Andric                             llvm::Value *BlockLiteral) const;
3160b57cec5SDimitry Andric 
3170b57cec5SDimitry Andric   /// \return true if the target supports alias from the unmangled name to the
3180b57cec5SDimitry Andric   /// mangled name of functions declared within an extern "C" region and marked
3190b57cec5SDimitry Andric   /// as 'used', and having internal linkage.
3200b57cec5SDimitry Andric   virtual bool shouldEmitStaticExternCAliases() const { return true; }
3210b57cec5SDimitry Andric 
3220b57cec5SDimitry Andric   virtual void setCUDAKernelCallingConvention(const FunctionType *&FT) const {}
3235ffd83dbSDimitry Andric 
3245ffd83dbSDimitry Andric   /// Return the device-side type for the CUDA device builtin surface type.
3255ffd83dbSDimitry Andric   virtual llvm::Type *getCUDADeviceBuiltinSurfaceDeviceType() const {
3265ffd83dbSDimitry Andric     // By default, no change from the original one.
3275ffd83dbSDimitry Andric     return nullptr;
3285ffd83dbSDimitry Andric   }
3295ffd83dbSDimitry Andric   /// Return the device-side type for the CUDA device builtin texture type.
3305ffd83dbSDimitry Andric   virtual llvm::Type *getCUDADeviceBuiltinTextureDeviceType() const {
3315ffd83dbSDimitry Andric     // By default, no change from the original one.
3325ffd83dbSDimitry Andric     return nullptr;
3335ffd83dbSDimitry Andric   }
3345ffd83dbSDimitry Andric 
3355ffd83dbSDimitry Andric   /// Emit the device-side copy of the builtin surface type.
3365ffd83dbSDimitry Andric   virtual bool emitCUDADeviceBuiltinSurfaceDeviceCopy(CodeGenFunction &CGF,
3375ffd83dbSDimitry Andric                                                       LValue Dst,
3385ffd83dbSDimitry Andric                                                       LValue Src) const {
3395ffd83dbSDimitry Andric     // DO NOTHING by default.
3405ffd83dbSDimitry Andric     return false;
3415ffd83dbSDimitry Andric   }
3425ffd83dbSDimitry Andric   /// Emit the device-side copy of the builtin texture type.
3435ffd83dbSDimitry Andric   virtual bool emitCUDADeviceBuiltinTextureDeviceCopy(CodeGenFunction &CGF,
3445ffd83dbSDimitry Andric                                                       LValue Dst,
3455ffd83dbSDimitry Andric                                                       LValue Src) const {
3465ffd83dbSDimitry Andric     // DO NOTHING by default.
3475ffd83dbSDimitry Andric     return false;
3485ffd83dbSDimitry Andric   }
3490b57cec5SDimitry Andric };
3500b57cec5SDimitry Andric 
3510b57cec5SDimitry Andric } // namespace CodeGen
3520b57cec5SDimitry Andric } // namespace clang
3530b57cec5SDimitry Andric 
3540b57cec5SDimitry Andric #endif // LLVM_CLANG_LIB_CODEGEN_TARGETINFO_H
355