]>
Commit | Line | Data |
---|---|---|
1d09f67e TL |
1 | // Licensed to the Apache Software Foundation (ASF) under one |
2 | // or more contributor license agreements. See the NOTICE file | |
3 | // distributed with this work for additional information | |
4 | // regarding copyright ownership. The ASF licenses this file | |
5 | // to you under the Apache License, Version 2.0 (the | |
6 | // "License"); you may not use this file except in compliance | |
7 | // with the License. You may obtain a copy of the License at | |
8 | // | |
9 | // http://www.apache.org/licenses/LICENSE-2.0 | |
10 | // | |
11 | // Unless required by applicable law or agreed to in writing, | |
12 | // software distributed under the License is distributed on an | |
13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
14 | // KIND, either express or implied. See the License for the | |
15 | // specific language governing permissions and limitations | |
16 | // under the License. | |
17 | ||
18 | #pragma once | |
19 | ||
20 | #if defined(_MSC_VER) | |
21 | #pragma warning(push) | |
22 | #pragma warning(disable : 4141) | |
23 | #pragma warning(disable : 4146) | |
24 | #pragma warning(disable : 4244) | |
25 | #pragma warning(disable : 4267) | |
26 | #pragma warning(disable : 4291) | |
27 | #pragma warning(disable : 4624) | |
28 | #endif | |
29 | ||
30 | #include <llvm/ExecutionEngine/ExecutionEngine.h> | |
31 | #include <llvm/IR/IRBuilder.h> | |
32 | #include <llvm/IR/LLVMContext.h> | |
33 | #include <llvm/IR/Module.h> | |
34 | ||
35 | #if LLVM_VERSION_MAJOR >= 10 | |
36 | #define LLVM_ALIGN(alignment) (llvm::Align((alignment))) | |
37 | #else | |
38 | #define LLVM_ALIGN(alignment) (alignment) | |
39 | #endif | |
40 | ||
41 | #if defined(_MSC_VER) | |
42 | #pragma warning(pop) | |
43 | #endif | |
44 | ||
45 | // Workaround for deprecated builder methods as of LLVM 13: ARROW-14363 | |
46 | inline llvm::Value* CreateGEP(llvm::IRBuilder<>* builder, llvm::Value* Ptr, | |
47 | llvm::ArrayRef<llvm::Value*> IdxList, | |
48 | const llvm::Twine& Name = "") { | |
49 | return builder->CreateGEP(Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, | |
50 | IdxList, Name); | |
51 | } | |
52 | ||
53 | inline llvm::LoadInst* CreateLoad(llvm::IRBuilder<>* builder, llvm::Value* Ptr, | |
54 | const llvm::Twine& Name = "") { | |
55 | return builder->CreateLoad(Ptr->getType()->getPointerElementType(), Ptr, Name); | |
56 | } |