Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/cpu_model.h
35292 views
1
//===-- cpu_model_common.c - Utilities for cpu model detection ----*- 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 implements common utilities for runtime cpu model detection.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef COMPILER_RT_LIB_BUILTINS_CPU_MODEL_COMMON_H
14
#define COMPILER_RT_LIB_BUILTINS_CPU_MODEL_COMMON_H
15
16
#define bool int
17
#define true 1
18
#define false 0
19
20
#ifndef __has_attribute
21
#define __has_attribute(attr) 0
22
#endif
23
24
#if __has_attribute(constructor)
25
#if __GNUC__ >= 9
26
// Ordinarily init priorities below 101 are disallowed as they are reserved for
27
// the implementation. However, we are the implementation, so silence the
28
// diagnostic, since it doesn't apply to us.
29
#pragma GCC diagnostic ignored "-Wprio-ctor-dtor"
30
#endif
31
// We're choosing init priority 90 to force our constructors to run before any
32
// constructors in the end user application (starting at priority 101). This
33
// value matches the libgcc choice for the same functions.
34
#define CONSTRUCTOR_ATTRIBUTE __attribute__((constructor(90)))
35
#else
36
// FIXME: For MSVC, we should make a function pointer global in .CRT$X?? so that
37
// this runs during initialization.
38
#define CONSTRUCTOR_ATTRIBUTE
39
#endif
40
41
#endif
42
43