-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathintrinsics.cpp
More file actions
47 lines (37 loc) · 1.12 KB
/
intrinsics.cpp
File metadata and controls
47 lines (37 loc) · 1.12 KB
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
45
46
47
#include "llvm/IR/Attributes.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/Support/ErrorHandling.h"
#include <iostream>
#include <string>
using namespace std;
using namespace llvm;
/// Table of string intrinsic names indexed by enum value.
static const char * const IntrinsicNameTable[] = {
"not_intrinsic",
#define GET_INTRINSIC_NAME_TABLE
#include "llvm/IR/Intrinsics.gen"
#undef GET_INTRINSIC_NAME_TABLE
};
#if 0
/// Table of per-target intrinsic name tables.
#define GET_INTRINSIC_TARGET_DATA
#include "llvm/IR/Intrinsics.gen"
#undef GET_INTRINSIC_TARGET_DATA
/// Query attributes by Intrinsic ID.
#define GET_INTRINSIC_ATTRIBUTES
#include "llvm/IR/Intrinsics.gen"
#undef GET_INTRINSIC_ATTRIBUTES
#endif
bool startswith(const string& base, const string& prefix) {
return base.substr(0, prefix.size()) == prefix;
}
int main() {
int num_intrinsics = sizeof(IntrinsicNameTable) / sizeof(char *);
for (int ID = 0; ID < num_intrinsics; ID++) {
const string& name = IntrinsicNameTable[ID];
if (startswith(name, "llvm.x86.avx2")) {
std::cout << name << std::endl;
}
}
return 0;
}