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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
//===-- gen/llvm.h - Common LLVM includes and aliases -----------*- C++ -*-===//
//
// LDC – the LLVM D compiler
//
// This file is distributed under the BSD-style LDC license. See the LICENSE
// file for details.
//
//===----------------------------------------------------------------------===//
//
// Pulls in commonly used LLVM headers and provides shorthands for some LLVM
// types.
//
// TODO: Consider removing this file; the aliases mostly make code more
// cumbersome to read for people familiar with LLVM anyway.
//
//===----------------------------------------------------------------------===//
#pragma once
#include "llvm/IR/Type.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Value.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/DebugInfo.h"
#if LDC_LLVM_VER >= 1000
// LLVM >= 10 requires C++14 and no longer has llvm::make_unique. Add it back
// and point to std::make_unique.
#include <memory>
namespace llvm {
using std::make_unique;
}
#endif
using llvm::APFloat;
using llvm::APInt;
using llvm::IRBuilder;
#if LDC_LLVM_VER >= 1000
#if LDC_LLVM_VER >= 1100
#define LLAlign llvm::Align
#else
#define LLAlign llvm::MaybeAlign
#endif
#define LLMaybeAlign llvm::MaybeAlign
#else
#define LLAlign
#define LLMaybeAlign
#endif
#define GET_INTRINSIC_DECL(_X) \
(llvm::Intrinsic::getDeclaration(&gIR->module, llvm::Intrinsic::_X))
// shortcuts for the common llvm types
#define LLType llvm::Type
#define LLFunctionType llvm::FunctionType
#define LLPointerType llvm::PointerType
#define LLStructType llvm::StructType
#define LLArrayType llvm::ArrayType
#define LLIntegerType llvm::IntegerType
#define LLOpaqueType llvm::OpaqueType
#define LLValue llvm::Value
#define LLGlobalValue llvm::GlobalValue
#define LLGlobalVariable llvm::GlobalVariable
#define LLFunction llvm::Function
#define LLConstant llvm::Constant
#define LLConstantStruct llvm::ConstantStruct
#define LLConstantArray llvm::ConstantArray
#define LLConstantInt llvm::ConstantInt
#define LLConstantFP llvm::ConstantFP
#define LLSmallVector llvm::SmallVector
using LLCallBasePtr = llvm::CallBase *;
|