brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 3bc4e63 Raw
50 lines · c
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-exception6//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_H14#define COMPILER_RT_LIB_BUILTINS_CPU_MODEL_COMMON_H15 16#define bool int17#define true 118#define false 019 20#ifndef __has_attribute21#define __has_attribute(attr) 022#endif23 24#if __has_attribute(constructor)25#if __GNUC__ >= 926// Ordinarily init priorities below 101 are disallowed as they are reserved for27// the implementation. However, we are the implementation, so silence the28// diagnostic, since it doesn't apply to us.29#pragma GCC diagnostic ignored "-Wprio-ctor-dtor"30#endif31// We're choosing init priority 90 to force our constructors to run before any32// constructors in the end user application (starting at priority 101). This33// value matches the libgcc choice for the same functions.34#ifdef _WIN3235// Contructor that replaces the ifunc runs currently with prio 10, see36// the LowerIFuncPass. The resolver of FMV depends on the cpu features so set37// the priority to 9.38#define CONSTRUCTOR_PRIORITY 939#else40#define CONSTRUCTOR_PRIORITY 9041#endif42#define CONSTRUCTOR_ATTRIBUTE __attribute__((constructor(CONSTRUCTOR_PRIORITY)))43#else44// FIXME: For MSVC, we should make a function pointer global in .CRT$X?? so that45// this runs during initialization.46#define CONSTRUCTOR_ATTRIBUTE47#endif48 49#endif50