Skip to content

Commit

Permalink
Merge pull request rust-lang#253 from folkertdev/llvm-12
Browse files Browse the repository at this point in the history
Llvm 12
  • Loading branch information
TheDan64 authored Jun 6, 2021
2 parents 7df64d4 + 1f9ad77 commit db59ef3
Show file tree
Hide file tree
Showing 14 changed files with 125 additions and 47 deletions.
33 changes: 26 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,22 @@ matrix:
- libclang-common-11-dev
rust: 1.45.2
dist: bionic
- env:
- LLVM_VERSION="12.0"
<<: *BASE
addons:
apt:
sources:
- *BASE_SOURCES
- llvm-toolchain-bionic-12
- sourceline: 'deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-12 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
packages:
- *BASE_PACKAGES
- llvm-12-dev
- libclang-common-12-dev
rust: 1.45.2
dist: bionic
- deploy: # Documentation build; Only latest supported LLVM version for now
provider: pages
skip-cleanup: true
Expand All @@ -206,10 +222,10 @@ matrix:
on:
branch: master
before_install:
- export PATH=/usr/lib/llvm-11/bin/:$HOME/.local/bin:$PATH
- export LLVM_PATH=/usr/share/llvm-11/cmake/
- export PATH=/usr/lib/llvm-12/bin/:$HOME/.local/bin:$PATH
- export LLVM_PATH=/usr/share/llvm-12/cmake/
script:
- cargo doc --no-default-features --features "target-all,llvm11-0,nightly" --color=always
- cargo doc --no-default-features --features "target-all,llvm12-0,nightly" --color=always
- echo '<meta http-equiv="refresh" content="1; url=inkwell/index.html">' > target/doc/index.html
rust: nightly
name: "GitHub IO Documentation Deployment"
Expand All @@ -228,8 +244,9 @@ matrix:
# - llvm-toolchain-trusty-8
# - llvm-toolchain-bionic-9
# llvm-toolchain-bionic-10
- llvm-toolchain-bionic-11
- sourceline: 'deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main'
# llvm-toolchain-bionic-11
- llvm-toolchain-bionic-12
- sourceline: 'deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-12 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
packages:
- *BASE_PACKAGES
Expand All @@ -243,8 +260,10 @@ matrix:
# - llvm-7-dev
# - llvm-8-dev
# - llvm-9-dev
# llvm-10-dev
- llvm-11-dev
# - llvm-10-dev
# - llvm-11-dev
- llvm-12-dev
- libclang-common-12-dev
dist: bionic

env:
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ llvm8-0 = ["llvm-sys-80"]
llvm9-0 = ["llvm-sys-90"]
llvm10-0 = ["llvm-sys-100"]
llvm11-0 = ["llvm-sys-110"]
llvm12-0 = ["llvm-sys-120"]
# Don't link aganist LLVM libraries. This is useful if another dependency is
# installing LLVM. See llvm-sys for more details. We can't enable a single
# `no-llvm-linking` feature across the board of llvm versions, as it'll cause
Expand All @@ -43,6 +44,7 @@ llvm8-0-no-llvm-linking = ["llvm8-0", "llvm-sys-80/no-llvm-linking"]
llvm9-0-no-llvm-linking = ["llvm9-0", "llvm-sys-90/no-llvm-linking"]
llvm10-0-no-llvm-linking = ["llvm10-0", "llvm-sys-100/no-llvm-linking"]
llvm11-0-no-llvm-linking = ["llvm11-0", "llvm-sys-110/no-llvm-linking"]
llvm12-0-no-llvm-linking = ["llvm12-0", "llvm-sys-120/no-llvm-linking"]
# Don't force linking to libffi on non-windows platforms. Without this feature
# inkwell always links to libffi on non-windows platforms.
no-libffi-linking = []
Expand Down Expand Up @@ -99,6 +101,7 @@ llvm-sys-80 = { package = "llvm-sys", version = "80.3", optional = true }
llvm-sys-90 = { package = "llvm-sys", version = "90.2", optional = true }
llvm-sys-100 = { package = "llvm-sys", version = "100.2", optional = true }
llvm-sys-110 = { package = "llvm-sys", version = "110.0", optional = true }
llvm-sys-120 = { package = "llvm-sys", version = "120.0", optional = true }
once_cell = "1.4.1"
parking_lot = "0.11"
regex = "1"
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Inkwell aims to help you pen your own programming languages by safely wrapping l

