blob: a43e0a541bb8ba74a8f523b0b6bae0a6940e79e2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
/*
* Copyright (c) 2015 Andrew Kelley
*
* This file is part of zig, which is MIT licensed.
* See http://opensource.org/licenses/MIT
*/
#include "zig_llvm.hpp"
#include <llvm/InitializePasses.h>
#include <llvm/PassRegistry.h>
#include <llvm/MC/SubtargetFeature.h>
using namespace llvm;
void LLVMZigInitializeLoopStrengthReducePass(LLVMPassRegistryRef R) {
initializeLoopStrengthReducePass(*unwrap(R));
}
void LLVMZigInitializeLowerIntrinsicsPass(LLVMPassRegistryRef R) {
initializeLowerIntrinsicsPass(*unwrap(R));
}
void LLVMZigInitializeUnreachableBlockElimPass(LLVMPassRegistryRef R) {
initializeUnreachableBlockElimPass(*unwrap(R));
}
char *LLVMZigGetHostCPUName(void) {
std::string str = sys::getHostCPUName();
return strdup(str.c_str());
}
char *LLVMZigGetNativeFeatures(void) {
SubtargetFeatures features;
StringMap<bool> host_features;
if (sys::getHostCPUFeatures(host_features)) {
for (auto &F : host_features)
features.AddFeature(F.first(), F.second);
}
return strdup(features.getString().c_str());
}
|