llvm_ir/
lib.rs

1// this ensures that crate users generating docs with --no-deps will still
2// properly get links to the public docs for llvm-ir's types
3// it was especially necessary when the docs.rs docs weren't working for any
4// llvm-sys consumers; now that we have docs.rs as the official docs, I'm not
5// sure if this is necessary or helpful anymore
6#![doc(html_root_url = "https://docs.rs/llvm-ir/0.8.2")]
7
8#[macro_use]
9mod from_llvm;
10mod iterators;
11#[rustfmt::skip]
12mod llvm_sys;
13
14pub mod basicblock;
15pub use basicblock::BasicBlock;
16pub mod constant;
17pub use constant::{Constant, ConstantRef};
18pub mod debugloc;
19pub use debugloc::{DebugLoc, HasDebugLoc};
20pub mod function;
21pub use function::Function;
22pub mod instruction;
23pub use instruction::Instruction;
24// pub mod metadata;
25// pub use metadata::Metadata;
26pub mod module;
27pub use module::Module;
28pub mod name;
29pub use name::Name;
30pub mod operand;
31pub use operand::Operand;
32pub mod predicates;
33pub use predicates::{FPPredicate, IntPredicate};
34pub mod terminator;
35pub use terminator::Terminator;
36pub mod types;
37pub use types::{Type, TypeRef};
38
39macro_rules! case {
40    ($feature:expr) => {
41        if cfg!(feature = $feature) {
42            return $feature.strip_prefix("llvm-").unwrap();
43        }
44    };
45}
46
47/// Returns the LLVM version for which `llvm-ir` was configured.
48pub fn llvm_version() -> &'static str {
49    case!("llvm-9");
50    case!("llvm-10");
51    case!("llvm-11");
52    case!("llvm-12");
53    case!("llvm-13");
54    case!("llvm-14");
55    case!("llvm-15");
56    case!("llvm-16");
57    case!("llvm-17");
58    case!("llvm-18");
59    case!("llvm-19");
60    unreachable!()
61}