* Rust 1.42+
* Rust Stable, Beta, or Nightly
* LLVM 3.6, 3.7, 3.8, 3.9, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, or 11.0
* LLVM 3.6, 3.7, 3.8, 3.9, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0 or 12.0

## Usage

Expand All @@ -24,7 +24,7 @@ branch with a corresponding LLVM feature flag:

```toml
[dependencies]
inkwell = { git = "https://github.com/TheDan64/inkwell", branch = "master", features = ["llvm11-0"] }
inkwell = { git = "https://github.com/TheDan64/inkwell", branch = "master", features = ["llvm12-0"] }
```

Supported versions:
Expand All @@ -43,6 +43,7 @@ Supported versions:
| 9.0.x | llvm9-0 |
| 10.0.x | llvm10-0 |
| 11.0.x | llvm11-0 |
| 12.0.x | llvm12-0 |

Please be aware that we may make breaking changes on master from time to time since we are
pre-v1.0.0, in compliance with semver. Please prefer a crates.io release whenever possible!
Expand Down
4 changes: 2 additions & 2 deletions internal_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use syn::spanned::Spanned;
use syn::{Token, LitFloat, Ident, Item, Field, Variant, Attribute};

// This array should match the LLVM features in the top level Cargo manifest
const FEATURE_VERSIONS: [&str; 12] =
["llvm3-6", "llvm3-7", "llvm3-8", "llvm3-9", "llvm4-0", "llvm5-0", "llvm6-0", "llvm7-0", "llvm8-0", "llvm9-0", "llvm10-0", "llvm11-0"];
const FEATURE_VERSIONS: [&str; 13] =
["llvm3-6", "llvm3-7", "llvm3-8", "llvm3-9", "llvm4-0", "llvm5-0", "llvm6-0", "llvm7-0", "llvm8-0", "llvm9-0", "llvm10-0", "llvm11-0", "llvm12-0"];

