diff --git a/Cargo.toml b/Cargo.toml index a0669415..9ccf0a0a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,6 @@ license = "MIT" build = "build.rs" [dependencies] -llvm-sys-80 = { package = "llvm-sys", version = "80.3.0", optional = true } llvm-sys-90 = { package = "llvm-sys", version = "90.2.0", optional = true } llvm-sys-100 = { package = "llvm-sys", version = "100.2.0", optional = true } llvm-sys-110 = { package = "llvm-sys", version = "110.0.0", optional = true } @@ -32,7 +31,6 @@ itertools = "0.11" [features] # Select the LLVM version to be compatible with. # You _must_ enable exactly one of the following features. -llvm-8 = ["llvm-sys-80", "llvm-8-or-lower", "llvm-8-or-greater"] llvm-9 = ["llvm-sys-90", "llvm-9-or-lower", "llvm-9-or-greater"] llvm-10 = ["llvm-sys-100", "llvm-10-or-lower", "llvm-10-or-greater"] llvm-11 = ["llvm-sys-110", "llvm-11-or-lower", "llvm-11-or-greater"] @@ -47,8 +45,7 @@ llvm-17 = ["llvm-sys-170", "llvm-17-or-lower", "llvm-17-or-greater"] # For convenience, these automatically-enabled features allow us to avoid # checking complex combinations of features all the time. They are not meant to # be manually enabled; use the above llvm-x features instead -llvm-8-or-greater = [] -llvm-9-or-greater = ["llvm-8-or-greater"] +llvm-9-or-greater = [] llvm-10-or-greater = ["llvm-9-or-greater"] llvm-11-or-greater = ["llvm-10-or-greater"] llvm-12-or-greater = ["llvm-11-or-greater"] @@ -58,7 +55,6 @@ llvm-15-or-greater = ["llvm-14-or-greater"] llvm-16-or-greater = ["llvm-15-or-greater"] llvm-17-or-greater = ["llvm-16-or-greater"] -llvm-8-or-lower = ["llvm-9-or-lower"] llvm-9-or-lower = ["llvm-10-or-lower"] llvm-10-or-lower = ["llvm-11-or-lower"] llvm-11-or-lower = ["llvm-12-or-lower"] @@ -78,7 +74,6 @@ llvm-17-or-lower = [] # This avoids activating all the optional dependencies when `strict-versioning` # is activated. strict-versioning = [ - "llvm-sys-80?/strict-versioning", "llvm-sys-90?/strict-versioning", "llvm-sys-100?/strict-versioning", "llvm-sys-110?/strict-versioning", diff --git a/README.md b/README.md index 5bf7e860..a66c1741 100644 --- a/README.md +++ b/README.md @@ -40,12 +40,12 @@ to the LLVM version you want: llvm-ir = { version = "0.10.0", features = ["llvm-17"] } ``` -Currently, the supported LLVM versions are `llvm-8`, `llvm-9`, `llvm-10`, -`llvm-11`, `llvm-12`, `llvm-13`, `llvm-14`, `llvm-15`, `llvm-16`, and `llvm-17`. +Currently, the supported LLVM versions are `llvm-9`, `llvm-10`, `llvm-11`, +`llvm-12`, `llvm-13`, `llvm-14`, `llvm-15`, `llvm-16`, and `llvm-17`. Then, the easiest way to get started is to parse some existing LLVM IR into this crate's data structures. -To do this, you need LLVM bitcode (`*.bc`) files. +To do this, you need LLVM bitcode (`*.bc`) or text-format IR (`*.ll`) files. If you currently have C/C++ sources (say, `source.c`), you can generate `*.bc` files with `clang`'s `-c` and `-emit-llvm` flags: ```bash @@ -61,6 +61,7 @@ In either case, once you have a bitcode file, then you can use `llvm-ir`'s use llvm_ir::Module; let module = Module::from_bc_path("path/to/my/file.bc")?; ``` +or if you have a text-format IR file, you can use `Module::from_ir_path()`. You may also be interested in the [`llvm-ir-analysis`] crate, which computes control-flow graphs, dominator trees, etc for `llvm-ir` functions. @@ -82,8 +83,15 @@ using. ## Compatibility Starting with `llvm-ir` 0.7.0, LLVM versions are selected by a Cargo feature flag. This means that a single crate version can be used for any supported LLVM -version. Currently, `llvm-ir` supports LLVM versions 8 through 17, selected by -feature flags `llvm-8` through `llvm-17`. +version. Currently, `llvm-ir` supports LLVM versions 9 through 17, selected by +feature flags `llvm-9` through `llvm-17`. + +You should select the LLVM version corresponding to the version of the LLVM +library you are linking against (i.e., that is available on your system.) +Newer LLVMs should be able to read bitcode produced by older LLVMs, so you +should be able to use this crate to parse bitcode older than the LLVM version +you select via crate feature, even bitcode produced by LLVMs older than LLVM 9. +However, this is not extensively tested by us. `llvm-ir` works on stable Rust. As of this writing, it requires Rust 1.65+. @@ -118,20 +126,12 @@ source locations), but makes no attempt to recover any other debug metadata. LLVM files containing metadata can still be parsed in with no problems, but the resulting `Module` structures will not contain any of the metadata, except debug locations. -Work-in-progress on fixing this can be found on the `metadata` branch of this -repo, but be warned that the `metadata` branch doesn't even build at the time -of this writing, let alone provide any meaningful functionality for crate -users. A few other features are missing from `llvm-ir`'s data structures because getters for them are missing from the LLVM C API and the Rust `llvm-sys` crate, only being present in the LLVM C++ API. These include but are not limited to: -- the `nsw` and `nuw` flags on `Add`, `Sub`, `Mul`, and `Shl`, and likewise -the `exact` flag on `UDiv`, `SDiv`, `LShr`, and `AShr`. The C API has -functionality to create new instructions specifying values of these flags, -but not to query the values of these flags on existing instructions. - the "fast-math flags" on various floating-point operations - contents of inline assembly functions - information about the clauses in the variadic `LandingPad` instruction @@ -143,6 +143,11 @@ associated with a function fit in 64 bits) -- see [#5](https://github.com/cdisselkoen/llvm-ir/issues/5) - the "other labels" reachable from a `CallBr` terminator (which was introduced in LLVM 9) +- (LLVM 16 and lower -- fixed in LLVM 17 and later) the `nsw` and `nuw` flags on +`Add`, `Sub`, `Mul`, and `Shl`, and likewise the `exact` flag on `UDiv`, `SDiv`, +`LShr`, and `AShr`. The C API has functionality to create new instructions +specifying values of these flags, but not to query the values of these flags on +existing instructions. - (LLVM 9 and lower -- fixed in LLVM 10 and later) the opcode for the `AtomicRMW` instruction, i.e., `Xchg`, `Add`, `Max`, `Min`, and the like. @@ -151,11 +156,10 @@ More discussion about this is in Any contributions to filling these gaps in the C API are greatly appreciated! ## Acknowledgments -`llvm-ir` is heavily inspired by the [`llvm-hs-pure` Haskell package]. -Most of the data structures in `llvm-ir` are essentially translations from -Haskell to Rust of the data structures in `llvm-hs-pure` (with some tweaks). -To a lesser extent, `llvm-ir` borrows from the larger [`llvm-hs` Haskell -package] as well. +`llvm-ir` took its original inspiration from the [`llvm-hs-pure` Haskell package]. +Most of the data structures in the original release of `llvm-ir` were +essentially translations from Haskell to Rust of the data structures in +`llvm-hs-pure` (with some tweaks). ## Changelog for 0.7.0 @@ -167,8 +171,9 @@ one of the features `llvm-8`, `llvm-9`, or `llvm-10`. Previously, we had the `0.6.x` branch for LLVM 10, the `0.5.x` branch for LLVM 9, and didn't officially support LLVM 8. Now, a single release supports LLVM 8, 9, and 10. - (Note: Versions of this crate beyond 0.7.0 have added support for later LLVM - versions as well. For instance, 0.7.3 and later also supports LLVM 11; and - 0.7.5 and later also supports LLVM 12.) + versions as well. For instance, 0.7.3 and later also support LLVM 11; and + 0.7.5 and later also support LLVM 12. Crate version 0.11.0 removed support + for LLVM 8.) - [`FunctionAttribute`] and [`ParameterAttribute`] are now proper enums with descriptive variants such as `NoInline`, `StackProtect`, etc. Previously, attributes were opaque numeric codes which were difficult to interpret. @@ -189,8 +194,8 @@ number of breaking changes to the public interface: [`module.types.named_struct_def()`] to get the definition for any named struct type in the module. - The required Rust version increased from 1.36+ to 1.39+. - - (Note: 0.7.2 increased the required Rust version again, to 1.43+; - and 0.8.1 increased it to 1.45+.) + - (Note: Versions of this crate beyond 0.7.0 have increased this requirement + further. For the current required Rust version, see "Compatibility" above.) [`llvm-sys`]: https://crates.io/crates/llvm-sys [`inkwell`]: https://github.com/TheDan64/inkwell diff --git a/build.rs b/build.rs index 9eeb2784..0acf6b17 100644 --- a/build.rs +++ b/build.rs @@ -1,8 +1,5 @@ fn main() { let mut versions = vec![]; - if cfg!(feature = "llvm-8") { - versions.push(8); - } if cfg!(feature = "llvm-9") { versions.push(9); } diff --git a/src/basicblock.rs b/src/basicblock.rs index 844e1eda..36b85226 100644 --- a/src/basicblock.rs +++ b/src/basicblock.rs @@ -20,7 +20,6 @@ impl BasicBlock { name, instrs: vec![], term: Terminator::Unreachable(Unreachable { - #[cfg(feature = "llvm-9-or-greater")] debugloc: None, }), } @@ -116,7 +115,6 @@ fn term_needs_name(term: LLVMValueRef) -> bool { match unsafe { LLVMGetInstructionOpcode(term) } { LLVMOpcode::LLVMInvoke => true, LLVMOpcode::LLVMCatchSwitch => true, - #[cfg(feature = "llvm-9-or-greater")] LLVMOpcode::LLVMCallBr => true, _ => false, // all other terminators have no result (destination) and thus don't need names } diff --git a/src/from_llvm.rs b/src/from_llvm.rs index e452d35a..c0c0c7d8 100644 --- a/src/from_llvm.rs +++ b/src/from_llvm.rs @@ -45,7 +45,6 @@ macro_rules! wrap_with_len { }; } -#[cfg(feature = "llvm-9-or-greater")] macro_rules! wrap_with_len_maybe_null { ($llvmFunc:ident, $argty:ty, $wrapperFunc:ident) => { pub unsafe fn $wrapperFunc(arg: $argty) -> Option { @@ -87,9 +86,7 @@ wrap_with_len!( LLVMAttributeRef, get_string_attribute_value ); -#[cfg(feature = "llvm-9-or-greater")] wrap_with_len_maybe_null!(LLVMGetDebugLocFilename, LLVMValueRef, get_debugloc_filename); -#[cfg(feature = "llvm-9-or-greater")] wrap_with_len_maybe_null!( LLVMGetDebugLocDirectory, LLVMValueRef, diff --git a/src/function.rs b/src/function.rs index c7389d0f..86a66b85 100644 --- a/src/function.rs +++ b/src/function.rs @@ -1,4 +1,3 @@ -#[cfg(feature = "llvm-9-or-greater")] use crate::debugloc::{DebugLoc, HasDebugLoc}; use crate::module::{Comdat, DLLStorageClass, Linkage, Visibility}; use crate::types::{TypeRef, Typed, Types}; @@ -26,7 +25,6 @@ pub struct Function { // pub prefix: Option, // appears to not be exposed in the LLVM C API, only the C++ API /// Personalities are used for exception handling. See [LLVM 14 docs on Personality Function](https://releases.llvm.org/14.0.0/docs/LangRef.html#personalityfn) pub personality_function: Option, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: Vec<(String, MetadataRef)>, } @@ -41,7 +39,6 @@ impl Typed for Function { } } -#[cfg(feature = "llvm-9-or-greater")] impl HasDebugLoc for Function { fn get_debug_loc(&self) -> &Option { &self.debugloc @@ -73,7 +70,6 @@ impl Function { alignment: 4, garbage_collector_name: None, personality_function: None, - #[cfg(feature = "llvm-9-or-greater")] debugloc: None, } } @@ -94,7 +90,6 @@ pub struct FunctionDeclaration { pub alignment: u32, /// See [LLVM 14 docs on Garbage Collector Strategy Names](https://releases.llvm.org/14.0.0/docs/LangRef.html#gc) pub garbage_collector_name: Option, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, } @@ -207,7 +202,6 @@ pub enum FunctionAttribute { NoBuiltin, NoCFCheck, NoDuplicate, - #[cfg(feature = "llvm-9-or-greater")] NoFree, NoImplicitFloat, NoInline, @@ -217,10 +211,8 @@ pub enum FunctionAttribute { NoRedZone, NoReturn, NoRecurse, - #[cfg(feature = "llvm-9-or-greater")] WillReturn, ReturnsTwice, - #[cfg(feature = "llvm-9-or-greater")] NoSync, NoUnwind, #[cfg(feature = "llvm-11-or-greater")] @@ -237,7 +229,6 @@ pub enum FunctionAttribute { SanitizeMemory, SanitizeThread, SanitizeHWAddress, - #[cfg(feature = "llvm-9-or-greater")] SanitizeMemTag, ShadowCallStack, SpeculativeLoadHardening, @@ -286,7 +277,6 @@ pub enum ParameterAttribute { Alignment(u64), NoAlias, NoCapture, - #[cfg(feature = "llvm-9-or-greater")] NoFree, Nest, Returned, @@ -438,7 +428,6 @@ impl FunctionDeclaration { }), alignment: unsafe { LLVMGetAlignment(func) }, garbage_collector_name: unsafe { get_gc(func) }, - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_no_col(func), }; (decl, local_ctr) @@ -546,7 +535,6 @@ impl Function { None } }, - #[cfg(feature = "llvm-9-or-greater")] debugloc: decl.debugloc, // metadata: unimplemented!("Function.metadata"), } @@ -631,7 +619,6 @@ impl AttributesData { "nobuiltin", "nocf_check", "noduplicate", - #[cfg(feature = "llvm-9-or-greater")] "nofree", "noimplicitfloat", "noinline", @@ -641,10 +628,8 @@ impl AttributesData { "noredzone", "noreturn", "norecurse", - #[cfg(feature = "llvm-9-or-greater")] "willreturn", "returns_twice", - #[cfg(feature = "llvm-9-or-greater")] "nosync", "nounwind", #[cfg(feature = "llvm-11-or-greater")] @@ -662,7 +647,6 @@ impl AttributesData { "sanitize_memory", "sanitize_thread", "sanitize_hwaddress", - #[cfg(feature = "llvm-9-or-greater")] "sanitize_memtag", "shadowcallstack", "speculative_load_hardening", @@ -695,7 +679,6 @@ impl AttributesData { "align", "noalias", "nocapture", - #[cfg(feature = "llvm-9-or-greater")] "nofree", "nest", "returned", @@ -704,7 +687,6 @@ impl AttributesData { "dereferenceable_or_null", "swiftself", "swifterror", - #[cfg(feature = "llvm-9-or-greater")] "immarg", #[cfg(feature = "llvm-11-or-greater")] "noundef", @@ -768,7 +750,6 @@ impl FunctionAttribute { Some("nobuiltin") => Self::NoBuiltin, Some("nocf_check") => Self::NoCFCheck, Some("noduplicate") => Self::NoDuplicate, - #[cfg(feature = "llvm-9-or-greater")] Some("nofree") => Self::NoFree, Some("noimplicitfloat") => Self::NoImplicitFloat, Some("noinline") => Self::NoInline, @@ -778,10 +759,8 @@ impl FunctionAttribute { Some("noredzone") => Self::NoRedZone, Some("noreturn") => Self::NoReturn, Some("norecurse") => Self::NoRecurse, - #[cfg(feature = "llvm-9-or-greater")] Some("willreturn") => Self::WillReturn, Some("returns_twice") => Self::ReturnsTwice, - #[cfg(feature = "llvm-9-or-greater")] Some("nosync") => Self::NoSync, Some("nounwind") => Self::NoUnwind, #[cfg(feature = "llvm-11-or-greater")] @@ -798,7 +777,6 @@ impl FunctionAttribute { Some("sanitize_memory") => Self::SanitizeMemory, Some("sanitize_thread") => Self::SanitizeThread, Some("sanitize_hwaddress") => Self::SanitizeHWAddress, - #[cfg(feature = "llvm-9-or-greater")] Some("sanitize_memtag") => Self::SanitizeMemTag, Some("shadowcallstack") => Self::ShadowCallStack, Some("speculative_load_hardening") => Self::SpeculativeLoadHardening, @@ -868,7 +846,6 @@ impl ParameterAttribute { Some("align") => Self::Alignment(unsafe { LLVMGetEnumAttributeValue(a) }), Some("noalias") => Self::NoAlias, Some("nocapture") => Self::NoCapture, - #[cfg(feature = "llvm-9-or-greater")] Some("nofree") => Self::NoFree, Some("nest") => Self::Nest, Some("returned") => Self::Returned, diff --git a/src/instruction.rs b/src/instruction.rs index 9ffacbcd..326072ab 100644 --- a/src/instruction.rs +++ b/src/instruction.rs @@ -1,5 +1,4 @@ use crate::constant::ConstantRef; -#[cfg(feature = "llvm-9-or-greater")] use crate::debugloc::{DebugLoc, HasDebugLoc}; use crate::function::{CallingConvention, FunctionAttribute, ParameterAttribute}; use crate::name::Name; @@ -150,7 +149,6 @@ impl Typed for Instruction { } } -#[cfg(feature = "llvm-9-or-greater")] impl HasDebugLoc for Instruction { fn get_debug_loc(&self) -> &Option { match self { @@ -555,7 +553,6 @@ macro_rules! impl_inst { } } - #[cfg(feature = "llvm-9-or-greater")] impl HasDebugLoc for $inst { fn get_debug_loc(&self) -> &Option { &self.debugloc @@ -639,7 +636,6 @@ macro_rules! binop_display { "{} = {} {}, {}", &self.dest, $dispname, &self.operand0, &self.operand1, )?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -672,7 +668,6 @@ macro_rules! binop_nuw_nsw_display { &self.operand0, &self.operand1, )?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -700,7 +695,6 @@ macro_rules! binop_exact_display { &self.operand0, &self.operand1, )?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -724,7 +718,6 @@ macro_rules! unop_same_type { impl Display for $inst { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{} = {} {}", &self.dest, $dispname, &self.operand)?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -747,7 +740,6 @@ macro_rules! unop_explicitly_typed { "{} = {} {} to {}", &self.dest, $dispname, &self.operand, &self.to_type, )?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -813,7 +805,6 @@ pub struct Add { pub nuw: bool, // prior to LLVM 17, no getter for this was exposed in the LLVM C API, only in the C++ one #[cfg(feature = "llvm-17-or-greater")] pub nsw: bool, // prior to LLVM 17, no getter for this was exposed in the LLVM C API, only in the C++ one - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -834,7 +825,6 @@ pub struct Sub { pub nuw: bool, // prior to LLVM 17, no getter for this was exposed in the LLVM C API, only in the C++ one #[cfg(feature = "llvm-17-or-greater")] pub nsw: bool, // prior to LLVM 17, no getter for this was exposed in the LLVM C API, only in the C++ one - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -855,7 +845,6 @@ pub struct Mul { pub nuw: bool, // prior to LLVM 17, no getter for this was exposed in the LLVM C API, only in the C++ one #[cfg(feature = "llvm-17-or-greater")] pub nsw: bool, // prior to LLVM 17, no getter for this was exposed in the LLVM C API, only in the C++ one - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -874,7 +863,6 @@ pub struct UDiv { pub dest: Name, #[cfg(feature = "llvm-17-or-greater")] pub exact: bool, // prior to LLVM 17, no getter for this was exposed in the LLVM C API, only in the C++ one - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -893,7 +881,6 @@ pub struct SDiv { pub dest: Name, #[cfg(feature = "llvm-17-or-greater")] pub exact: bool, // prior to LLVM 17, no getter for this was exposed in the LLVM C API, only in the C++ one - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -910,7 +897,6 @@ pub struct URem { pub operand0: Operand, pub operand1: Operand, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -927,7 +913,6 @@ pub struct SRem { pub operand0: Operand, pub operand1: Operand, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -944,7 +929,6 @@ pub struct And { pub operand0: Operand, pub operand1: Operand, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -961,7 +945,6 @@ pub struct Or { pub operand0: Operand, pub operand1: Operand, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -978,7 +961,6 @@ pub struct Xor { pub operand0: Operand, pub operand1: Operand, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -999,7 +981,6 @@ pub struct Shl { pub nuw: bool, // prior to LLVM 17, no getter for this was exposed in the LLVM C API, only in the C++ one #[cfg(feature = "llvm-17-or-greater")] pub nsw: bool, // prior to LLVM 17, no getter for this was exposed in the LLVM C API, only in the C++ one - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1018,7 +999,6 @@ pub struct LShr { pub dest: Name, #[cfg(feature = "llvm-17-or-greater")] pub exact: bool, // prior to LLVM 17, no getter for this was exposed in the LLVM C API, only in the C++ one - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1037,7 +1017,6 @@ pub struct AShr { pub dest: Name, #[cfg(feature = "llvm-17-or-greater")] pub exact: bool, // prior to LLVM 17, no getter for this was exposed in the LLVM C API, only in the C++ one - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1055,7 +1034,6 @@ pub struct FAdd { pub operand1: Operand, pub dest: Name, // pub fast_math_flags: FastMathFlags, // getters for these seem to not be exposed in the LLVM C API, only in the C++ one - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1073,7 +1051,6 @@ pub struct FSub { pub operand1: Operand, pub dest: Name, // pub fast_math_flags: FastMathFlags, // getters for these seem to not be exposed in the LLVM C API, only in the C++ one - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1091,7 +1068,6 @@ pub struct FMul { pub operand1: Operand, pub dest: Name, // pub fast_math_flags: FastMathFlags, // getters for these seem to not be exposed in the LLVM C API, only in the C++ one - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1109,7 +1085,6 @@ pub struct FDiv { pub operand1: Operand, pub dest: Name, // pub fast_math_flags: FastMathFlags, // getters for these seem to not be exposed in the LLVM C API, only in the C++ one - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1127,7 +1102,6 @@ pub struct FRem { pub operand1: Operand, pub dest: Name, // pub fast_math_flags: FastMathFlags, // getters for these seem to not be exposed in the LLVM C API, only in the C++ one - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1144,7 +1118,6 @@ pub struct FNeg { pub operand: Operand, pub dest: Name, // pub fast_math_flags: FastMathFlags, // getters for these seem to not be exposed in the LLVM C API, only in the C++ one - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1159,7 +1132,6 @@ pub struct ExtractElement { pub vector: Operand, pub index: Operand, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1186,7 +1158,6 @@ impl Display for ExtractElement { "{} = extractelement {}, {}", &self.dest, &self.vector, &self.index, )?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -1202,7 +1173,6 @@ pub struct InsertElement { pub element: Operand, pub index: Operand, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1223,7 +1193,6 @@ impl Display for InsertElement { "{} = insertelement {}, {}, {}", &self.dest, &self.vector, &self.element, &self.index, )?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -1239,7 +1208,6 @@ pub struct ShuffleVector { pub operand1: Operand, pub dest: Name, pub mask: ConstantRef, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1283,7 +1251,6 @@ impl Display for ShuffleVector { "{} = shufflevector {}, {}, {}", &self.dest, &self.operand0, &self.operand1, &self.mask, )?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -1298,7 +1265,6 @@ pub struct ExtractValue { pub aggregate: Operand, pub indices: Vec, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1344,7 +1310,6 @@ impl Display for ExtractValue { for idx in &self.indices[1 ..] { write!(f, ", {idx}")?; } - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -1360,7 +1325,6 @@ pub struct InsertValue { pub element: Operand, pub indices: Vec, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1387,7 +1351,6 @@ impl Display for InsertValue { for idx in &self.indices[1 ..] { write!(f, ", {idx}")?; } - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -1403,7 +1366,6 @@ pub struct Alloca { pub num_elements: Operand, // llvm-hs-pure has Option pub dest: Name, pub alignment: u32, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1433,7 +1395,6 @@ impl Display for Alloca { write!(f, ", {}", &self.num_elements)?; } write!(f, ", align {}", &self.alignment)?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -1452,7 +1413,6 @@ pub struct Load { pub volatile: bool, pub atomicity: Option, pub alignment: u32, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1500,7 +1460,6 @@ impl Display for Load { write!(f, " {}", a)?; } write!(f, ", align {}", &self.alignment)?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -1517,7 +1476,6 @@ pub struct Store { pub volatile: bool, pub atomicity: Option, pub alignment: u32, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1539,7 +1497,6 @@ impl Display for Store { write!(f, " {}", a)?; } write!(f, ", align {}", &self.alignment)?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -1552,7 +1509,6 @@ impl Display for Store { #[derive(PartialEq, Clone, Debug)] pub struct Fence { pub atomicity: Atomicity, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1563,7 +1519,6 @@ void_typed!(Fence); impl Display for Fence { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "fence {}", &self.atomicity)?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -1586,7 +1541,6 @@ pub struct CmpXchg { pub failure_memory_ordering: MemoryOrdering, #[cfg(feature = "llvm-10-or-greater")] pub weak: bool, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1621,7 +1575,6 @@ impl Display for CmpXchg { &self.atomicity, &self.failure_memory_ordering, )?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -1641,7 +1594,6 @@ pub struct AtomicRMW { pub dest: Name, pub volatile: bool, pub atomicity: Atomicity, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1677,7 +1629,6 @@ impl Display for AtomicRMW { #[cfg(feature = "llvm-10-or-greater")] write!(f, "{} ", &self.operation)?; write!(f, "{}, {} {}", &self.address, &self.value, &self.atomicity)?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -1694,7 +1645,6 @@ pub struct GetElementPtr { pub indices: Vec, pub dest: Name, pub in_bounds: bool, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, #[cfg(feature = "llvm-14-or-greater")] pub source_element_type: TypeRef @@ -1771,7 +1721,6 @@ impl Display for GetElementPtr { for idx in &self.indices { write!(f, ", {}", idx)?; } - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -1786,7 +1735,6 @@ pub struct Trunc { pub operand: Operand, pub to_type: TypeRef, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1801,7 +1749,6 @@ pub struct ZExt { pub operand: Operand, pub to_type: TypeRef, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1816,7 +1763,6 @@ pub struct SExt { pub operand: Operand, pub to_type: TypeRef, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1831,7 +1777,6 @@ pub struct FPTrunc { pub operand: Operand, pub to_type: TypeRef, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1846,7 +1791,6 @@ pub struct FPExt { pub operand: Operand, pub to_type: TypeRef, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1861,7 +1805,6 @@ pub struct FPToUI { pub operand: Operand, pub to_type: TypeRef, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1876,7 +1819,6 @@ pub struct FPToSI { pub operand: Operand, pub to_type: TypeRef, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1891,7 +1833,6 @@ pub struct UIToFP { pub operand: Operand, pub to_type: TypeRef, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1906,7 +1847,6 @@ pub struct SIToFP { pub operand: Operand, pub to_type: TypeRef, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1921,7 +1861,6 @@ pub struct PtrToInt { pub operand: Operand, pub to_type: TypeRef, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1936,7 +1875,6 @@ pub struct IntToPtr { pub operand: Operand, pub to_type: TypeRef, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1951,7 +1889,6 @@ pub struct BitCast { pub operand: Operand, pub to_type: TypeRef, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1966,7 +1903,6 @@ pub struct AddrSpaceCast { pub operand: Operand, pub to_type: TypeRef, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -1982,7 +1918,6 @@ pub struct ICmp { pub operand0: Operand, pub operand1: Operand, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -2015,7 +1950,6 @@ impl Display for ICmp { "{} = icmp {} {}, {}", &self.dest, &self.predicate, &self.operand0, &self.operand1, )?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -2031,7 +1965,6 @@ pub struct FCmp { pub operand0: Operand, pub operand1: Operand, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -2064,7 +1997,6 @@ impl Display for FCmp { "{} = fcmp {} {}, {}", &self.dest, &self.predicate, &self.operand0, &self.operand1, )?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -2078,7 +2010,6 @@ pub struct Phi { pub incoming_values: Vec<(Operand, Name)>, pub dest: Name, pub to_type: TypeRef, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -2101,7 +2032,6 @@ impl Display for Phi { for (val, label) in &self.incoming_values[1 ..] { write!(f, ", [ {}, {} ]", val, label)?; } - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -2117,7 +2047,6 @@ pub struct Select { pub true_value: Operand, pub false_value: Operand, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -2140,7 +2069,6 @@ impl Display for Select { "{} = select {}, {}, {}", &self.dest, &self.condition, &self.true_value, &self.false_value, )?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -2155,7 +2083,6 @@ impl Display for Select { pub struct Freeze { pub operand: Operand, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -2178,7 +2105,6 @@ pub struct Call { pub function_attributes: Vec, // llvm-hs has the equivalent of Vec>, but I'm not sure how the GroupID option comes up pub is_tail_call: bool, // llvm-hs has the more sophisticated structure Option, but the LLVM C API just gives us true/false pub calling_convention: CallingConvention, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -2233,7 +2159,6 @@ impl Display for Call { } } write!(f, ")")?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -2248,7 +2173,6 @@ pub struct VAArg { pub arg_list: Operand, pub cur_type: TypeRef, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -2269,7 +2193,6 @@ impl Display for VAArg { "{} = va_arg {}, {}", &self.dest, &self.arg_list, &self.cur_type, )?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -2285,7 +2208,6 @@ pub struct LandingPad { pub clauses: Vec, pub dest: Name, pub cleanup: bool, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -2305,7 +2227,6 @@ impl Display for LandingPad { if self.cleanup { write!(f, " cleanup")?; } - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -2320,7 +2241,6 @@ pub struct CatchPad { pub catch_switch: Operand, pub args: Vec, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -2349,7 +2269,6 @@ impl Display for CatchPad { } } write!(f, "]")?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -2364,7 +2283,6 @@ pub struct CleanupPad { pub parent_pad: Operand, pub args: Vec, pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -2393,7 +2311,6 @@ impl Display for CleanupPad { } } write!(f, "]")?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -2729,7 +2646,6 @@ macro_rules! unop_from_llvm { func_ctx, ), dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -2759,7 +2675,6 @@ macro_rules! binop_from_llvm { func_ctx, ), dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -2793,7 +2708,6 @@ macro_rules! binop_from_llvm_with_nuw_nsw { nuw: unsafe { LLVMGetNUW(inst) } != 0, #[cfg(feature = "llvm-17-or-greater")] nsw: unsafe { LLVMGetNSW(inst) } != 0, - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -2825,7 +2739,6 @@ macro_rules! binop_from_llvm_with_exact { dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), #[cfg(feature = "llvm-17-or-greater")] exact: unsafe { LLVMGetExact(inst) } != 0, - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -2867,7 +2780,6 @@ impl ExtractElement { vector: Operand::from_llvm_ref(unsafe { LLVMGetOperand(inst, 0) }, ctx, func_ctx), index: Operand::from_llvm_ref(unsafe { LLVMGetOperand(inst, 1) }, ctx, func_ctx), dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -2886,7 +2798,6 @@ impl InsertElement { element: Operand::from_llvm_ref(unsafe { LLVMGetOperand(inst, 1) }, ctx, func_ctx), index: Operand::from_llvm_ref(unsafe { LLVMGetOperand(inst, 2) }, ctx, func_ctx), dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -2937,7 +2848,6 @@ impl ShuffleVector { } }, dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -2959,7 +2869,6 @@ impl ExtractValue { std::slice::from_raw_parts(ptr, num_indices as usize).to_vec() }, dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -2982,7 +2891,6 @@ impl InsertValue { std::slice::from_raw_parts(ptr, num_indices as usize).to_vec() }, dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -3007,7 +2915,6 @@ impl Alloca { ), dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), alignment: unsafe { LLVMGetAlignment(inst) }, - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -3039,7 +2946,6 @@ impl Load { } }, alignment: unsafe { LLVMGetAlignment(inst) }, - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -3069,7 +2975,6 @@ impl Store { } }, alignment: unsafe { LLVMGetAlignment(inst) }, - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -3084,7 +2989,6 @@ impl Fence { synch_scope: SynchronizationScope::from_llvm_ref(inst), mem_ordering: MemoryOrdering::from_llvm(unsafe { LLVMGetOrdering(inst) }), }, - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -3115,7 +3019,6 @@ impl CmpXchg { }), #[cfg(feature = "llvm-10-or-greater")] weak: unsafe { LLVMGetWeak(inst) } != 0, - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -3141,7 +3044,6 @@ impl AtomicRMW { synch_scope: SynchronizationScope::from_llvm_ref(inst), mem_ordering: MemoryOrdering::from_llvm(unsafe { LLVMGetOrdering(inst) }), }, - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -3166,7 +3068,6 @@ impl GetElementPtr { }, dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), in_bounds: unsafe { LLVMIsInBounds(inst) } != 0, - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), #[cfg(feature = "llvm-14-or-greater")] source_element_type: ctx.types.type_from_llvm_ref(unsafe { LLVMGetGEPSourceElementType(inst) }), @@ -3194,7 +3095,6 @@ macro_rules! typed_unop_from_llvm { ), to_type: ctx.types.type_from_llvm_ref(unsafe { LLVMTypeOf(inst) }), dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -3229,7 +3129,6 @@ impl ICmp { operand0: Operand::from_llvm_ref(unsafe { LLVMGetOperand(inst, 0) }, ctx, func_ctx), operand1: Operand::from_llvm_ref(unsafe { LLVMGetOperand(inst, 1) }, ctx, func_ctx), dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -3248,7 +3147,6 @@ impl FCmp { operand0: Operand::from_llvm_ref(unsafe { LLVMGetOperand(inst, 0) }, ctx, func_ctx), operand1: Operand::from_llvm_ref(unsafe { LLVMGetOperand(inst, 1) }, ctx, func_ctx), dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -3282,7 +3180,6 @@ impl Phi { }, dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), to_type: ctx.types.type_from_llvm_ref(unsafe { LLVMTypeOf(inst) }), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -3301,7 +3198,6 @@ impl Select { true_value: Operand::from_llvm_ref(unsafe { LLVMGetOperand(inst, 1) }, ctx, func_ctx), false_value: Operand::from_llvm_ref(unsafe { LLVMGetOperand(inst, 2) }, ctx, func_ctx), dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -3442,7 +3338,6 @@ impl Call { function_attributes: callinfo.function_attributes, is_tail_call: unsafe { LLVMIsTailCall(inst) } != 0, calling_convention: callinfo.calling_convention, - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -3460,7 +3355,6 @@ impl VAArg { arg_list: Operand::from_llvm_ref(unsafe { LLVMGetOperand(inst, 0) }, ctx, func_ctx), cur_type: ctx.types.type_from_llvm_ref(unsafe { LLVMTypeOf(inst) }), dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -3483,7 +3377,6 @@ impl LandingPad { }, dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), cleanup: unsafe { LLVMIsCleanup(inst) } != 0, - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -3511,7 +3404,6 @@ impl CatchPad { .collect() }, dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } @@ -3535,7 +3427,6 @@ impl CleanupPad { .collect() }, dest: Name::name_or_num(unsafe { get_value_name(inst) }, &mut func_ctx.ctr), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(inst), // metadata: InstructionMetadata::from_llvm_inst(inst), } diff --git a/src/lib.rs b/src/lib.rs index 23b15c19..41edf879 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,9 +15,7 @@ pub mod basicblock; pub use basicblock::BasicBlock; pub mod constant; pub use constant::{Constant, ConstantRef}; -#[cfg(feature = "llvm-9-or-greater")] pub mod debugloc; -#[cfg(feature = "llvm-9-or-greater")] pub use debugloc::{DebugLoc, HasDebugLoc}; pub mod function; pub use function::Function; @@ -48,7 +46,6 @@ macro_rules! case { /// Returns the LLVM version for which `llvm-ir` was configured. pub fn llvm_version() -> &'static str { - case!("llvm-8"); case!("llvm-9"); case!("llvm-10"); case!("llvm-11"); diff --git a/src/llvm_sys.rs b/src/llvm_sys.rs index 2ed8cf01..1ea4307c 100644 --- a/src/llvm_sys.rs +++ b/src/llvm_sys.rs @@ -14,8 +14,6 @@ pub use llvm_sys_150 as llvm_sys; pub use llvm_sys_160 as llvm_sys; #[cfg(feature = "llvm-17")] pub use llvm_sys_170 as llvm_sys; -#[cfg(feature = "llvm-8")] -pub use llvm_sys_80 as llvm_sys; #[cfg(feature = "llvm-9")] pub use llvm_sys_90 as llvm_sys; diff --git a/src/module.rs b/src/module.rs index 252d9f38..7904f1af 100644 --- a/src/module.rs +++ b/src/module.rs @@ -1,5 +1,4 @@ use crate::constant::ConstantRef; -#[cfg(feature = "llvm-9-or-greater")] use crate::debugloc::*; use crate::function::{Function, FunctionAttribute, FunctionDeclaration, GroupID}; use crate::llvm_sys::*; @@ -176,7 +175,6 @@ pub struct GlobalVariable { pub section: Option, pub comdat: Option, // llvm-hs-pure has Option for some reason pub alignment: u32, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: Vec<(String, MetadataRef)>, } @@ -187,7 +185,6 @@ impl Typed for GlobalVariable { } } -#[cfg(feature = "llvm-9-or-greater")] impl HasDebugLoc for GlobalVariable { fn get_debug_loc(&self) -> &Option { &self.debugloc @@ -355,7 +352,6 @@ pub struct Alignment { /// Alignment details for function pointers. /// See [LLVM 14 docs on Data Layout](https://releases.llvm.org/14.0.0/docs/LangRef.html#data-layout) -#[cfg(feature = "llvm-9-or-greater")] #[derive(Clone, PartialEq, Eq, Debug)] pub struct FunctionPtrAlignment { /// If `true`, function pointer alignment is independent of function alignment. @@ -394,10 +390,8 @@ pub struct Alignments { /// Alignment for aggregate types (structs, arrays) agg_alignment: Alignment, /// Alignment for function pointers - #[cfg(feature = "llvm-9-or-greater")] fptr_alignment: FunctionPtrAlignment, /// Alignment for function pointers, as an `Alignment` - #[cfg(feature = "llvm-9-or-greater")] fptr_alignment_as_alignment: Alignment, /// Layout details for (non-function-pointer) pointers, by address space pointer_layouts: HashMap, @@ -429,7 +423,6 @@ impl Alignments { pointee_type, addr_space, } => match pointee_type.as_ref() { - #[cfg(feature = "llvm-9-or-greater")] Type::FuncType { .. } => &self.fptr_alignment_as_alignment, _ => &self.ptr_alignment(*addr_space).alignment, }, @@ -500,7 +493,6 @@ impl Alignments { } /// Alignment of function pointers - #[cfg(feature = "llvm-9-or-greater")] pub fn fptr_alignment(&self) -> &FunctionPtrAlignment { &self.fptr_alignment } @@ -687,7 +679,6 @@ impl GlobalVariable { } }, alignment: unsafe { LLVMGetAlignment(global) }, - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_no_col(global), // metadata: unimplemented!("metadata"), } @@ -994,39 +985,25 @@ impl DataLayout { assert!(chunks.next().is_none(), "datalayout 'a': Too many chunks"); data_layout.alignments.agg_alignment = Alignment { abi, pref }; } else if let Some(stripped) = spec.strip_prefix("Fi") { - #[cfg(feature = "llvm-8-or-lower")] - { - panic!("datalayout: Unknown spec {:?}", spec); - } - #[cfg(feature = "llvm-9-or-greater")] - { - let abi: u32 = stripped - .parse() - .expect("datalayout 'Fi': Failed to parse abi"); - data_layout.alignments.fptr_alignment = FunctionPtrAlignment { - independent: true, - abi, - }; - data_layout.alignments.fptr_alignment_as_alignment = - Alignment { abi, pref: abi }; - } + let abi: u32 = stripped + .parse() + .expect("datalayout 'Fi': Failed to parse abi"); + data_layout.alignments.fptr_alignment = FunctionPtrAlignment { + independent: true, + abi, + }; + data_layout.alignments.fptr_alignment_as_alignment = + Alignment { abi, pref: abi }; } else if let Some(stripped) = spec.strip_prefix("Fn") { - #[cfg(feature = "llvm-8-or-lower")] - { - panic!("datalayout: Unknown spec {:?}", spec); - } - #[cfg(feature = "llvm-9-or-greater")] - { - let abi: u32 = stripped - .parse() - .expect("datalayout 'Fn': Failed to parse abi"); - data_layout.alignments.fptr_alignment = FunctionPtrAlignment { - independent: false, - abi, - }; - data_layout.alignments.fptr_alignment_as_alignment = - Alignment { abi, pref: abi }; - } + let abi: u32 = stripped + .parse() + .expect("datalayout 'Fn': Failed to parse abi"); + data_layout.alignments.fptr_alignment = FunctionPtrAlignment { + independent: false, + abi, + }; + data_layout.alignments.fptr_alignment_as_alignment = + Alignment { abi, pref: abi }; } else if spec.starts_with('m') { let mut chunks = spec.split(':'); let first_chunk = chunks.next().unwrap(); @@ -1129,13 +1106,11 @@ impl Default for Alignments { // Alignment for aggregate types (structs, arrays) agg_alignment: Alignment { abi: 0, pref: 64 }, // Alignment for function pointers - #[cfg(feature = "llvm-9-or-greater")] fptr_alignment: FunctionPtrAlignment { independent: true, abi: 64, }, // Alignment for function pointers, as an `Alignment` - #[cfg(feature = "llvm-9-or-greater")] fptr_alignment_as_alignment: Alignment { abi: 64, pref: 64 }, // Layout details for (non-function-pointer) pointers, by address space pointer_layouts: vec![( diff --git a/src/terminator.rs b/src/terminator.rs index 724b8359..405ef338 100644 --- a/src/terminator.rs +++ b/src/terminator.rs @@ -1,4 +1,3 @@ -#[cfg(feature = "llvm-9-or-greater")] use crate::debugloc::{DebugLoc, HasDebugLoc}; use crate::function::{CallingConvention, FunctionAttribute, ParameterAttribute}; use crate::instruction::{HasResult, InlineAssembly}; @@ -23,7 +22,6 @@ pub enum Terminator { CleanupRet(CleanupRet), CatchRet(CatchRet), CatchSwitch(CatchSwitch), - #[cfg(feature = "llvm-9-or-greater")] CallBr(CallBr), } @@ -47,13 +45,11 @@ impl Typed for Terminator { Terminator::CleanupRet(t) => types.type_of(t), Terminator::CatchRet(t) => types.type_of(t), Terminator::CatchSwitch(t) => types.type_of(t), - #[cfg(feature = "llvm-9-or-greater")] Terminator::CallBr(t) => types.type_of(t), } } } -#[cfg(feature = "llvm-9-or-greater")] impl HasDebugLoc for Terminator { fn get_debug_loc(&self) -> &Option { match self { @@ -68,7 +64,6 @@ impl HasDebugLoc for Terminator { Terminator::CleanupRet(t) => t.get_debug_loc(), Terminator::CatchRet(t) => t.get_debug_loc(), Terminator::CatchSwitch(t) => t.get_debug_loc(), - #[cfg(feature = "llvm-9-or-greater")] Terminator::CallBr(t) => t.get_debug_loc(), } } @@ -88,7 +83,6 @@ impl Display for Terminator { Terminator::CleanupRet(t) => write!(f, "{}", t), Terminator::CatchRet(t) => write!(f, "{}", t), Terminator::CatchSwitch(t) => write!(f, "{}", t), - #[cfg(feature = "llvm-9-or-greater")] Terminator::CallBr(t) => write!(f, "{}", t), } } @@ -109,7 +103,6 @@ impl Terminator { Terminator::CleanupRet(t) => &t.metadata, Terminator::CatchRet(t) => &t.metadata, Terminator::CatchSwitch(t) => &t.metadata, - #[cfg(feature="llvm-9-or-greater")] Terminator::CallBr(t) => &t.metadata, } } @@ -132,7 +125,6 @@ impl Terminator { Terminator::CleanupRet(_) => None, Terminator::CatchRet(_) => None, Terminator::CatchSwitch(t) => Some(&t.result), - #[cfg(feature = "llvm-9-or-greater")] Terminator::CallBr(t) => Some(&t.result), } } @@ -156,7 +148,6 @@ macro_rules! impl_term { } } - #[cfg(feature = "llvm-9-or-greater")] impl HasDebugLoc for $term { fn get_debug_loc(&self) -> &Option { &self.debugloc @@ -198,7 +189,6 @@ macro_rules! void_typed { pub struct Ret { /// The value being returned, or `None` if returning void. pub return_operand: Option, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -216,7 +206,6 @@ impl Display for Ret { Some(op) => format!("{}", op), }, )?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -231,7 +220,6 @@ impl Display for Ret { pub struct Br { /// The [`Name`](../enum.Name.html) of the [`BasicBlock`](../struct.BasicBlock.html) destination. pub dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -242,7 +230,6 @@ void_typed!(Br); impl Display for Br { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "br label {}", &self.dest)?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -261,7 +248,6 @@ pub struct CondBr { pub true_dest: Name, /// The [`Name`](../enum.Name.html) of the [`BasicBlock`](../struct.BasicBlock.html) destination if the `condition` is false. pub false_dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -276,7 +262,6 @@ impl Display for CondBr { "br {}, label {}, label {}", &self.condition, &self.true_dest, &self.false_dest, )?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -290,7 +275,6 @@ pub struct Switch { pub operand: Operand, pub dests: Vec<(ConstantRef, Name)>, pub default_dest: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -309,7 +293,6 @@ impl Display for Switch { write!(f, "{}, label {}; ", val, label)?; } write!(f, "]")?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -327,7 +310,6 @@ pub struct IndirectBr { /// [`BasicBlock`](../struct.BasicBlock.html)s in the current function; /// `IndirectBr` cannot be used to jump between functions. pub possible_dests: Vec, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -350,7 +332,6 @@ impl Display for IndirectBr { write!(f, ", label {}", dest)?; } write!(f, " ]")?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -371,7 +352,6 @@ pub struct Invoke { pub exception_label: Name, // Should be the name of a basic block. If the callee returns with 'resume' or another exception-handling mechanism, control flow resumes here. pub function_attributes: Vec, // llvm-hs has the equivalent of Vec>, but I'm not sure how the GroupID option comes up pub calling_convention: CallingConvention, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -426,7 +406,6 @@ impl Display for Invoke { ") to label {} unwind label {}", &self.return_label, &self.exception_label, )?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -438,7 +417,6 @@ impl Display for Invoke { #[derive(PartialEq, Clone, Debug)] pub struct Resume { pub operand: Operand, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -449,7 +427,6 @@ void_typed!(Resume); impl Display for Resume { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "resume {}", &self.operand)?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -460,7 +437,6 @@ impl Display for Resume { /// See [LLVM 14 docs on the 'unreachable' instruction](https://releases.llvm.org/14.0.0/docs/LangRef.html#unreachable-instruction) #[derive(PartialEq, Clone, Debug)] pub struct Unreachable { - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -471,7 +447,6 @@ void_typed!(Unreachable); impl Display for Unreachable { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "unreachable")?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -485,7 +460,6 @@ pub struct CleanupRet { pub cleanup_pad: Operand, /// `None` here indicates 'unwind to caller' pub unwind_dest: Option, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -504,7 +478,6 @@ impl Display for CleanupRet { Some(dest) => format!("label {}", dest), }, )?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -517,7 +490,6 @@ impl Display for CleanupRet { pub struct CatchRet { pub catch_pad: Operand, pub successor: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -532,7 +504,6 @@ impl Display for CatchRet { "catchret from {} to label {}", &self.catch_pad, &self.successor, )?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -549,7 +520,6 @@ pub struct CatchSwitch { /// `None` here indicates 'unwind to caller' pub default_unwind_dest: Option, pub result: Name, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } @@ -587,7 +557,6 @@ impl Display for CatchSwitch { Some(dest) => format!("label {}", dest), }, )?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -596,7 +565,6 @@ impl Display for CatchSwitch { } /// See [LLVM 14 docs on the 'callbr' instruction](https://releases.llvm.org/14.0.0/docs/LangRef.html#callbr-instruction) -#[cfg(feature = "llvm-9-or-greater")] #[derive(PartialEq, Clone, Debug)] pub struct CallBr { pub function: Either, @@ -608,17 +576,13 @@ pub struct CallBr { pub other_labels: (), //Vec, // Should be names of basic blocks. The callee may use an inline-asm 'goto' to resume control flow at one of these places. pub function_attributes: Vec, pub calling_convention: CallingConvention, - #[cfg(feature = "llvm-9-or-greater")] pub debugloc: Option, // --TODO not yet implemented-- pub metadata: InstructionMetadata, } -#[cfg(feature = "llvm-9-or-greater")] impl_term!(CallBr, CallBr); -#[cfg(feature = "llvm-9-or-greater")] impl_hasresult!(CallBr); -#[cfg(feature = "llvm-9-or-greater")] impl Typed for CallBr { fn get_type(&self, types: &Types) -> TypeRef { match types.type_of(&self.function).as_ref() { @@ -631,7 +595,6 @@ impl Typed for CallBr { } } -#[cfg(feature = "llvm-9-or-greater")] impl Display for CallBr { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { // Like with `Call` and `Invoke, we choose not to include all the @@ -654,7 +617,6 @@ impl Display for CallBr { } } write!(f, ") to label {}", &self.return_label)?; - #[cfg(feature = "llvm-9-or-greater")] if self.debugloc.is_some() { write!(f, " (with debugloc)")?; } @@ -715,7 +677,6 @@ impl Terminator { LLVMOpcode::LLVMCatchSwitch => { Terminator::CatchSwitch(CatchSwitch::from_llvm_ref(term, ctx, func_ctx)) }, - #[cfg(feature="llvm-9-or-greater")] LLVMOpcode::LLVMCallBr => { Terminator::CallBr(CallBr::from_llvm_ref(term, ctx, func_ctx)) }, @@ -743,7 +704,6 @@ impl Ret { )), n => panic!("Ret instruction with {} operands", n), }, - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(term), // metadata: InstructionMetadata::from_llvm_inst(term), } @@ -759,7 +719,6 @@ impl Br { .get(unsafe { &op_to_bb(LLVMGetOperand(term, 0)) }) .expect("Failed to find destination bb in map") .clone(), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(term), // metadata: InstructionMetadata::from_llvm_inst(term), } @@ -785,7 +744,6 @@ impl CondBr { .get(unsafe { &op_to_bb(LLVMGetOperand(term, 1)) }) .expect("Failed to find false-destination in bb map") .clone(), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(term), // metadata: InstructionMetadata::from_llvm_inst(term), } @@ -821,7 +779,6 @@ impl Switch { .get(unsafe { &LLVMGetSwitchDefaultDest(term) }) .expect("Failed to find switch default destination in map") .clone(), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(term), // metadata: InstructionMetadata::from_llvm_inst(term), } @@ -848,7 +805,6 @@ impl IndirectBr { }) .collect() }, - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(term), // metadata: InstructionMetadata::from_llvm_inst(term), } @@ -882,7 +838,6 @@ impl Invoke { .clone(), function_attributes: callinfo.function_attributes, calling_convention: callinfo.calling_convention, - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(term), // metadata: InstructionMetadata::from_llvm_inst(term), } @@ -898,7 +853,6 @@ impl Resume { assert_eq!(unsafe { LLVMGetNumOperands(term) }, 1); Self { operand: Operand::from_llvm_ref(unsafe { LLVMGetOperand(term, 0) }, ctx, func_ctx), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(term), // metadata: InstructionMetadata::from_llvm_inst(term), } @@ -909,7 +863,6 @@ impl Unreachable { pub(crate) fn from_llvm_ref(term: LLVMValueRef) -> Self { assert_eq!(unsafe { LLVMGetNumOperands(term) }, 0); Self { - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(term), // metadata: InstructionMetadata::from_llvm_inst(term), } @@ -945,7 +898,6 @@ impl CleanupRet { ) } }, - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(term), // metadata: InstructionMetadata::from_llvm_inst(term), } @@ -965,7 +917,6 @@ impl CatchRet { .get(unsafe { &LLVMGetSuccessor(term, 0) }) .expect("Failed to find CatchRet successor in map") .clone(), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(term), // metadata: InstructionMetadata::from_llvm_inst(term), } @@ -1011,14 +962,12 @@ impl CatchSwitch { } }, result: Name::name_or_num(unsafe { get_value_name(term) }, &mut func_ctx.ctr), - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(term), // metadata: InstructionMetadata::from_llvm_inst(term), } } } -#[cfg(feature = "llvm-9-or-greater")] impl CallBr { pub(crate) fn from_llvm_ref( term: LLVMValueRef, @@ -1040,7 +989,6 @@ impl CallBr { other_labels: (), function_attributes: callinfo.function_attributes, calling_convention: callinfo.calling_convention, - #[cfg(feature = "llvm-9-or-greater")] debugloc: DebugLoc::from_llvm_with_col(term), // metadata: InstructionMetadata::from_llvm_inst(term), } diff --git a/tests/basic_bc/llvm8/fences.ll.bc b/tests/basic_bc/llvm8/fences.ll.bc deleted file mode 100644 index d0bdb3ac..00000000 Binary files a/tests/basic_bc/llvm8/fences.ll.bc and /dev/null differ diff --git a/tests/basic_bc/llvm8/hello.bc b/tests/basic_bc/llvm8/hello.bc deleted file mode 100644 index 22eb3307..00000000 Binary files a/tests/basic_bc/llvm8/hello.bc and /dev/null differ diff --git a/tests/basic_bc/llvm8/hello.bc-g b/tests/basic_bc/llvm8/hello.bc-g deleted file mode 100644 index a57541cb..00000000 Binary files a/tests/basic_bc/llvm8/hello.bc-g and /dev/null differ diff --git a/tests/basic_bc/llvm8/hello.ll b/tests/basic_bc/llvm8/hello.ll deleted file mode 100644 index d7cb11eb..00000000 --- a/tests/basic_bc/llvm8/hello.ll +++ /dev/null @@ -1,18 +0,0 @@ -; ModuleID = 'hello.c' -source_filename = "hello.c" -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.16.0" - -; Function Attrs: norecurse nounwind readnone ssp uwtable -define i32 @main() local_unnamed_addr #0 { - ret i32 0 -} - -attributes #0 = { norecurse nounwind readnone ssp uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } - -!llvm.module.flags = !{!0, !1} -!llvm.ident = !{!2} - -!0 = !{i32 1, !"wchar_size", i32 4} -!1 = !{i32 7, !"PIC Level", i32 2} -!2 = !{!"clang version 8.0.1 (tags/RELEASE_801/final)"} diff --git a/tests/basic_bc/llvm8/hello.ll-g b/tests/basic_bc/llvm8/hello.ll-g deleted file mode 100644 index 205f7014..00000000 --- a/tests/basic_bc/llvm8/hello.ll-g +++ /dev/null @@ -1,29 +0,0 @@ -; ModuleID = 'hello.c' -source_filename = "hello.c" -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.16.0" - -; Function Attrs: norecurse nounwind readnone ssp uwtable -define i32 @main() local_unnamed_addr #0 !dbg !8 { - ret i32 0, !dbg !12 -} - -attributes #0 = { norecurse nounwind readnone ssp uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!3, !4, !5, !6} -!llvm.ident = !{!7} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 8.0.1 (tags/RELEASE_801/final)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: GNU) -!1 = !DIFile(filename: "hello.c", directory: "/Users/craig/llvm-ir/tests/basic_bc") -!2 = !{} -!3 = !{i32 2, !"Dwarf Version", i32 4} -!4 = !{i32 2, !"Debug Info Version", i32 3} -!5 = !{i32 1, !"wchar_size", i32 4} -!6 = !{i32 7, !"PIC Level", i32 2} -!7 = !{!"clang version 8.0.1 (tags/RELEASE_801/final)"} -!8 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 3, type: !9, scopeLine: 3, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) -!9 = !DISubroutineType(types: !10) -!10 = !{!11} -!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -!12 = !DILocation(line: 4, column: 3, scope: !8) diff --git a/tests/basic_bc/llvm8/issue_4.bc b/tests/basic_bc/llvm8/issue_4.bc deleted file mode 100644 index d1f54301..00000000 Binary files a/tests/basic_bc/llvm8/issue_4.bc and /dev/null differ diff --git a/tests/basic_bc/llvm8/issue_4.ll b/tests/basic_bc/llvm8/issue_4.ll deleted file mode 100644 index 5950742f..00000000 --- a/tests/basic_bc/llvm8/issue_4.ll +++ /dev/null @@ -1,28 +0,0 @@ -; ModuleID = 'issue_4.c' -source_filename = "issue_4.c" -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.16.0" - -%struct.output = type { double, double, double } - -; Function Attrs: norecurse nounwind ssp uwtable writeonly -define void @run(%struct.output* noalias nocapture sret, float) local_unnamed_addr #0 { - %3 = fpext float %1 to double - %4 = getelementptr inbounds %struct.output, %struct.output* %0, i64 0, i32 0 - store double %3, double* %4, align 8, !tbaa !3 - ret void -} - -attributes #0 = { norecurse nounwind ssp uwtable writeonly "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } - -!llvm.module.flags = !{!0, !1} -!llvm.ident = !{!2} - -!0 = !{i32 1, !"wchar_size", i32 4} -!1 = !{i32 7, !"PIC Level", i32 2} -!2 = !{!"clang version 8.0.1 (tags/RELEASE_801/final)"} -!3 = !{!4, !5, i64 0} -!4 = !{!"output", !5, i64 0, !5, i64 8, !5, i64 16} -!5 = !{!"double", !6, i64 0} -!6 = !{!"omnipotent char", !7, i64 0} -!7 = !{!"Simple C/C++ TBAA"} diff --git a/tests/basic_bc/llvm8/linkedlist.bc b/tests/basic_bc/llvm8/linkedlist.bc deleted file mode 100644 index 3b1a89eb..00000000 Binary files a/tests/basic_bc/llvm8/linkedlist.bc and /dev/null differ diff --git a/tests/basic_bc/llvm8/linkedlist.bc-g b/tests/basic_bc/llvm8/linkedlist.bc-g deleted file mode 100644 index 03e68f9d..00000000 Binary files a/tests/basic_bc/llvm8/linkedlist.bc-g and /dev/null differ diff --git a/tests/basic_bc/llvm8/linkedlist.ll b/tests/basic_bc/llvm8/linkedlist.ll deleted file mode 100644 index 0a7aa10f..00000000 --- a/tests/basic_bc/llvm8/linkedlist.ll +++ /dev/null @@ -1,154 +0,0 @@ -; ModuleID = 'linkedlist.c' -source_filename = "linkedlist.c" -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.16.0" - -%struct.SimpleLinkedList = type { i32, %struct.SimpleLinkedList* } -%struct.NodeA = type { i32, %struct.NodeB* } -%struct.NodeB = type { i32, %struct.NodeA* } -%struct.SomeOpaqueStruct = type opaque - -; Function Attrs: noinline nounwind optnone ssp uwtable -define i32 @simple_linked_list(i32) #0 { - %2 = alloca i32, align 4 - %3 = alloca %struct.SimpleLinkedList, align 8 - %4 = alloca %struct.SimpleLinkedList, align 8 - %5 = alloca %struct.SimpleLinkedList, align 8 - %6 = alloca %struct.SimpleLinkedList, align 8 - %7 = alloca %struct.SimpleLinkedList, align 8 - store i32 %0, i32* %2, align 4 - %8 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %3, i32 0, i32 0 - %9 = load i32, i32* %2, align 4 - store i32 %9, i32* %8, align 8 - %10 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %3, i32 0, i32 1 - store %struct.SimpleLinkedList* null, %struct.SimpleLinkedList** %10, align 8 - %11 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %3, i32 0, i32 0 - %12 = load i32, i32* %11, align 8 - %13 = add nsw i32 %12, 2 - store i32 %13, i32* %11, align 8 - %14 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %4, i32 0, i32 0 - %15 = load i32, i32* %2, align 4 - %16 = sub nsw i32 %15, 3 - store i32 %16, i32* %14, align 8 - %17 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %4, i32 0, i32 1 - store %struct.SimpleLinkedList* null, %struct.SimpleLinkedList** %17, align 8 - %18 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %5, i32 0, i32 0 - %19 = load i32, i32* %2, align 4 - %20 = mul nsw i32 %19, 5 - store i32 %20, i32* %18, align 8 - %21 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %5, i32 0, i32 1 - store %struct.SimpleLinkedList* null, %struct.SimpleLinkedList** %21, align 8 - %22 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %6, i32 0, i32 0 - %23 = load i32, i32* %2, align 4 - %24 = sdiv i32 %23, 2 - store i32 %24, i32* %22, align 8 - %25 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %6, i32 0, i32 1 - store %struct.SimpleLinkedList* null, %struct.SimpleLinkedList** %25, align 8 - %26 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %7, i32 0, i32 0 - %27 = load i32, i32* %2, align 4 - %28 = sdiv i32 %27, 100 - store i32 %28, i32* %26, align 8 - %29 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %7, i32 0, i32 1 - store %struct.SimpleLinkedList* null, %struct.SimpleLinkedList** %29, align 8 - %30 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %3, i32 0, i32 1 - store %struct.SimpleLinkedList* %4, %struct.SimpleLinkedList** %30, align 8 - %31 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %4, i32 0, i32 1 - store %struct.SimpleLinkedList* %5, %struct.SimpleLinkedList** %31, align 8 - %32 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %5, i32 0, i32 1 - store %struct.SimpleLinkedList* %6, %struct.SimpleLinkedList** %32, align 8 - %33 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %6, i32 0, i32 1 - store %struct.SimpleLinkedList* %7, %struct.SimpleLinkedList** %33, align 8 - %34 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %7, i32 0, i32 1 - store %struct.SimpleLinkedList* %3, %struct.SimpleLinkedList** %34, align 8 - %35 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %3, i32 0, i32 1 - %36 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %35, align 8 - %37 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %36, i32 0, i32 1 - %38 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %37, align 8 - %39 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %38, i32 0, i32 1 - %40 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %39, align 8 - %41 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %40, i32 0, i32 1 - %42 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %41, align 8 - %43 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %42, i32 0, i32 1 - %44 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %43, align 8 - %45 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %44, i32 0, i32 1 - %46 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %45, align 8 - %47 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %46, i32 0, i32 1 - %48 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %47, align 8 - %49 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %48, i32 0, i32 1 - %50 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %49, align 8 - %51 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %50, i32 0, i32 1 - %52 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %51, align 8 - %53 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %52, i32 0, i32 1 - %54 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %53, align 8 - %55 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %54, i32 0, i32 0 - %56 = load i32, i32* %55, align 8 - ret i32 %56 -} - -; Function Attrs: noinline nounwind optnone ssp uwtable -define i32 @indirectly_recursive_type(i32) #0 { - %2 = alloca i32, align 4 - %3 = alloca %struct.NodeA, align 8 - %4 = alloca %struct.NodeB, align 8 - %5 = alloca %struct.NodeA, align 8 - store i32 %0, i32* %2, align 4 - %6 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %3, i32 0, i32 0 - %7 = load i32, i32* %2, align 4 - store i32 %7, i32* %6, align 8 - %8 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %3, i32 0, i32 1 - store %struct.NodeB* null, %struct.NodeB** %8, align 8 - %9 = getelementptr inbounds %struct.NodeB, %struct.NodeB* %4, i32 0, i32 0 - %10 = load i32, i32* %2, align 4 - %11 = add nsw i32 %10, 3 - store i32 %11, i32* %9, align 8 - %12 = getelementptr inbounds %struct.NodeB, %struct.NodeB* %4, i32 0, i32 1 - store %struct.NodeA* null, %struct.NodeA** %12, align 8 - %13 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %5, i32 0, i32 0 - %14 = load i32, i32* %2, align 4 - %15 = sdiv i32 %14, 4 - store i32 %15, i32* %13, align 8 - %16 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %5, i32 0, i32 1 - store %struct.NodeB* null, %struct.NodeB** %16, align 8 - %17 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %3, i32 0, i32 1 - store %struct.NodeB* %4, %struct.NodeB** %17, align 8 - %18 = getelementptr inbounds %struct.NodeB, %struct.NodeB* %4, i32 0, i32 1 - store %struct.NodeA* %5, %struct.NodeA** %18, align 8 - %19 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %5, i32 0, i32 1 - store %struct.NodeB* %4, %struct.NodeB** %19, align 8 - %20 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %3, i32 0, i32 1 - %21 = load %struct.NodeB*, %struct.NodeB** %20, align 8 - %22 = getelementptr inbounds %struct.NodeB, %struct.NodeB* %21, i32 0, i32 1 - %23 = load %struct.NodeA*, %struct.NodeA** %22, align 8 - %24 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %23, i32 0, i32 1 - %25 = load %struct.NodeB*, %struct.NodeB** %24, align 8 - %26 = getelementptr inbounds %struct.NodeB, %struct.NodeB* %25, i32 0, i32 1 - %27 = load %struct.NodeA*, %struct.NodeA** %26, align 8 - %28 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %27, i32 0, i32 1 - %29 = load %struct.NodeB*, %struct.NodeB** %28, align 8 - %30 = getelementptr inbounds %struct.NodeB, %struct.NodeB* %29, i32 0, i32 1 - %31 = load %struct.NodeA*, %struct.NodeA** %30, align 8 - %32 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %31, i32 0, i32 1 - %33 = load %struct.NodeB*, %struct.NodeB** %32, align 8 - %34 = getelementptr inbounds %struct.NodeB, %struct.NodeB* %33, i32 0, i32 0 - %35 = load i32, i32* %34, align 8 - ret i32 %35 -} - -; Function Attrs: noinline nounwind optnone ssp uwtable -define i32 @takes_opaque_struct(%struct.SomeOpaqueStruct*) #0 { - %2 = alloca %struct.SomeOpaqueStruct*, align 8 - store %struct.SomeOpaqueStruct* %0, %struct.SomeOpaqueStruct** %2, align 8 - %3 = load %struct.SomeOpaqueStruct*, %struct.SomeOpaqueStruct** %2, align 8 - %4 = icmp ne %struct.SomeOpaqueStruct* %3, null - %5 = zext i1 %4 to i32 - ret i32 %5 -} - -attributes #0 = { noinline nounwind optnone ssp uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } - -!llvm.module.flags = !{!0, !1} -!llvm.ident = !{!2} - -!0 = !{i32 1, !"wchar_size", i32 4} -!1 = !{i32 7, !"PIC Level", i32 2} -!2 = !{!"clang version 8.0.1 (tags/RELEASE_801/final)"} diff --git a/tests/basic_bc/llvm8/linkedlist.ll-g b/tests/basic_bc/llvm8/linkedlist.ll-g deleted file mode 100644 index b9ed21fd..00000000 --- a/tests/basic_bc/llvm8/linkedlist.ll-g +++ /dev/null @@ -1,288 +0,0 @@ -; ModuleID = 'linkedlist.c' -source_filename = "linkedlist.c" -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.16.0" - -%struct.SimpleLinkedList = type { i32, %struct.SimpleLinkedList* } -%struct.NodeA = type { i32, %struct.NodeB* } -%struct.NodeB = type { i32, %struct.NodeA* } -%struct.SomeOpaqueStruct = type opaque - -; Function Attrs: noinline nounwind optnone ssp uwtable -define i32 @simple_linked_list(i32) #0 !dbg !10 { - %2 = alloca i32, align 4 - %3 = alloca %struct.SimpleLinkedList, align 8 - %4 = alloca %struct.SimpleLinkedList, align 8 - %5 = alloca %struct.SimpleLinkedList, align 8 - %6 = alloca %struct.SimpleLinkedList, align 8 - %7 = alloca %struct.SimpleLinkedList, align 8 - store i32 %0, i32* %2, align 4 - call void @llvm.dbg.declare(metadata i32* %2, metadata !14, metadata !DIExpression()), !dbg !15 - call void @llvm.dbg.declare(metadata %struct.SimpleLinkedList* %3, metadata !16, metadata !DIExpression()), !dbg !22 - %8 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %3, i32 0, i32 0, !dbg !23 - %9 = load i32, i32* %2, align 4, !dbg !24 - store i32 %9, i32* %8, align 8, !dbg !23 - %10 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %3, i32 0, i32 1, !dbg !23 - store %struct.SimpleLinkedList* null, %struct.SimpleLinkedList** %10, align 8, !dbg !23 - %11 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %3, i32 0, i32 0, !dbg !25 - %12 = load i32, i32* %11, align 8, !dbg !26 - %13 = add nsw i32 %12, 2, !dbg !26 - store i32 %13, i32* %11, align 8, !dbg !26 - call void @llvm.dbg.declare(metadata %struct.SimpleLinkedList* %4, metadata !27, metadata !DIExpression()), !dbg !28 - %14 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %4, i32 0, i32 0, !dbg !29 - %15 = load i32, i32* %2, align 4, !dbg !30 - %16 = sub nsw i32 %15, 3, !dbg !31 - store i32 %16, i32* %14, align 8, !dbg !29 - %17 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %4, i32 0, i32 1, !dbg !29 - store %struct.SimpleLinkedList* null, %struct.SimpleLinkedList** %17, align 8, !dbg !29 - call void @llvm.dbg.declare(metadata %struct.SimpleLinkedList* %5, metadata !32, metadata !DIExpression()), !dbg !33 - %18 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %5, i32 0, i32 0, !dbg !34 - %19 = load i32, i32* %2, align 4, !dbg !35 - %20 = mul nsw i32 %19, 5, !dbg !36 - store i32 %20, i32* %18, align 8, !dbg !34 - %21 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %5, i32 0, i32 1, !dbg !34 - store %struct.SimpleLinkedList* null, %struct.SimpleLinkedList** %21, align 8, !dbg !34 - call void @llvm.dbg.declare(metadata %struct.SimpleLinkedList* %6, metadata !37, metadata !DIExpression()), !dbg !38 - %22 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %6, i32 0, i32 0, !dbg !39 - %23 = load i32, i32* %2, align 4, !dbg !40 - %24 = sdiv i32 %23, 2, !dbg !41 - store i32 %24, i32* %22, align 8, !dbg !39 - %25 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %6, i32 0, i32 1, !dbg !39 - store %struct.SimpleLinkedList* null, %struct.SimpleLinkedList** %25, align 8, !dbg !39 - call void @llvm.dbg.declare(metadata %struct.SimpleLinkedList* %7, metadata !42, metadata !DIExpression()), !dbg !43 - %26 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %7, i32 0, i32 0, !dbg !44 - %27 = load i32, i32* %2, align 4, !dbg !45 - %28 = sdiv i32 %27, 100, !dbg !46 - store i32 %28, i32* %26, align 8, !dbg !44 - %29 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %7, i32 0, i32 1, !dbg !44 - store %struct.SimpleLinkedList* null, %struct.SimpleLinkedList** %29, align 8, !dbg !44 - %30 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %3, i32 0, i32 1, !dbg !47 - store %struct.SimpleLinkedList* %4, %struct.SimpleLinkedList** %30, align 8, !dbg !48 - %31 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %4, i32 0, i32 1, !dbg !49 - store %struct.SimpleLinkedList* %5, %struct.SimpleLinkedList** %31, align 8, !dbg !50 - %32 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %5, i32 0, i32 1, !dbg !51 - store %struct.SimpleLinkedList* %6, %struct.SimpleLinkedList** %32, align 8, !dbg !52 - %33 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %6, i32 0, i32 1, !dbg !53 - store %struct.SimpleLinkedList* %7, %struct.SimpleLinkedList** %33, align 8, !dbg !54 - %34 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %7, i32 0, i32 1, !dbg !55 - store %struct.SimpleLinkedList* %3, %struct.SimpleLinkedList** %34, align 8, !dbg !56 - %35 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %3, i32 0, i32 1, !dbg !57 - %36 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %35, align 8, !dbg !57 - %37 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %36, i32 0, i32 1, !dbg !58 - %38 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %37, align 8, !dbg !58 - %39 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %38, i32 0, i32 1, !dbg !59 - %40 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %39, align 8, !dbg !59 - %41 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %40, i32 0, i32 1, !dbg !60 - %42 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %41, align 8, !dbg !60 - %43 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %42, i32 0, i32 1, !dbg !61 - %44 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %43, align 8, !dbg !61 - %45 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %44, i32 0, i32 1, !dbg !62 - %46 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %45, align 8, !dbg !62 - %47 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %46, i32 0, i32 1, !dbg !63 - %48 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %47, align 8, !dbg !63 - %49 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %48, i32 0, i32 1, !dbg !64 - %50 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %49, align 8, !dbg !64 - %51 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %50, i32 0, i32 1, !dbg !65 - %52 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %51, align 8, !dbg !65 - %53 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %52, i32 0, i32 1, !dbg !66 - %54 = load %struct.SimpleLinkedList*, %struct.SimpleLinkedList** %53, align 8, !dbg !66 - %55 = getelementptr inbounds %struct.SimpleLinkedList, %struct.SimpleLinkedList* %54, i32 0, i32 0, !dbg !67 - %56 = load i32, i32* %55, align 8, !dbg !67 - ret i32 %56, !dbg !68 -} - -; Function Attrs: nounwind readnone speculatable -declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 - -; Function Attrs: noinline nounwind optnone ssp uwtable -define i32 @indirectly_recursive_type(i32) #0 !dbg !69 { - %2 = alloca i32, align 4 - %3 = alloca %struct.NodeA, align 8 - %4 = alloca %struct.NodeB, align 8 - %5 = alloca %struct.NodeA, align 8 - store i32 %0, i32* %2, align 4 - call void @llvm.dbg.declare(metadata i32* %2, metadata !70, metadata !DIExpression()), !dbg !71 - call void @llvm.dbg.declare(metadata %struct.NodeA* %3, metadata !72, metadata !DIExpression()), !dbg !83 - %6 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %3, i32 0, i32 0, !dbg !84 - %7 = load i32, i32* %2, align 4, !dbg !85 - store i32 %7, i32* %6, align 8, !dbg !84 - %8 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %3, i32 0, i32 1, !dbg !84 - store %struct.NodeB* null, %struct.NodeB** %8, align 8, !dbg !84 - call void @llvm.dbg.declare(metadata %struct.NodeB* %4, metadata !86, metadata !DIExpression()), !dbg !87 - %9 = getelementptr inbounds %struct.NodeB, %struct.NodeB* %4, i32 0, i32 0, !dbg !88 - %10 = load i32, i32* %2, align 4, !dbg !89 - %11 = add nsw i32 %10, 3, !dbg !90 - store i32 %11, i32* %9, align 8, !dbg !88 - %12 = getelementptr inbounds %struct.NodeB, %struct.NodeB* %4, i32 0, i32 1, !dbg !88 - store %struct.NodeA* null, %struct.NodeA** %12, align 8, !dbg !88 - call void @llvm.dbg.declare(metadata %struct.NodeA* %5, metadata !91, metadata !DIExpression()), !dbg !92 - %13 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %5, i32 0, i32 0, !dbg !93 - %14 = load i32, i32* %2, align 4, !dbg !94 - %15 = sdiv i32 %14, 4, !dbg !95 - store i32 %15, i32* %13, align 8, !dbg !93 - %16 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %5, i32 0, i32 1, !dbg !93 - store %struct.NodeB* null, %struct.NodeB** %16, align 8, !dbg !93 - %17 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %3, i32 0, i32 1, !dbg !96 - store %struct.NodeB* %4, %struct.NodeB** %17, align 8, !dbg !97 - %18 = getelementptr inbounds %struct.NodeB, %struct.NodeB* %4, i32 0, i32 1, !dbg !98 - store %struct.NodeA* %5, %struct.NodeA** %18, align 8, !dbg !99 - %19 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %5, i32 0, i32 1, !dbg !100 - store %struct.NodeB* %4, %struct.NodeB** %19, align 8, !dbg !101 - %20 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %3, i32 0, i32 1, !dbg !102 - %21 = load %struct.NodeB*, %struct.NodeB** %20, align 8, !dbg !102 - %22 = getelementptr inbounds %struct.NodeB, %struct.NodeB* %21, i32 0, i32 1, !dbg !103 - %23 = load %struct.NodeA*, %struct.NodeA** %22, align 8, !dbg !103 - %24 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %23, i32 0, i32 1, !dbg !104 - %25 = load %struct.NodeB*, %struct.NodeB** %24, align 8, !dbg !104 - %26 = getelementptr inbounds %struct.NodeB, %struct.NodeB* %25, i32 0, i32 1, !dbg !105 - %27 = load %struct.NodeA*, %struct.NodeA** %26, align 8, !dbg !105 - %28 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %27, i32 0, i32 1, !dbg !106 - %29 = load %struct.NodeB*, %struct.NodeB** %28, align 8, !dbg !106 - %30 = getelementptr inbounds %struct.NodeB, %struct.NodeB* %29, i32 0, i32 1, !dbg !107 - %31 = load %struct.NodeA*, %struct.NodeA** %30, align 8, !dbg !107 - %32 = getelementptr inbounds %struct.NodeA, %struct.NodeA* %31, i32 0, i32 1, !dbg !108 - %33 = load %struct.NodeB*, %struct.NodeB** %32, align 8, !dbg !108 - %34 = getelementptr inbounds %struct.NodeB, %struct.NodeB* %33, i32 0, i32 0, !dbg !109 - %35 = load i32, i32* %34, align 8, !dbg !109 - ret i32 %35, !dbg !110 -} - -; Function Attrs: noinline nounwind optnone ssp uwtable -define i32 @takes_opaque_struct(%struct.SomeOpaqueStruct*) #0 !dbg !111 { - %2 = alloca %struct.SomeOpaqueStruct*, align 8 - store %struct.SomeOpaqueStruct* %0, %struct.SomeOpaqueStruct** %2, align 8 - call void @llvm.dbg.declare(metadata %struct.SomeOpaqueStruct** %2, metadata !116, metadata !DIExpression()), !dbg !117 - %3 = load %struct.SomeOpaqueStruct*, %struct.SomeOpaqueStruct** %2, align 8, !dbg !118 - %4 = icmp ne %struct.SomeOpaqueStruct* %3, null, !dbg !119 - %5 = zext i1 %4 to i32, !dbg !119 - ret i32 %5, !dbg !120 -} - -attributes #0 = { noinline nounwind optnone ssp uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind readnone speculatable } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!5, !6, !7, !8} -!llvm.ident = !{!9} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 8.0.1 (tags/RELEASE_801/final)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: GNU) -!1 = !DIFile(filename: "linkedlist.c", directory: "/Users/craig/llvm-ir/tests/basic_bc") -!2 = !{} -!3 = !{!4} -!4 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -!5 = !{i32 2, !"Dwarf Version", i32 4} -!6 = !{i32 2, !"Debug Info Version", i32 3} -!7 = !{i32 1, !"wchar_size", i32 4} -!8 = !{i32 7, !"PIC Level", i32 2} -!9 = !{!"clang version 8.0.1 (tags/RELEASE_801/final)"} -!10 = distinct !DISubprogram(name: "simple_linked_list", scope: !1, file: !1, line: 8, type: !11, scopeLine: 8, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) -!11 = !DISubroutineType(types: !12) -!12 = !{!13, !13} -!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -!14 = !DILocalVariable(name: "x", arg: 1, scope: !10, file: !1, line: 8, type: !13) -!15 = !DILocation(line: 8, column: 28, scope: !10) -!16 = !DILocalVariable(name: "list", scope: !10, file: !1, line: 9, type: !17) -!17 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "SimpleLinkedList", file: !1, line: 3, size: 128, elements: !18) -!18 = !{!19, !20} -!19 = !DIDerivedType(tag: DW_TAG_member, name: "val", scope: !17, file: !1, line: 4, baseType: !13, size: 32) -!20 = !DIDerivedType(tag: DW_TAG_member, name: "next", scope: !17, file: !1, line: 5, baseType: !21, size: 64, offset: 64) -!21 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !17, size: 64) -!22 = !DILocation(line: 9, column: 27, scope: !10) -!23 = !DILocation(line: 9, column: 34, scope: !10) -!24 = !DILocation(line: 9, column: 36, scope: !10) -!25 = !DILocation(line: 10, column: 8, scope: !10) -!26 = !DILocation(line: 10, column: 12, scope: !10) -!27 = !DILocalVariable(name: "list_1", scope: !10, file: !1, line: 11, type: !17) -!28 = !DILocation(line: 11, column: 27, scope: !10) -!29 = !DILocation(line: 11, column: 36, scope: !10) -!30 = !DILocation(line: 11, column: 38, scope: !10) -!31 = !DILocation(line: 11, column: 40, scope: !10) -!32 = !DILocalVariable(name: "list_2", scope: !10, file: !1, line: 12, type: !17) -!33 = !DILocation(line: 12, column: 27, scope: !10) -!34 = !DILocation(line: 12, column: 36, scope: !10) -!35 = !DILocation(line: 12, column: 38, scope: !10) -!36 = !DILocation(line: 12, column: 40, scope: !10) -!37 = !DILocalVariable(name: "list_3", scope: !10, file: !1, line: 13, type: !17) -!38 = !DILocation(line: 13, column: 27, scope: !10) -!39 = !DILocation(line: 13, column: 36, scope: !10) -!40 = !DILocation(line: 13, column: 38, scope: !10) -!41 = !DILocation(line: 13, column: 40, scope: !10) -!42 = !DILocalVariable(name: "list_4", scope: !10, file: !1, line: 14, type: !17) -!43 = !DILocation(line: 14, column: 27, scope: !10) -!44 = !DILocation(line: 14, column: 36, scope: !10) -!45 = !DILocation(line: 14, column: 38, scope: !10) -!46 = !DILocation(line: 14, column: 40, scope: !10) -!47 = !DILocation(line: 15, column: 8, scope: !10) -!48 = !DILocation(line: 15, column: 13, scope: !10) -!49 = !DILocation(line: 16, column: 10, scope: !10) -!50 = !DILocation(line: 16, column: 15, scope: !10) -!51 = !DILocation(line: 17, column: 10, scope: !10) -!52 = !DILocation(line: 17, column: 15, scope: !10) -!53 = !DILocation(line: 18, column: 10, scope: !10) -!54 = !DILocation(line: 18, column: 15, scope: !10) -!55 = !DILocation(line: 19, column: 10, scope: !10) -!56 = !DILocation(line: 19, column: 15, scope: !10) -!57 = !DILocation(line: 20, column: 15, scope: !10) -!58 = !DILocation(line: 20, column: 21, scope: !10) -!59 = !DILocation(line: 20, column: 27, scope: !10) -!60 = !DILocation(line: 20, column: 33, scope: !10) -!61 = !DILocation(line: 20, column: 39, scope: !10) -!62 = !DILocation(line: 20, column: 45, scope: !10) -!63 = !DILocation(line: 20, column: 51, scope: !10) -!64 = !DILocation(line: 20, column: 57, scope: !10) -!65 = !DILocation(line: 20, column: 63, scope: !10) -!66 = !DILocation(line: 20, column: 69, scope: !10) -!67 = !DILocation(line: 20, column: 75, scope: !10) -!68 = !DILocation(line: 20, column: 3, scope: !10) -!69 = distinct !DISubprogram(name: "indirectly_recursive_type", scope: !1, file: !1, line: 35, type: !11, scopeLine: 35, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) -!70 = !DILocalVariable(name: "x", arg: 1, scope: !69, file: !1, line: 35, type: !13) -!71 = !DILocation(line: 35, column: 35, scope: !69) -!72 = !DILocalVariable(name: "a", scope: !69, file: !1, line: 36, type: !73) -!73 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "NodeA", file: !1, line: 25, size: 128, elements: !74) -!74 = !{!75, !76} -!75 = !DIDerivedType(tag: DW_TAG_member, name: "val", scope: !73, file: !1, line: 26, baseType: !13, size: 32) -!76 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !73, file: !1, line: 27, baseType: !77, size: 64, offset: 64) -!77 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !78, size: 64) -!78 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "NodeB", file: !1, line: 30, size: 128, elements: !79) -!79 = !{!80, !81} -!80 = !DIDerivedType(tag: DW_TAG_member, name: "val", scope: !78, file: !1, line: 31, baseType: !13, size: 32) -!81 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !78, file: !1, line: 32, baseType: !82, size: 64, offset: 64) -!82 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !73, size: 64) -!83 = !DILocation(line: 36, column: 16, scope: !69) -!84 = !DILocation(line: 36, column: 20, scope: !69) -!85 = !DILocation(line: 36, column: 22, scope: !69) -!86 = !DILocalVariable(name: "b", scope: !69, file: !1, line: 37, type: !78) -!87 = !DILocation(line: 37, column: 16, scope: !69) -!88 = !DILocation(line: 37, column: 20, scope: !69) -!89 = !DILocation(line: 37, column: 22, scope: !69) -!90 = !DILocation(line: 37, column: 24, scope: !69) -!91 = !DILocalVariable(name: "a_1", scope: !69, file: !1, line: 38, type: !73) -!92 = !DILocation(line: 38, column: 16, scope: !69) -!93 = !DILocation(line: 38, column: 22, scope: !69) -!94 = !DILocation(line: 38, column: 24, scope: !69) -!95 = !DILocation(line: 38, column: 26, scope: !69) -!96 = !DILocation(line: 39, column: 5, scope: !69) -!97 = !DILocation(line: 39, column: 7, scope: !69) -!98 = !DILocation(line: 40, column: 5, scope: !69) -!99 = !DILocation(line: 40, column: 7, scope: !69) -!100 = !DILocation(line: 41, column: 7, scope: !69) -!101 = !DILocation(line: 41, column: 9, scope: !69) -!102 = !DILocation(line: 42, column: 12, scope: !69) -!103 = !DILocation(line: 42, column: 15, scope: !69) -!104 = !DILocation(line: 42, column: 18, scope: !69) -!105 = !DILocation(line: 42, column: 21, scope: !69) -!106 = !DILocation(line: 42, column: 24, scope: !69) -!107 = !DILocation(line: 42, column: 27, scope: !69) -!108 = !DILocation(line: 42, column: 30, scope: !69) -!109 = !DILocation(line: 42, column: 33, scope: !69) -!110 = !DILocation(line: 42, column: 3, scope: !69) -!111 = distinct !DISubprogram(name: "takes_opaque_struct", scope: !1, file: !1, line: 48, type: !112, scopeLine: 48, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) -!112 = !DISubroutineType(types: !113) -!113 = !{!13, !114} -!114 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !115, size: 64) -!115 = !DICompositeType(tag: DW_TAG_structure_type, name: "SomeOpaqueStruct", file: !1, line: 46, flags: DIFlagFwdDecl) -!116 = !DILocalVariable(name: "s", arg: 1, scope: !111, file: !1, line: 48, type: !114) -!117 = !DILocation(line: 48, column: 50, scope: !111) -!118 = !DILocation(line: 49, column: 10, scope: !111) -!119 = !DILocation(line: 49, column: 12, scope: !111) -!120 = !DILocation(line: 49, column: 3, scope: !111) diff --git a/tests/basic_bc/llvm8/loop.bc b/tests/basic_bc/llvm8/loop.bc deleted file mode 100644 index eb76f134..00000000 Binary files a/tests/basic_bc/llvm8/loop.bc and /dev/null differ diff --git a/tests/basic_bc/llvm8/loop.ll b/tests/basic_bc/llvm8/loop.ll deleted file mode 100644 index 907f1be6..00000000 --- a/tests/basic_bc/llvm8/loop.ll +++ /dev/null @@ -1,68 +0,0 @@ -; ModuleID = 'loop.c' -source_filename = "loop.c" -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.16.0" - -; Function Attrs: nounwind ssp uwtable -define void @loop(i32, i32) local_unnamed_addr #0 { - %3 = alloca [10 x i32], align 16 - %4 = bitcast [10 x i32]* %3 to i8* - call void @llvm.lifetime.start.p0i8(i64 40, i8* nonnull %4) #2 - call void @llvm.memset.p0i8.i64(i8* nonnull align 16 %4, i8 0, i64 40, i1 true) - %5 = add i32 %1, -1 - %6 = icmp ult i32 %5, 10 - br i1 %6, label %7, label %22 - -;