UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IntelICXPlatform.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*================================================================================
4 IntelICXPlatform.h: Setup for any Intel ICX-using platform
5==================================================================================*/
6
7#pragma once
8
9#if defined(__INTEL_LLVM_COMPILER)
10
11#if !defined(__cpp_if_constexpr)
12 #error "Compiler is expected to support if constexpr"
13#endif
14
15#if !defined(__cpp_fold_expressions)
16 #error "Compiler is expected to support fold expressions"
17#endif
18
19#if !__has_feature(cxx_decltype_auto)
20 #error "Compiler is expected to support decltype(auto)"
21#endif
22
23#define PLATFORM_RETURN_ADDRESS() __builtin_return_address(0)
24#define PLATFORM_RETURN_ADDRESS_POINTER() __builtin_frame_address(0)
25
26#define UE_LIFETIMEBOUND [[clang::lifetimebound]]
27
28#define UE_NODEBUG [[gnu::nodebug]]
29
30// Intel ICX supports the following GNU attributes to let us describe allocation functions.
31// `gnu::malloc` maps to the `noalias` function return on the caller in the LLVM IR.
32// `gnu::alloc_size` maps to the `allocsize` function attribute on the caller in the LLVM IR.
33// `gnu::alloc_align` will cause any memory operations in the callee to have the specified alignment in the LLVM IR.
34// We use a selector macro trick to map up to 2 inputs to the correct macros.
35#define UE_ALLOCATION_FUNCTION_0() [[gnu::malloc]]
36#define UE_ALLOCATION_FUNCTION_1(SIZE) [[gnu::malloc, gnu::alloc_size(SIZE)]]
37
38// Note: we cannot use gnu::alloc_align(ALIGN) here yet, because the DEFAULT_ALIGNMENT argument is 0, which is not
39// a power of two, and Clang will complain about uses of a function with a default alignment that is not a
40// power of two.
41#define UE_ALLOCATION_FUNCTION_2(SIZE, ALIGN) [[gnu::malloc, gnu::alloc_size(SIZE)]]
42#define UE_ALLOCATION_FUNCTION_X(x, SIZE, ALIGN, FUNC, ...) FUNC
43#define UE_ALLOCATION_FUNCTION(...) UE_ALLOCATION_FUNCTION_X(,##__VA_ARGS__, UE_ALLOCATION_FUNCTION_2(__VA_ARGS__), UE_ALLOCATION_FUNCTION_1(__VA_ARGS__), UE_ALLOCATION_FUNCTION_0(__VA_ARGS__))
44
45#define PLATFORM_COMPILER_SUPPORTS_BUILTIN_BITCAST 1
46
47#define FUNCTION_NON_NULL_RETURN_START [[gnu::returns_nonnull]]
48
49#if defined(__has_attribute)
50# if __has_attribute(no_profile_instrument_function)
51# define UE_NO_PROFILE_ATTRIBUTE __attribute__((no_profile_instrument_function))
52# endif
53#endif
54
55#ifndef UE_NO_PROFILE_ATTRIBUTE
56# define UE_NO_PROFILE_ATTRIBUTE
57#endif
58
59#endif // defined(__INTEL_LLVM_COMPILER)