/// Gets the index of the feature version that represents `latest`
fn get_latest_feature_index(features: &[&str]) -> usize {
Expand Down
14 changes: 7 additions & 7 deletions src/debug_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ impl<'ctx> DebugInfoBuilder<'ctx> {
dwo_id: libc::c_uint,
split_debug_inlining: bool,
debug_info_for_profiling: bool,
#[cfg(feature = "llvm11-0")]
#[cfg(any(feature = "llvm11-0", feature = "llvm12-0"))]
sysroot: &str,
#[cfg(feature = "llvm11-0")]
#[cfg(any(feature = "llvm11-0", feature = "llvm12-0"))]
sdk: &str,
) -> (Self, DICompileUnit<'ctx>) {
let builder = unsafe {
Expand Down Expand Up @@ -209,9 +209,9 @@ impl<'ctx> DebugInfoBuilder<'ctx> {
dwo_id,
split_debug_inlining,
debug_info_for_profiling,
#[cfg(feature = "llvm11-0")]
#[cfg(any(feature = "llvm11-0", feature = "llvm12-0"))]
sysroot,
#[cfg(feature = "llvm11-0")]
#[cfg(any(feature = "llvm11-0", feature = "llvm12-0"))]
sdk
);

Expand Down Expand Up @@ -244,9 +244,9 @@ impl<'ctx> DebugInfoBuilder<'ctx> {
dwo_id: libc::c_uint,
split_debug_inlining: bool,
debug_info_for_profiling: bool,
#[cfg(feature = "llvm11-0")]
#[cfg(any(feature = "llvm11-0", feature = "llvm12-0"))]
sysroot: &str,
#[cfg(feature = "llvm11-0")]
#[cfg(any(feature = "llvm11-0", feature = "llvm12-0"))]
sdk: &str,
) -> DICompileUnit<'ctx> {

Expand All @@ -271,7 +271,7 @@ impl<'ctx> DebugInfoBuilder<'ctx> {
debug_info_for_profiling as _,
) }

#[cfg(feature = "llvm11-0")]
#[cfg(any(feature = "llvm11-0", feature = "llvm12-0"))]
{ LLVMDIBuilderCreateCompileUnit(
self.builder,
language.into(),
Expand Down
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ extern crate llvm_sys_90 as llvm_sys;
extern crate llvm_sys_100 as llvm_sys;
#[cfg(feature="llvm11-0")]
extern crate llvm_sys_110 as llvm_sys;
#[cfg(feature="llvm12-0")]
extern crate llvm_sys_120 as llvm_sys;

use llvm_sys::{LLVMIntPredicate, LLVMRealPredicate, LLVMVisibility, LLVMThreadLocalMode, LLVMDLLStorageClass, LLVMAtomicOrdering, LLVMAtomicRMWBinOp};

Expand Down Expand Up @@ -102,7 +104,7 @@ macro_rules! assert_unique_used_features {
}
}

assert_unique_used_features!{"llvm3-6", "llvm3-7", "llvm3-8", "llvm3-9", "llvm4-0", "llvm5-0", "llvm6-0", "llvm7-0", "llvm8-0", "llvm9-0", "llvm10-0", "llvm11-0"}
assert_unique_used_features!{"llvm3-6", "llvm3-7", "llvm3-8", "llvm3-9", "llvm4-0", "llvm5-0", "llvm6-0", "llvm7-0", "llvm8-0", "llvm9-0", "llvm10-0", "llvm11-0", "llvm12-0"}

/// Defines the address space in which a global will be inserted.
///
Expand Down
8 changes: 4 additions & 4 deletions src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1380,18 +1380,18 @@ impl<'ctx> Module<'ctx> {
dwo_id: libc::c_uint,
split_debug_inlining: bool,
debug_info_for_profiling: bool,
#[cfg(feature="llvm11-0")]
#[cfg(any(feature = "llvm11-0", feature = "llvm12-0"))]
sysroot: &str,
#[cfg(feature="llvm11-0")]
#[cfg(any(feature = "llvm11-0", feature = "llvm12-0"))]
sdk: &str,
) -> (DebugInfoBuilder<'ctx>, DICompileUnit<'ctx>) {
DebugInfoBuilder::new(self, allow_unresolved,
language, filename, directory, producer, is_optimized, flags,
runtime_ver, split_name, kind, dwo_id, split_debug_inlining,
debug_info_for_profiling,
#[cfg(feature="llvm11-0")]
#[cfg(any(feature = "llvm11-0", feature = "llvm12-0"))]
sysroot,
#[cfg(feature="llvm11-0")]
#[cfg(any(feature = "llvm11-0", feature = "llvm12-0"))]
sdk
)
}
Expand Down
45 changes: 43 additions & 2 deletions src/passes.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
use llvm_sys::core::{LLVMDisposePassManager, LLVMInitializeFunctionPassManager, LLVMFinalizeFunctionPassManager, LLVMRunFunctionPassManager, LLVMRunPassManager, LLVMCreatePassManager, LLVMCreateFunctionPassManagerForModule, LLVMGetGlobalPassRegistry};
use llvm_sys::initialization::{LLVMInitializeCore, LLVMInitializeTransformUtils, LLVMInitializeScalarOpts, LLVMInitializeObjCARCOpts, LLVMInitializeVectorization, LLVMInitializeInstCombine, LLVMInitializeIPO, LLVMInitializeInstrumentation, LLVMInitializeAnalysis, LLVMInitializeIPA, LLVMInitializeCodeGen, LLVMInitializeTarget};
use llvm_sys::prelude::{LLVMPassManagerRef, LLVMPassRegistryRef};
use llvm_sys::transforms::ipo::{LLVMAddArgumentPromotionPass, LLVMAddConstantMergePass, LLVMAddDeadArgEliminationPass, LLVMAddFunctionAttrsPass, LLVMAddFunctionInliningPass, LLVMAddAlwaysInlinerPass, LLVMAddGlobalDCEPass, LLVMAddGlobalOptimizerPass, LLVMAddIPConstantPropagationPass, LLVMAddIPSCCPPass, LLVMAddInternalizePass, LLVMAddStripDeadPrototypesPass, LLVMAddPruneEHPass, LLVMAddStripSymbolsPass};
use llvm_sys::transforms::ipo::{LLVMAddArgumentPromotionPass, LLVMAddConstantMergePass, LLVMAddDeadArgEliminationPass, LLVMAddFunctionAttrsPass, LLVMAddFunctionInliningPass, LLVMAddAlwaysInlinerPass, LLVMAddGlobalDCEPass, LLVMAddGlobalOptimizerPass, LLVMAddIPSCCPPass, LLVMAddInternalizePass, LLVMAddStripDeadPrototypesPass, LLVMAddPruneEHPass, LLVMAddStripSymbolsPass};
use llvm_sys::transforms::pass_manager_builder::{LLVMPassManagerBuilderRef, LLVMPassManagerBuilderCreate, LLVMPassManagerBuilderDispose, LLVMPassManagerBuilderSetOptLevel, LLVMPassManagerBuilderSetSizeLevel, LLVMPassManagerBuilderSetDisableUnitAtATime, LLVMPassManagerBuilderSetDisableUnrollLoops, LLVMPassManagerBuilderSetDisableSimplifyLibCalls, LLVMPassManagerBuilderUseInlinerWithThreshold, LLVMPassManagerBuilderPopulateFunctionPassManager, LLVMPassManagerBuilderPopulateModulePassManager, LLVMPassManagerBuilderPopulateLTOPassManager};
use llvm_sys::transforms::scalar::{LLVMAddAggressiveDCEPass, LLVMAddMemCpyOptPass, LLVMAddAlignmentFromAssumptionsPass, LLVMAddCFGSimplificationPass, LLVMAddDeadStoreEliminationPass, LLVMAddScalarizerPass, LLVMAddMergedLoadStoreMotionPass, LLVMAddGVNPass, LLVMAddIndVarSimplifyPass, LLVMAddInstructionCombiningPass, LLVMAddJumpThreadingPass, LLVMAddLICMPass, LLVMAddLoopDeletionPass, LLVMAddLoopIdiomPass, LLVMAddLoopRotatePass, LLVMAddLoopRerollPass, LLVMAddLoopUnrollPass, LLVMAddLoopUnswitchPass, LLVMAddPartiallyInlineLibCallsPass, LLVMAddSCCPPass, LLVMAddScalarReplAggregatesPass, LLVMAddScalarReplAggregatesPassSSA, LLVMAddScalarReplAggregatesPassWithThreshold, LLVMAddSimplifyLibCallsPass, LLVMAddTailCallEliminationPass, LLVMAddConstantPropagationPass, LLVMAddDemoteMemoryToRegisterPass, LLVMAddVerifierPass, LLVMAddCorrelatedValuePropagationPass, LLVMAddEarlyCSEPass, LLVMAddLowerExpectIntrinsicPass, LLVMAddTypeBasedAliasAnalysisPass, LLVMAddScopedNoAliasAAPass, LLVMAddBasicAliasAnalysisPass, LLVMAddReassociatePass};
use llvm_sys::transforms::scalar::{LLVMAddAggressiveDCEPass, LLVMAddMemCpyOptPass, LLVMAddAlignmentFromAssumptionsPass, LLVMAddCFGSimplificationPass, LLVMAddDeadStoreEliminationPass, LLVMAddScalarizerPass, LLVMAddMergedLoadStoreMotionPass, LLVMAddGVNPass, LLVMAddIndVarSimplifyPass, LLVMAddInstructionCombiningPass, LLVMAddJumpThreadingPass, LLVMAddLICMPass, LLVMAddLoopDeletionPass, LLVMAddLoopIdiomPass, LLVMAddLoopRotatePass, LLVMAddLoopRerollPass, LLVMAddLoopUnrollPass, LLVMAddLoopUnswitchPass, LLVMAddPartiallyInlineLibCallsPass, LLVMAddSCCPPass, LLVMAddScalarReplAggregatesPass, LLVMAddScalarReplAggregatesPassSSA, LLVMAddScalarReplAggregatesPassWithThreshold, LLVMAddSimplifyLibCallsPass, LLVMAddTailCallEliminationPass, LLVMAddDemoteMemoryToRegisterPass, LLVMAddVerifierPass, LLVMAddCorrelatedValuePropagationPass, LLVMAddEarlyCSEPass, LLVMAddLowerExpectIntrinsicPass, LLVMAddTypeBasedAliasAnalysisPass, LLVMAddScopedNoAliasAAPass, LLVMAddBasicAliasAnalysisPass, LLVMAddReassociatePass};
#[llvm_versions(3.7..=latest)]
use llvm_sys::transforms::scalar::LLVMAddBitTrackingDCEPass;
use llvm_sys::transforms::vectorize::{LLVMAddLoopVectorizePass, LLVMAddSLPVectorizePass};

// LLVM12 removes the ConstantPropagation pass
// Users should use the InstSimplify pass instead.
#[llvm_versions(3.6..=11.0)]
use llvm_sys::transforms::ipo::LLVMAddIPConstantPropagationPass;
#[llvm_versions(3.6..=11.0)]
use llvm_sys::transforms::scalar::LLVMAddConstantPropagationPass;

#[llvm_versions(12.0..=latest)]
use llvm_sys::transforms::scalar::LLVMAddInstructionSimplifyPass;

use crate::OptimizationLevel;
use crate::module::Module;
#[llvm_versions(3.6..=3.8)]
Expand Down Expand Up @@ -362,6 +372,10 @@ impl<T: PassManagerSubType> PassManager<T> {
/// makes arguments dead, but does not remove them. The existing
/// dead argument elimination pass should be run after this to
/// clean up the mess.
///
/// In LLVM 12 and later, this instruction is replaced by the
/// [`add_instruction_simplify_pass`].
#[llvm_versions(3.6..=11.0)]
pub fn add_ip_constant_propagation_pass(&self) {
unsafe {
LLVMAddIPConstantPropagationPass(self.pass_manager)
Expand Down Expand Up @@ -920,12 +934,39 @@ impl<T: PassManagerSubType> PassManager<T> {
///
/// NOTE: this pass has a habit of making definitions be dead. It is a good idea to
/// run a Dead Instruction Elimination pass sometime after running this pass.
///
/// In LLVM 12 and later, this instruction is replaced by the
/// [`add_instruction_simplify_pass`].
#[llvm_versions(3.6..=11.0)]
pub fn add_constant_propagation_pass(&self) {
unsafe {
LLVMAddConstantPropagationPass(self.pass_manager)
}
}

/// This pass implements constant propagation and merging. It looks for instructions
/// involving only constant operands and replaces them with a constant value instead
/// of an instruction. For example:
///
/// ```ir
/// add i32 1, 2
/// ```
///
/// becomes
///
/// ```ir
/// i32 3
/// ```
///
/// NOTE: this pass has a habit of making definitions be dead. It is a good idea to
/// run a Dead Instruction Elimination pass sometime after running this pass.
#[llvm_versions(12.0..=latest)]
pub fn add_instruction_simplify_pass(&self) {
unsafe {
LLVMAddInstructionSimplifyPass(self.pass_manager)
}
}

/// This file promotes memory references to be register references.
/// It promotes alloca instructions which only have loads and stores
/// as uses. An alloca is transformed by using dominator frontiers to
Expand Down
14 changes: 10 additions & 4 deletions src/types/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl<'ctx> AnyTypeEnum<'ctx> {
LLVMTypeKind::LLVMX86_FP80TypeKind |
LLVMTypeKind::LLVMFP128TypeKind |
LLVMTypeKind::LLVMPPC_FP128TypeKind => AnyTypeEnum::FloatType(FloatType::new(type_)),
#[cfg(feature = "llvm11-0")]
#[cfg(any(feature = "llvm11-0", feature = "llvm12-0"))]
LLVMTypeKind::LLVMBFloatTypeKind => AnyTypeEnum::FloatType(FloatType::new(type_)),
LLVMTypeKind::LLVMLabelTypeKind => panic!("FIXME: Unsupported type: Label"),
LLVMTypeKind::LLVMIntegerTypeKind => AnyTypeEnum::IntType(IntType::new(type_)),
Expand All @@ -108,10 +108,12 @@ impl<'ctx> AnyTypeEnum<'ctx> {
LLVMTypeKind::LLVMArrayTypeKind => AnyTypeEnum::ArrayType(ArrayType::new(type_)),
LLVMTypeKind::LLVMPointerTypeKind => AnyTypeEnum::PointerType(PointerType::new(type_)),
LLVMTypeKind::LLVMVectorTypeKind => AnyTypeEnum::VectorType(VectorType::new(type_)),
#[cfg(feature = "llvm11-0")]
#[cfg(any(feature = "llvm11-0", feature = "llvm12-0"))]
LLVMTypeKind::LLVMScalableVectorTypeKind => AnyTypeEnum::VectorType(VectorType::new(type_)),
LLVMTypeKind::LLVMMetadataTypeKind => panic!("FIXME: Unsupported type: Metadata"),
LLVMTypeKind::LLVMX86_MMXTypeKind => panic!("FIXME: Unsupported type: MMX"),
#[cfg(feature = "llvm12-0")]
LLVMTypeKind::LLVMX86_AMXTypeKind => panic!("FIXME: Unsupported type: AMX"),
#[cfg(not(any(feature = "llvm3-6", feature = "llvm3-7")))]
LLVMTypeKind::LLVMTokenTypeKind => panic!("FIXME: Unsupported type: Token"),
}
Expand Down Expand Up @@ -243,17 +245,21 @@ impl<'ctx> BasicTypeEnum<'ctx> {
LLVMTypeKind::LLVMX86_FP80TypeKind |
LLVMTypeKind::LLVMFP128TypeKind |
LLVMTypeKind::LLVMPPC_FP128TypeKind => BasicTypeEnum::FloatType(FloatType::new(type_)),
#[cfg(feature= "llvm11-0")]
#[cfg(any(feature = "llvm11-0", feature = "llvm12-0"))]
LLVMTypeKind::LLVMBFloatTypeKind => BasicTypeEnum::FloatType(FloatType::new(type_)),
LLVMTypeKind::LLVMIntegerTypeKind => BasicTypeEnum::IntType(IntType::new(type_)),
LLVMTypeKind::LLVMStructTypeKind => BasicTypeEnum::StructType(StructType::new(type_)),
LLVMTypeKind::LLVMPointerTypeKind => BasicTypeEnum::PointerType(PointerType::new(type_)),
LLVMTypeKind::LLVMArrayTypeKind => BasicTypeEnum::ArrayType(ArrayType::new(type_)),
LLVMTypeKind::LLVMVectorTypeKind => BasicTypeEnum::VectorType(VectorType::new(type_)),
#[cfg(feature= "llvm11-0")]
#[cfg(any(feature = "llvm11-0", feature = "llvm12-0"))]
LLVMTypeKind::LLVMScalableVectorTypeKind => BasicTypeEnum::VectorType(VectorType::new(type_)),
LLVMTypeKind::LLVMMetadataTypeKind => unreachable!("Unsupported basic type: Metadata"),
// see https://llvm.org/docs/LangRef.html#x86-mmx-type
LLVMTypeKind::LLVMX86_MMXTypeKind => unreachable!("Unsupported basic type: MMX"),
// see https://llvm.org/docs/LangRef.html#x86-amx-type
#[cfg(feature = "llvm12-0")]
LLVMTypeKind::LLVMX86_AMXTypeKind => unreachable!("Unsupported basic type: AMX"),
LLVMTypeKind::LLVMLabelTypeKind => unreachable!("Unsupported basic type: Label"),
LLVMTypeKind::LLVMVoidTypeKind => unreachable!("Unsupported basic type: VoidType"),
LLVMTypeKind::LLVMFunctionTypeKind => unreachable!("Unsupported basic type: FunctionType"),
Expand Down
2 changes: 1 addition & 1 deletion src/values/instruction_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ impl<'ctx> InstructionValue<'ctx> {
// SubTypes: Only apply to memory access and alloca instructions
/// Sets alignment on a memory access instruction or alloca.
pub fn set_alignment(self, alignment: u32) -> Result<(), &'static str> {
#[cfg(feature = "llvm11-0")]
#[cfg(any(feature = "llvm11-0", feature = "llvm12-0"))]
{
if alignment == 0 {
return Err("Alignment cannot be 0");
Expand Down
2 changes: 2 additions & 0 deletions src/values/metadata_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ pub const FIRST_CUSTOM_METADATA_KIND_ID: u32 = 26;
pub const FIRST_CUSTOM_METADATA_KIND_ID: u32 = 28;
#[cfg(any(feature = "llvm10-0", feature = "llvm11-0"))]
pub const FIRST_CUSTOM_METADATA_KIND_ID: u32 = 30;
#[cfg(feature = "llvm12-0")]
pub const FIRST_CUSTOM_METADATA_KIND_ID: u32 = 31;

#[derive(PartialEq, Eq, Clone, Copy, Hash)]
pub struct MetadataValue<'ctx> {
Expand Down
Loading

0 comments on commit db59ef3

Please sign in to comment.