]> git.proxmox.com Git - rustc.git/blame - src/llvm/include/llvm/Support/Host.h
Imported Upstream version 1.0.0+dfsg1
[rustc.git] / src / llvm / include / llvm / Support / Host.h
CommitLineData
223e47cc
LB
1//===- llvm/Support/Host.h - Host machine characteristics --------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// Methods for querying the nature of the host machine.
11//
12//===----------------------------------------------------------------------===//
13
970d7e83
LB
14#ifndef LLVM_SUPPORT_HOST_H
15#define LLVM_SUPPORT_HOST_H
223e47cc
LB
16
17#include "llvm/ADT/StringMap.h"
1a4d82fc
JJ
18
19#if defined(__linux__) || defined(__GNU__)
20#include <endian.h>
21#else
22#if !defined(BYTE_ORDER) && !defined(LLVM_ON_WIN32)
23#include <machine/endian.h>
24#endif
25#endif
26
223e47cc
LB
27#include <string>
28
29namespace llvm {
30namespace sys {
31
1a4d82fc
JJ
32#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
33 static const bool IsBigEndianHost = true;
34#else
35 static const bool IsBigEndianHost = false;
36#endif
223e47cc 37
1a4d82fc 38 static const bool IsLittleEndianHost = !IsBigEndianHost;
223e47cc
LB
39
40 /// getDefaultTargetTriple() - Return the default target triple the compiler
41 /// has been configured to produce code for.
42 ///
43 /// The target triple is a string in the format of:
44 /// CPU_TYPE-VENDOR-OPERATING_SYSTEM
45 /// or
46 /// CPU_TYPE-VENDOR-KERNEL-OPERATING_SYSTEM
47 std::string getDefaultTargetTriple();
48
970d7e83
LB
49 /// getProcessTriple() - Return an appropriate target triple for generating
50 /// code to be loaded into the current process, e.g. when using the JIT.
51 std::string getProcessTriple();
52
223e47cc
LB
53 /// getHostCPUName - Get the LLVM name for the host CPU. The particular format
54 /// of the name is target dependent, and suitable for passing as -mcpu to the
55 /// target which matches the host.
56 ///
57 /// \return - The host CPU name, or empty if the CPU could not be determined.
1a4d82fc 58 StringRef getHostCPUName();
223e47cc
LB
59
60 /// getHostCPUFeatures - Get the LLVM names for the host CPU features.
61 /// The particular format of the names are target dependent, and suitable for
62 /// passing as -mattr to the target which matches the host.
63 ///
64 /// \param Features - A string mapping feature names to either
65 /// true (if enabled) or false (if disabled). This routine makes no guarantees
66 /// about exactly which features may appear in this map, except that they are
67 /// all valid LLVM feature names.
68 ///
69 /// \return - True on success.
70 bool getHostCPUFeatures(StringMap<bool> &Features);
71}
72}
73
74#endif