about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2014-07-07 17:58:01 -0700
committerBrian Anderson <banderson@mozilla.com>2014-07-14 12:27:08 -0700
commit3096d9bf946d2e3e74b24dbb4a5d116a5d9ac7c7 (patch)
treed9536701aff1242ac137fb58d769885b72f0f3e7
parent8e2e15f163fa696aaeae658c84bdcb95bd67432a (diff)
downloadrust-3096d9bf946d2e3e74b24dbb4a5d116a5d9ac7c7.tar.gz
rust-3096d9bf946d2e3e74b24dbb4a5d116a5d9ac7c7.zip
rustc_llvm: Remove the inner llvm module
This makes it much saner for clients to use the library since
they don't have to worry about shadowing one llvm with another.
-rw-r--r--src/librustc/back/link.rs114
-rw-r--r--src/librustc/back/lto.rs3
-rw-r--r--src/librustc/driver/config.rs2
-rw-r--r--src/librustc/driver/driver.rs2
-rw-r--r--src/librustc/driver/mod.rs2
-rw-r--r--src/librustc/metadata/loader.rs5
-rw-r--r--src/librustc/middle/trans/_match.rs3
-rw-r--r--src/librustc/middle/trans/adt.rs2
-rw-r--r--src/librustc/middle/trans/asm.rs6
-rw-r--r--src/librustc/middle/trans/base.rs160
-rw-r--r--src/librustc/middle/trans/basic_block.rs3
-rw-r--r--src/librustc/middle/trans/build.rs21
-rw-r--r--src/librustc/middle/trans/builder.rs29
-rw-r--r--src/librustc/middle/trans/cabi.rs2
-rw-r--r--src/librustc/middle/trans/cabi_arm.rs5
-rw-r--r--src/librustc/middle/trans/cabi_mips.rs5
-rw-r--r--src/librustc/middle/trans/cabi_x86.rs2
-rw-r--r--src/librustc/middle/trans/cabi_x86_64.rs7
-rw-r--r--src/librustc/middle/trans/callee.rs4
-rw-r--r--src/librustc/middle/trans/cleanup.rs2
-rw-r--r--src/librustc/middle/trans/closure.rs2
-rw-r--r--src/librustc/middle/trans/common.rs11
-rw-r--r--src/librustc/middle/trans/consts.rs5
-rw-r--r--src/librustc/middle/trans/context.rs7
-rw-r--r--src/librustc/middle/trans/controlflow.rs2
-rw-r--r--src/librustc/middle/trans/datum.rs2
-rw-r--r--src/librustc/middle/trans/debuginfo.rs6
-rw-r--r--src/librustc/middle/trans/expr.rs6
-rw-r--r--src/librustc/middle/trans/foreign.rs57
-rw-r--r--src/librustc/middle/trans/glue.rs8
-rw-r--r--src/librustc/middle/trans/inline.rs2
-rw-r--r--src/librustc/middle/trans/intrinsic.rs4
-rw-r--r--src/librustc/middle/trans/llrepr.rs2
-rw-r--r--src/librustc/middle/trans/machine.rs6
-rw-r--r--src/librustc/middle/trans/meth.rs9
-rw-r--r--src/librustc/middle/trans/monomorphize.rs2
-rw-r--r--src/librustc/middle/trans/reflect.rs3
-rw-r--r--src/librustc/middle/trans/tvec.rs8
-rw-r--r--src/librustc/middle/trans/type_.rs5
-rw-r--r--src/librustc/middle/trans/value.rs3
-rw-r--r--src/librustc_llvm/archive_ro.rs7
-rw-r--r--src/librustc_llvm/lib.rs2860
42 files changed, 1698 insertions, 1698 deletions
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index a552f542150..cad164c9e20 100644
--- a/src/librustc/back/link.rs
+++ b/src/librustc/back/link.rs
@@ -56,7 +56,7 @@ pub enum OutputType {
 
 pub fn llvm_err(sess: &Session, msg: String) -> ! {
     unsafe {
-        let cstr = llvm::llvm::LLVMRustGetLastError();
+        let cstr = llvm::LLVMRustGetLastError();
         if cstr == ptr::null() {
             sess.fatal(msg.as_slice());
         } else {
@@ -78,7 +78,7 @@ pub fn write_output_file(
         file_type: llvm::FileType) {
     unsafe {
         output.with_c_str(|output| {
-            let result = llvm::llvm::LLVMRustWriteOutputFile(
+            let result = llvm::LLVMRustWriteOutputFile(
                     target, pm, m, output, file_type);
             if !result {
                 llvm_err(sess, "could not write output".to_string());
@@ -147,7 +147,7 @@ pub mod write {
 
             if sess.opts.cg.save_temps {
                 output.with_extension("no-opt.bc").with_c_str(|buf| {
-                    llvm::llvm::LLVMWriteBitcodeToFile(llmod, buf);
+                    llvm::LLVMWriteBitcodeToFile(llmod, buf);
                 })
             }
 
@@ -193,7 +193,7 @@ pub mod write {
                          .with_c_str(|t| {
                 sess.opts.cg.target_cpu.as_slice().with_c_str(|cpu| {
                     target_feature(sess).with_c_str(|features| {
-                        llvm::llvm::LLVMRustCreateTargetMachine(
+                        llvm::LLVMRustCreateTargetMachine(
                             t, cpu, features,
                             llvm::CodeModelDefault,
                             reloc_model,
@@ -212,26 +212,26 @@ pub mod write {
             // does, and are by populated by LLVM's default PassManagerBuilder.
             // Each manager has a different set of passes, but they also share
             // some common passes.
-            let fpm = llvm::llvm::LLVMCreateFunctionPassManagerForModule(llmod);
-            let mpm = llvm::llvm::LLVMCreatePassManager();
+            let fpm = llvm::LLVMCreateFunctionPassManagerForModule(llmod);
+            let mpm = llvm::LLVMCreatePassManager();
 
             // If we're verifying or linting, add them to the function pass
             // manager.
             let addpass = |pass: &str| {
-                pass.as_slice().with_c_str(|s| llvm::llvm::LLVMRustAddPass(fpm, s))
+                pass.as_slice().with_c_str(|s| llvm::LLVMRustAddPass(fpm, s))
             };
             if !sess.no_verify() { assert!(addpass("verify")); }
 
             if !sess.opts.cg.no_prepopulate_passes {
-                llvm::llvm::LLVMRustAddAnalysisPasses(tm, fpm, llmod);
-                llvm::llvm::LLVMRustAddAnalysisPasses(tm, mpm, llmod);
+                llvm::LLVMRustAddAnalysisPasses(tm, fpm, llmod);
+                llvm::LLVMRustAddAnalysisPasses(tm, mpm, llmod);
                 populate_llvm_passes(fpm, mpm, llmod, opt_level,
                                      trans.no_builtins);
             }
 
             for pass in sess.opts.cg.passes.iter() {
                 pass.as_slice().with_c_str(|s| {
-                    if !llvm::llvm::LLVMRustAddPass(mpm, s) {
+                    if !llvm::LLVMRustAddPass(mpm, s) {
                         sess.warn(format!("unknown pass {}, ignoring",
                                           *pass).as_slice());
                     }
@@ -240,13 +240,13 @@ pub mod write {
 
             // Finally, run the actual optimization passes
             time(sess.time_passes(), "llvm function passes", (), |()|
-                 llvm::llvm::LLVMRustRunFunctionPassManager(fpm, llmod));
+                 llvm::LLVMRustRunFunctionPassManager(fpm, llmod));
             time(sess.time_passes(), "llvm module passes", (), |()|
-                 llvm::llvm::LLVMRunPassManager(mpm, llmod));
+                 llvm::LLVMRunPassManager(mpm, llmod));
 
             // Deallocate managers that we're now done with
-            llvm::llvm::LLVMDisposePassManager(fpm);
-            llvm::llvm::LLVMDisposePassManager(mpm);
+            llvm::LLVMDisposePassManager(fpm);
+            llvm::LLVMDisposePassManager(mpm);
 
             // Emit the bytecode if we're either saving our temporaries or
             // emitting an rlib. Whenever an rlib is created, the bytecode is
@@ -255,7 +255,7 @@ pub mod write {
                (sess.crate_types.borrow().contains(&config::CrateTypeRlib) &&
                 sess.opts.output_types.contains(&OutputTypeExe)) {
                 output.temp_path(OutputTypeBitcode).with_c_str(|buf| {
-                    llvm::llvm::LLVMWriteBitcodeToFile(llmod, buf);
+                    llvm::LLVMWriteBitcodeToFile(llmod, buf);
                 })
             }
 
@@ -265,7 +265,7 @@ pub mod write {
 
                 if sess.opts.cg.save_temps {
                     output.with_extension("lto.bc").with_c_str(|buf| {
-                        llvm::llvm::LLVMWriteBitcodeToFile(llmod, buf);
+                        llvm::LLVMWriteBitcodeToFile(llmod, buf);
                     })
                 }
             }
@@ -281,11 +281,11 @@ pub mod write {
             fn with_codegen(tm: TargetMachineRef, llmod: ModuleRef,
                             no_builtins: bool, f: |PassManagerRef|) {
                 unsafe {
-                    let cpm = llvm::llvm::LLVMCreatePassManager();
-                    llvm::llvm::LLVMRustAddAnalysisPasses(tm, cpm, llmod);
-                    llvm::llvm::LLVMRustAddLibraryInfo(cpm, llmod, no_builtins);
+                    let cpm = llvm::LLVMCreatePassManager();
+                    llvm::LLVMRustAddAnalysisPasses(tm, cpm, llmod);
+                    llvm::LLVMRustAddLibraryInfo(cpm, llmod, no_builtins);
                     f(cpm);
-                    llvm::llvm::LLVMDisposePassManager(cpm);
+                    llvm::LLVMDisposePassManager(cpm);
                 }
             }
 
@@ -296,13 +296,13 @@ pub mod write {
                 match *output_type {
                     OutputTypeBitcode => {
                         path.with_c_str(|buf| {
-                            llvm::llvm::LLVMWriteBitcodeToFile(llmod, buf);
+                            llvm::LLVMWriteBitcodeToFile(llmod, buf);
                         })
                     }
                     OutputTypeLlvmAssembly => {
                         path.with_c_str(|output| {
                             with_codegen(tm, llmod, trans.no_builtins, |cpm| {
-                                llvm::llvm::LLVMRustPrintModule(cpm, llmod, output);
+                                llvm::LLVMRustPrintModule(cpm, llmod, output);
                             })
                         })
                     }
@@ -355,11 +355,11 @@ pub mod write {
                 }
             });
 
-            llvm::llvm::LLVMRustDisposeTargetMachine(tm);
-            llvm::llvm::LLVMDisposeModule(trans.metadata_module);
-            llvm::llvm::LLVMDisposeModule(llmod);
-            llvm::llvm::LLVMContextDispose(llcx);
-            if sess.time_llvm_passes() { llvm::llvm::LLVMRustPrintPassTimings(); }
+            llvm::LLVMRustDisposeTargetMachine(tm);
+            llvm::LLVMDisposeModule(trans.metadata_module);
+            llvm::LLVMDisposeModule(llmod);
+            llvm::LLVMContextDispose(llcx);
+            if sess.time_llvm_passes() { llvm::LLVMRustPrintPassTimings(); }
         }
     }
 
@@ -426,31 +426,31 @@ pub mod write {
         }
 
         INIT.doit(|| {
-            llvm::llvm::LLVMInitializePasses();
+            llvm::LLVMInitializePasses();
 
             // Only initialize the platforms supported by Rust here, because
             // using --llvm-root will have multiple platforms that rustllvm
             // doesn't actually link to and it's pointless to put target info
             // into the registry that Rust cannot generate machine code for.
-            llvm::llvm::LLVMInitializeX86TargetInfo();
-            llvm::llvm::LLVMInitializeX86Target();
-            llvm::llvm::LLVMInitializeX86TargetMC();
-            llvm::llvm::LLVMInitializeX86AsmPrinter();
-            llvm::llvm::LLVMInitializeX86AsmParser();
-
-            llvm::llvm::LLVMInitializeARMTargetInfo();
-            llvm::llvm::LLVMInitializeARMTarget();
-            llvm::llvm::LLVMInitializeARMTargetMC();
-            llvm::llvm::LLVMInitializeARMAsmPrinter();
-            llvm::llvm::LLVMInitializeARMAsmParser();
-
-            llvm::llvm::LLVMInitializeMipsTargetInfo();
-            llvm::llvm::LLVMInitializeMipsTarget();
-            llvm::llvm::LLVMInitializeMipsTargetMC();
-            llvm::llvm::LLVMInitializeMipsAsmPrinter();
-            llvm::llvm::LLVMInitializeMipsAsmParser();
-
-            llvm::llvm::LLVMRustSetLLVMOptions(llvm_args.len() as c_int,
+            llvm::LLVMInitializeX86TargetInfo();
+            llvm::LLVMInitializeX86Target();
+            llvm::LLVMInitializeX86TargetMC();
+            llvm::LLVMInitializeX86AsmPrinter();
+            llvm::LLVMInitializeX86AsmParser();
+
+            llvm::LLVMInitializeARMTargetInfo();
+            llvm::LLVMInitializeARMTarget();
+            llvm::LLVMInitializeARMTargetMC();
+            llvm::LLVMInitializeARMAsmPrinter();
+            llvm::LLVMInitializeARMAsmParser();
+
+            llvm::LLVMInitializeMipsTargetInfo();
+            llvm::LLVMInitializeMipsTarget();
+            llvm::LLVMInitializeMipsTargetMC();
+            llvm::LLVMInitializeMipsAsmPrinter();
+            llvm::LLVMInitializeMipsAsmParser();
+
+            llvm::LLVMRustSetLLVMOptions(llvm_args.len() as c_int,
                                          llvm_args.as_ptr());
         });
     }
@@ -463,32 +463,32 @@ pub mod write {
         // Create the PassManagerBuilder for LLVM. We configure it with
         // reasonable defaults and prepare it to actually populate the pass
         // manager.
-        let builder = llvm::llvm::LLVMPassManagerBuilderCreate();
+        let builder = llvm::LLVMPassManagerBuilderCreate();
         match opt {
             llvm::CodeGenLevelNone => {
                 // Don't add lifetime intrinsics at O0
-                llvm::llvm::LLVMRustAddAlwaysInlinePass(builder, false);
+                llvm::LLVMRustAddAlwaysInlinePass(builder, false);
             }
             llvm::CodeGenLevelLess => {
-                llvm::llvm::LLVMRustAddAlwaysInlinePass(builder, true);
+                llvm::LLVMRustAddAlwaysInlinePass(builder, true);
             }
             // numeric values copied from clang
             llvm::CodeGenLevelDefault => {
-                llvm::llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder,
+                llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder,
                                                                     225);
             }
             llvm::CodeGenLevelAggressive => {
-                llvm::llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder,
+                llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder,
                                                                     275);
             }
         }
-        llvm::llvm::LLVMPassManagerBuilderSetOptLevel(builder, opt as c_uint);
-        llvm::llvm::LLVMRustAddBuilderLibraryInfo(builder, llmod, no_builtins);
+        llvm::LLVMPassManagerBuilderSetOptLevel(builder, opt as c_uint);
+        llvm::LLVMRustAddBuilderLibraryInfo(builder, llmod, no_builtins);
 
         // Use the builder to populate the function/module pass managers.
-        llvm::llvm::LLVMPassManagerBuilderPopulateFunctionPassManager(builder, fpm);
-        llvm::llvm::LLVMPassManagerBuilderPopulateModulePassManager(builder, mpm);
-        llvm::llvm::LLVMPassManagerBuilderDispose(builder);
+        llvm::LLVMPassManagerBuilderPopulateFunctionPassManager(builder, fpm);
+        llvm::LLVMPassManagerBuilderPopulateModulePassManager(builder, mpm);
+        llvm::LLVMPassManagerBuilderDispose(builder);
     }
 }
 
diff --git a/src/librustc/back/lto.rs b/src/librustc/back/lto.rs
index 6fc60b657d3..6184ea4591f 100644
--- a/src/librustc/back/lto.rs
+++ b/src/librustc/back/lto.rs
@@ -11,8 +11,9 @@
 use super::link;
 use driver::session;
 use driver::config;
+use llvm;
 use llvm::archive_ro::ArchiveRO;
-use llvm::{ModuleRef, TargetMachineRef, llvm, True, False};
+use llvm::{ModuleRef, TargetMachineRef, True, False};
 use metadata::cstore;
 use util::common::time;
 
diff --git a/src/librustc/driver/config.rs b/src/librustc/driver/config.rs
index b726c50afe9..232a1252f59 100644
--- a/src/librustc/driver/config.rs
+++ b/src/librustc/driver/config.rs
@@ -33,10 +33,10 @@ use syntax::parse::token::InternedString;
 use std::collections::{HashSet, HashMap};
 use getopts::{optopt, optmulti, optflag, optflagopt};
 use getopts;
-use lib::llvm::llvm;
 use std::cell::{RefCell};
 use std::fmt;
 
+use llvm;
 
 pub struct Config {
     pub os: abi::Os,
diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs
index d03bf3593fa..2149504a67a 100644
--- a/src/librustc/driver/driver.rs
+++ b/src/librustc/driver/driver.rs
@@ -15,8 +15,8 @@ use driver::{config, PpMode};
 use driver::{PpmFlowGraph, PpmExpanded, PpmExpandedIdentified, PpmTyped};
 use driver::{PpmIdentified};
 use front;
-use lib::llvm::{ContextRef, ModuleRef};
 use lint;
+use llvm::{ContextRef, ModuleRef};
 use metadata::common::LinkMeta;
 use metadata::creader;
 use middle::cfg;
diff --git a/src/librustc/driver/mod.rs b/src/librustc/driver/mod.rs
index 2614c9ebf98..e850b71dda8 100644
--- a/src/librustc/driver/mod.rs
+++ b/src/librustc/driver/mod.rs
@@ -292,7 +292,7 @@ pub fn handle_options(mut args: Vec<String>) -> Option<getopts::Matches> {
     }
 
     if cg_flags.contains(&"passes=list".to_string()) {
-        unsafe { ::lib::llvm::llvm::LLVMRustPrintPasses(); }
+        unsafe { ::llvm::LLVMRustPrintPasses(); }
         return None;
     }
 
diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs
index 1877bd1260e..e7d52ef3b3d 100644
--- a/src/librustc/metadata/loader.rs
+++ b/src/librustc/metadata/loader.rs
@@ -215,8 +215,9 @@
 use back::archive::{METADATA_FILENAME};
 use back::svh::Svh;
 use driver::session::Session;
-use lib::llvm::{False, llvm, ObjectFile, mk_section_iter};
-use lib::llvm::archive_ro::ArchiveRO;
+use llvm;
+use llvm::{False, ObjectFile, mk_section_iter};
+use llvm::archive_ro::ArchiveRO;
 use metadata::cstore::{MetadataBlob, MetadataVec, MetadataArchive};
 use metadata::decoder;
 use metadata::encoder;
diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs
index 3cfd1aaee8f..958d2cd3774 100644
--- a/src/librustc/middle/trans/_match.rs
+++ b/src/librustc/middle/trans/_match.rs
@@ -190,7 +190,8 @@
 
 use back::abi;
 use driver::config::FullDebugInfo;
-use lib::llvm::{llvm, ValueRef, BasicBlockRef};
+use llvm;
+use llvm::{ValueRef, BasicBlockRef};
 use middle::const_eval;
 use middle::def;
 use middle::check_match;
diff --git a/src/librustc/middle/trans/adt.rs b/src/librustc/middle/trans/adt.rs
index 898cb036ea5..3ee61b1d675 100644
--- a/src/librustc/middle/trans/adt.rs
+++ b/src/librustc/middle/trans/adt.rs
@@ -48,7 +48,7 @@
 use libc::c_ulonglong;
 use std::rc::Rc;
 
-use lib::llvm::{ValueRef, True, IntEQ, IntNE};
+use llvm::{ValueRef, True, IntEQ, IntNE};
 use middle::subst;
 use middle::subst::Subst;
 use middle::trans::_match;
diff --git a/src/librustc/middle/trans/asm.rs b/src/librustc/middle/trans/asm.rs
index 81bb50a83af..9760ef07a40 100644
--- a/src/librustc/middle/trans/asm.rs
+++ b/src/librustc/middle/trans/asm.rs
@@ -12,7 +12,7 @@
 # Translation of inline assembly.
 */
 
-use lib;
+use llvm;
 use middle::trans::build::*;
 use middle::trans::callee;
 use middle::trans::common::*;
@@ -99,8 +99,8 @@ pub fn trans_inline_asm<'a>(bcx: &'a Block<'a>, ia: &ast::InlineAsm)
     };
 
     let dialect = match ia.dialect {
-        ast::AsmAtt   => lib::llvm::AD_ATT,
-        ast::AsmIntel => lib::llvm::AD_Intel
+        ast::AsmAtt   => llvm::AD_ATT,
+        ast::AsmIntel => llvm::AD_Intel
     };
 
     let r = ia.asm.get().with_c_str(|a| {
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index 4d329ebd2a0..6bcc9b9b745 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -31,9 +31,9 @@ use driver::config;
 use driver::config::{NoDebugInfo, FullDebugInfo};
 use driver::session::Session;
 use driver::driver::{CrateAnalysis, CrateTranslation};
-use lib::llvm::{ModuleRef, ValueRef, BasicBlockRef};
-use lib::llvm::{llvm, Vector};
-use lib;
+use llvm;
+use llvm::{ModuleRef, ValueRef, BasicBlockRef};
+use llvm::{Vector};
 use metadata::{csearch, encoder, loader};
 use lint;
 use middle::astencode;
@@ -172,7 +172,7 @@ impl<'a> Drop for StatRecorder<'a> {
 }
 
 // only use this for foreign function ABIs and glue, use `decl_rust_fn` for Rust functions
-fn decl_fn(ccx: &CrateContext, name: &str, cc: lib::llvm::CallConv,
+fn decl_fn(ccx: &CrateContext, name: &str, cc: llvm::CallConv,
            ty: Type, output: ty::t) -> ValueRef {
 
     let llfn: ValueRef = name.with_c_str(|buf| {
@@ -186,16 +186,16 @@ fn decl_fn(ccx: &CrateContext, name: &str, cc: lib::llvm::CallConv,
         ty::ty_bot => {
             unsafe {
                 llvm::LLVMAddFunctionAttribute(llfn,
-                                               lib::llvm::FunctionIndex as c_uint,
-                                               lib::llvm::NoReturnAttribute as uint64_t)
+                                               llvm::FunctionIndex as c_uint,
+                                               llvm::NoReturnAttribute as uint64_t)
             }
         }
         _ => {}
     }
 
-    lib::llvm::SetFunctionCallConv(llfn, cc);
+    llvm::SetFunctionCallConv(llfn, cc);
     // Function addresses in Rust are never significant, allowing functions to be merged.
-    lib::llvm::SetUnnamedAddr(llfn, true);
+    llvm::SetUnnamedAddr(llfn, true);
 
     if ccx.is_split_stack_supported() {
         set_split_stack(llfn);
@@ -209,14 +209,14 @@ pub fn decl_cdecl_fn(ccx: &CrateContext,
                      name: &str,
                      ty: Type,
                      output: ty::t) -> ValueRef {
-    decl_fn(ccx, name, lib::llvm::CCallConv, ty, output)
+    decl_fn(ccx, name, llvm::CCallConv, ty, output)
 }
 
 // only use this for foreign function ABIs and glue, use `get_extern_rust_fn` for Rust functions
 pub fn get_extern_fn(ccx: &CrateContext,
                      externs: &mut ExternMap,
                      name: &str,
-                     cc: lib::llvm::CallConv,
+                     cc: llvm::CallConv,
                      ty: Type,
                      output: ty::t)
                      -> ValueRef {
@@ -253,7 +253,7 @@ pub fn decl_rust_fn(ccx: &CrateContext, fn_ty: ty::t, name: &str) -> ValueRef {
     };
 
     let llfty = type_of_rust_fn(ccx, has_env, inputs.as_slice(), output);
-    let llfn = decl_fn(ccx, name, lib::llvm::CCallConv, llfty, output);
+    let llfn = decl_fn(ccx, name, llvm::CCallConv, llfty, output);
     let attrs = get_fn_llvm_attributes(ccx, fn_ty);
     for &(idx, attr) in attrs.iter() {
         unsafe {
@@ -266,7 +266,7 @@ pub fn decl_rust_fn(ccx: &CrateContext, fn_ty: ty::t, name: &str) -> ValueRef {
 
 pub fn decl_internal_rust_fn(ccx: &CrateContext, fn_ty: ty::t, name: &str) -> ValueRef {
     let llfn = decl_rust_fn(ccx, fn_ty, name);
-    lib::llvm::SetLinkage(llfn, lib::llvm::InternalLinkage);
+    llvm::SetLinkage(llfn, llvm::InternalLinkage);
     llfn
 }
 
@@ -375,26 +375,26 @@ pub fn get_tydesc(ccx: &CrateContext, t: ty::t) -> Rc<tydesc_info> {
 
 #[allow(dead_code)] // useful
 pub fn set_optimize_for_size(f: ValueRef) {
-    lib::llvm::SetFunctionAttribute(f, lib::llvm::OptimizeForSizeAttribute)
+    llvm::SetFunctionAttribute(f, llvm::OptimizeForSizeAttribute)
 }
 
 pub fn set_no_inline(f: ValueRef) {
-    lib::llvm::SetFunctionAttribute(f, lib::llvm::NoInlineAttribute)
+    llvm::SetFunctionAttribute(f, llvm::NoInlineAttribute)
 }
 
 #[allow(dead_code)] // useful
 pub fn set_no_unwind(f: ValueRef) {
-    lib::llvm::SetFunctionAttribute(f, lib::llvm::NoUnwindAttribute)
+    llvm::SetFunctionAttribute(f, llvm::NoUnwindAttribute)
 }
 
 // Tell LLVM to emit the information necessary to unwind the stack for the
 // function f.
 pub fn set_uwtable(f: ValueRef) {
-    lib::llvm::SetFunctionAttribute(f, lib::llvm::UWTableAttribute)
+    llvm::SetFunctionAttribute(f, llvm::UWTableAttribute)
 }
 
 pub fn set_inline_hint(f: ValueRef) {
-    lib::llvm::SetFunctionAttribute(f, lib::llvm::InlineHintAttribute)
+    llvm::SetFunctionAttribute(f, llvm::InlineHintAttribute)
 }
 
 pub fn set_llvm_fn_attrs(attrs: &[ast::Attribute], llfn: ValueRef) {
@@ -415,25 +415,25 @@ pub fn set_llvm_fn_attrs(attrs: &[ast::Attribute], llfn: ValueRef) {
     if contains_name(attrs, "cold") {
         unsafe {
             llvm::LLVMAddFunctionAttribute(llfn,
-                                           lib::llvm::FunctionIndex as c_uint,
-                                           lib::llvm::ColdAttribute as uint64_t)
+                                           llvm::FunctionIndex as c_uint,
+                                           llvm::ColdAttribute as uint64_t)
         }
     }
 }
 
 pub fn set_always_inline(f: ValueRef) {
-    lib::llvm::SetFunctionAttribute(f, lib::llvm::AlwaysInlineAttribute)
+    llvm::SetFunctionAttribute(f, llvm::AlwaysInlineAttribute)
 }
 
 pub fn set_split_stack(f: ValueRef) {
     "split-stack".with_c_str(|buf| {
-        unsafe { llvm::LLVMAddFunctionAttrString(f, lib::llvm::FunctionIndex as c_uint, buf); }
+        unsafe { llvm::LLVMAddFunctionAttrString(f, llvm::FunctionIndex as c_uint, buf); }
     })
 }
 
 pub fn unset_split_stack(f: ValueRef) {
     "split-stack".with_c_str(|buf| {
-        unsafe { llvm::LLVMRemoveFunctionAttrString(f, lib::llvm::FunctionIndex as c_uint, buf); }
+        unsafe { llvm::LLVMRemoveFunctionAttrString(f, llvm::FunctionIndex as c_uint, buf); }
     })
 }
 
@@ -479,7 +479,7 @@ pub fn get_res_dtor(ccx: &CrateContext,
         get_extern_fn(ccx,
                       &mut *ccx.externs.borrow_mut(),
                       name.as_slice(),
-                      lib::llvm::CCallConv,
+                      llvm::CCallConv,
                       llty,
                       dtor_ty)
     }
@@ -546,36 +546,36 @@ pub fn compare_scalar_values<'a>(
       }
       floating_point => {
         let cmp = match op {
-          ast::BiEq => lib::llvm::RealOEQ,
-          ast::BiNe => lib::llvm::RealUNE,
-          ast::BiLt => lib::llvm::RealOLT,
-          ast::BiLe => lib::llvm::RealOLE,
-          ast::BiGt => lib::llvm::RealOGT,
-          ast::BiGe => lib::llvm::RealOGE,
+          ast::BiEq => llvm::RealOEQ,
+          ast::BiNe => llvm::RealUNE,
+          ast::BiLt => llvm::RealOLT,
+          ast::BiLe => llvm::RealOLE,
+          ast::BiGt => llvm::RealOGT,
+          ast::BiGe => llvm::RealOGE,
           _ => die(cx)
         };
         return FCmp(cx, cmp, lhs, rhs);
       }
       signed_int => {
         let cmp = match op {
-          ast::BiEq => lib::llvm::IntEQ,
-          ast::BiNe => lib::llvm::IntNE,
-          ast::BiLt => lib::llvm::IntSLT,
-          ast::BiLe => lib::llvm::IntSLE,
-          ast::BiGt => lib::llvm::IntSGT,
-          ast::BiGe => lib::llvm::IntSGE,
+          ast::BiEq => llvm::IntEQ,
+          ast::BiNe => llvm::IntNE,
+          ast::BiLt => llvm::IntSLT,
+          ast::BiLe => llvm::IntSLE,
+          ast::BiGt => llvm::IntSGT,
+          ast::BiGe => llvm::IntSGE,
           _ => die(cx)
         };
         return ICmp(cx, cmp, lhs, rhs);
       }
       unsigned_int => {
         let cmp = match op {
-          ast::BiEq => lib::llvm::IntEQ,
-          ast::BiNe => lib::llvm::IntNE,
-          ast::BiLt => lib::llvm::IntULT,
-          ast::BiLe => lib::llvm::IntULE,
-          ast::BiGt => lib::llvm::IntUGT,
-          ast::BiGe => lib::llvm::IntUGE,
+          ast::BiEq => llvm::IntEQ,
+          ast::BiNe => llvm::IntNE,
+          ast::BiLt => llvm::IntULT,
+          ast::BiLe => llvm::IntULE,
+          ast::BiGt => llvm::IntUGT,
+          ast::BiGe => llvm::IntUGE,
           _ => die(cx)
         };
         return ICmp(cx, cmp, lhs, rhs);
@@ -602,12 +602,12 @@ pub fn compare_simd_types(
         },
         ty::ty_uint(_) | ty::ty_int(_) => {
             let cmp = match op {
-                ast::BiEq => lib::llvm::IntEQ,
-                ast::BiNe => lib::llvm::IntNE,
-                ast::BiLt => lib::llvm::IntSLT,
-                ast::BiLe => lib::llvm::IntSLE,
-                ast::BiGt => lib::llvm::IntSGT,
-                ast::BiGe => lib::llvm::IntSGE,
+                ast::BiEq => llvm::IntEQ,
+                ast::BiNe => llvm::IntNE,
+                ast::BiLt => llvm::IntSLT,
+                ast::BiLe => llvm::IntSLE,
+                ast::BiGt => llvm::IntSGT,
+                ast::BiGe => llvm::IntSGE,
                 _ => cx.sess().bug("compare_simd_types: must be a comparison operator"),
             };
             let return_ty = Type::vector(&type_of(cx.ccx(), t), size as u64);
@@ -801,11 +801,11 @@ pub fn fail_if_zero_or_overflows<'a>(
     let (is_zero, is_signed) = match ty::get(rhs_t).sty {
         ty::ty_int(t) => {
             let zero = C_integral(Type::int_from_ty(cx.ccx(), t), 0u64, false);
-            (ICmp(cx, lib::llvm::IntEQ, rhs, zero), true)
+            (ICmp(cx, llvm::IntEQ, rhs, zero), true)
         }
         ty::ty_uint(t) => {
             let zero = C_integral(Type::uint_from_ty(cx.ccx(), t), 0u64, false);
-            (ICmp(cx, lib::llvm::IntEQ, rhs, zero), false)
+            (ICmp(cx, llvm::IntEQ, rhs, zero), false)
         }
         _ => {
             cx.sess().bug(format!("fail-if-zero on unexpected type: {}",
@@ -841,10 +841,10 @@ pub fn fail_if_zero_or_overflows<'a>(
             }
             _ => unreachable!(),
         };
-        let minus_one = ICmp(bcx, lib::llvm::IntEQ, rhs,
+        let minus_one = ICmp(bcx, llvm::IntEQ, rhs,
                              C_integral(llty, -1, false));
         with_cond(bcx, minus_one, |bcx| {
-            let is_min = ICmp(bcx, lib::llvm::IntEQ, lhs,
+            let is_min = ICmp(bcx, llvm::IntEQ, lhs,
                               C_integral(llty, min, true));
             with_cond(bcx, is_min, |bcx| {
                 controlflow::trans_fail(bcx, span,
@@ -975,11 +975,11 @@ pub fn load_ty(cx: &Block, ptr: ValueRef, t: ty::t) -> ValueRef {
     if type_is_zero_size(cx.ccx(), t) {
         C_undef(type_of::type_of(cx.ccx(), t))
     } else if ty::type_is_bool(t) {
-        Trunc(cx, LoadRangeAssert(cx, ptr, 0, 2, lib::llvm::False), Type::i1(cx.ccx()))
+        Trunc(cx, LoadRangeAssert(cx, ptr, 0, 2, llvm::False), Type::i1(cx.ccx()))
     } else if ty::type_is_char(t) {
         // a char is a unicode codepoint, and so takes values from 0
         // to 0x10FFFF inclusive only.
-        LoadRangeAssert(cx, ptr, 0, 0x10FFFF + 1, lib::llvm::False)
+        LoadRangeAssert(cx, ptr, 0, 0x10FFFF + 1, llvm::False)
     } else {
         Load(cx, ptr)
     }
@@ -1755,7 +1755,7 @@ fn finish_register_fn(ccx: &CrateContext, sp: Span, sym: String, node_id: ast::N
     ccx.item_symbols.borrow_mut().insert(node_id, sym);
 
     if !ccx.reachable.contains(&node_id) {
-        lib::llvm::SetLinkage(llfn, lib::llvm::InternalLinkage);
+        llvm::SetLinkage(llfn, llvm::InternalLinkage);
     }
 
     // The stack exhaustion lang item shouldn't have a split stack because
@@ -1764,10 +1764,10 @@ fn finish_register_fn(ccx: &CrateContext, sp: Span, sym: String, node_id: ast::N
     let def = ast_util::local_def(node_id);
     if ccx.tcx.lang_items.stack_exhausted() == Some(def) {
         unset_split_stack(llfn);
-        lib::llvm::SetLinkage(llfn, lib::llvm::ExternalLinkage);
+        llvm::SetLinkage(llfn, llvm::ExternalLinkage);
     }
     if ccx.tcx.lang_items.eh_personality() == Some(def) {
-        lib::llvm::SetLinkage(llfn, lib::llvm::ExternalLinkage);
+        llvm::SetLinkage(llfn, llvm::ExternalLinkage);
     }
 
 
@@ -1814,13 +1814,13 @@ pub fn get_fn_llvm_attributes(ccx: &CrateContext, fn_ty: ty::t) -> Vec<(uint, u6
     // implications directly to the call instruction. Right now,
     // the only attribute we need to worry about is `sret`.
     if type_of::return_uses_outptr(ccx, ret_ty) {
-        attrs.push((1, lib::llvm::StructRetAttribute as u64));
+        attrs.push((1, llvm::StructRetAttribute as u64));
 
         // The outptr can be noalias and nocapture because it's entirely
         // invisible to the program. We can also mark it as nonnull
-        attrs.push((1, lib::llvm::NoAliasAttribute as u64));
-        attrs.push((1, lib::llvm::NoCaptureAttribute as u64));
-        attrs.push((1, lib::llvm::NonNullAttribute as u64));
+        attrs.push((1, llvm::NoAliasAttribute as u64));
+        attrs.push((1, llvm::NoCaptureAttribute as u64));
+        attrs.push((1, llvm::NonNullAttribute as u64));
 
         // Add one more since there's an outptr
         first_arg_offset += 1;
@@ -1834,7 +1834,7 @@ pub fn get_fn_llvm_attributes(ccx: &CrateContext, fn_ty: ty::t) -> Vec<(uint, u6
                 ty::ty_str | ty::ty_vec(..) | ty::ty_trait(..) => true, _ => false
             } => {}
             ty::ty_uniq(_) => {
-                attrs.push((lib::llvm::ReturnIndex as uint, lib::llvm::NoAliasAttribute as u64));
+                attrs.push((llvm::ReturnIndex as uint, llvm::NoAliasAttribute as u64));
             }
             _ => {}
         }
@@ -1847,14 +1847,14 @@ pub fn get_fn_llvm_attributes(ccx: &CrateContext, fn_ty: ty::t) -> Vec<(uint, u6
                 ty::ty_str | ty::ty_vec(..) | ty::ty_trait(..) => true, _ => false
             } => {}
             ty::ty_uniq(_) | ty::ty_rptr(_, _) => {
-                attrs.push((lib::llvm::ReturnIndex as uint, lib::llvm::NonNullAttribute as u64));
+                attrs.push((llvm::ReturnIndex as uint, llvm::NonNullAttribute as u64));
             }
             _ => {}
         }
 
         match ty::get(ret_ty).sty {
             ty::ty_bool => {
-                attrs.push((lib::llvm::ReturnIndex as uint, lib::llvm::ZExtAttribute as u64));
+                attrs.push((llvm::ReturnIndex as uint, llvm::ZExtAttribute as u64));
             }
             _ => {}
         }
@@ -1867,25 +1867,25 @@ pub fn get_fn_llvm_attributes(ccx: &CrateContext, fn_ty: ty::t) -> Vec<(uint, u6
                 // For non-immediate arguments the callee gets its own copy of
                 // the value on the stack, so there are no aliases. It's also
                 // program-invisible so can't possibly capture
-                attrs.push((idx, lib::llvm::NoAliasAttribute as u64));
-                attrs.push((idx, lib::llvm::NoCaptureAttribute as u64));
-                attrs.push((idx, lib::llvm::NonNullAttribute as u64));
+                attrs.push((idx, llvm::NoAliasAttribute as u64));
+                attrs.push((idx, llvm::NoCaptureAttribute as u64));
+                attrs.push((idx, llvm::NonNullAttribute as u64));
             }
             ty::ty_bool => {
-                attrs.push((idx, lib::llvm::ZExtAttribute as u64));
+                attrs.push((idx, llvm::ZExtAttribute as u64));
             }
             // `~` pointer parameters never alias because ownership is transferred
             ty::ty_uniq(_) => {
-                attrs.push((idx, lib::llvm::NoAliasAttribute as u64));
-                attrs.push((idx, lib::llvm::NonNullAttribute as u64));
+                attrs.push((idx, llvm::NoAliasAttribute as u64));
+                attrs.push((idx, llvm::NonNullAttribute as u64));
             }
             // `&mut` pointer parameters never alias other parameters, or mutable global data
             ty::ty_rptr(b, mt) if mt.mutbl == ast::MutMutable => {
-                attrs.push((idx, lib::llvm::NoAliasAttribute as u64));
-                attrs.push((idx, lib::llvm::NonNullAttribute as u64));
+                attrs.push((idx, llvm::NoAliasAttribute as u64));
+                attrs.push((idx, llvm::NonNullAttribute as u64));
                 match b {
                     ReLateBound(_, BrAnon(_)) => {
-                        attrs.push((idx, lib::llvm::NoCaptureAttribute as u64));
+                        attrs.push((idx, llvm::NoCaptureAttribute as u64));
                     }
                     _ => {}
                 }
@@ -1893,12 +1893,12 @@ pub fn get_fn_llvm_attributes(ccx: &CrateContext, fn_ty: ty::t) -> Vec<(uint, u6
             // When a reference in an argument has no named lifetime, it's impossible for that
             // reference to escape this function (returned or stored beyond the call by a closure).
             ty::ty_rptr(ReLateBound(_, BrAnon(_)), _) => {
-                attrs.push((idx, lib::llvm::NoCaptureAttribute as u64));
-                attrs.push((idx, lib::llvm::NonNullAttribute as u64));
+                attrs.push((idx, llvm::NoCaptureAttribute as u64));
+                attrs.push((idx, llvm::NonNullAttribute as u64));
             }
             // & pointer parameters are never null
             ty::ty_rptr(_, _) => {
-                attrs.push((idx, lib::llvm::NonNullAttribute as u64));
+                attrs.push((idx, llvm::NonNullAttribute as u64));
             }
             _ => ()
         }
@@ -1912,7 +1912,7 @@ pub fn register_fn_llvmty(ccx: &CrateContext,
                           sp: Span,
                           sym: String,
                           node_id: ast::NodeId,
-                          cc: lib::llvm::CallConv,
+                          cc: llvm::CallConv,
                           llfty: Type) -> ValueRef {
     debug!("register_fn_llvmty id={} sym={}", node_id, sym);
 
@@ -2073,7 +2073,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
                         });
 
                         if !ccx.reachable.contains(&id) {
-                            lib::llvm::SetLinkage(g, lib::llvm::InternalLinkage);
+                            llvm::SetLinkage(g, llvm::InternalLinkage);
                         }
 
                         // Apply the `unnamed_addr` attribute if
@@ -2081,7 +2081,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
                         if !ast_util::static_has_significant_address(
                                 mutbl,
                                 i.attrs.as_slice()) {
-                            lib::llvm::SetUnnamedAddr(g, true);
+                            llvm::SetUnnamedAddr(g, true);
 
                             // This is a curious case where we must make
                             // all of these statics inlineable. If a
@@ -2103,7 +2103,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
 
                         if attr::contains_name(i.attrs.as_slice(),
                                                "thread_local") {
-                            lib::llvm::set_thread_local(g, true);
+                            llvm::set_thread_local(g, true);
                         }
 
                         if !inlineable {
@@ -2241,7 +2241,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
     // linkage b/c that doesn't quite make sense. Otherwise items can
     // have internal linkage if they're not reachable.
     if !foreign && !ccx.reachable.contains(&id) {
-        lib::llvm::SetLinkage(val, lib::llvm::InternalLinkage);
+        llvm::SetLinkage(val, llvm::InternalLinkage);
     }
 
     ccx.item_vals.borrow_mut().insert(id, val);
diff --git a/src/librustc/middle/trans/basic_block.rs b/src/librustc/middle/trans/basic_block.rs
index 303ad5fbce2..13b8ed4df6b 100644
--- a/src/librustc/middle/trans/basic_block.rs
+++ b/src/librustc/middle/trans/basic_block.rs
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use lib::llvm::{llvm, BasicBlockRef};
+use llvm;
+use llvm::{BasicBlockRef};
 use middle::trans::value::{Users, Value};
 use std::iter::{Filter, Map};
 
diff --git a/src/librustc/middle/trans/build.rs b/src/librustc/middle/trans/build.rs
index ce11cd24f7b..995ad16b59f 100644
--- a/src/librustc/middle/trans/build.rs
+++ b/src/librustc/middle/trans/build.rs
@@ -11,11 +11,10 @@
 #![allow(dead_code)] // FFI wrappers
 #![allow(non_snake_case_functions)]
 
-use lib::llvm::llvm;
-use lib::llvm::{CallConv, AtomicBinOp, AtomicOrdering, AsmDialect};
-use lib::llvm::{Opcode, IntPredicate, RealPredicate};
-use lib::llvm::{ValueRef, BasicBlockRef};
-use lib;
+use llvm;
+use llvm::{CallConv, AtomicBinOp, AtomicOrdering, AsmDialect};
+use llvm::{Opcode, IntPredicate, RealPredicate};
+use llvm::{ValueRef, BasicBlockRef};
 use middle::trans::common::*;
 use syntax::codemap::Span;
 
@@ -97,7 +96,7 @@ pub fn Switch(cx: &Block, v: ValueRef, else_: BasicBlockRef, num_cases: uint)
 
 pub fn AddCase(s: ValueRef, on_val: ValueRef, dest: BasicBlockRef) {
     unsafe {
-        if llvm::LLVMIsUndef(s) == lib::llvm::True { return; }
+        if llvm::LLVMIsUndef(s) == llvm::True { return; }
         llvm::LLVMAddCase(s, on_val, dest);
     }
 }
@@ -350,7 +349,7 @@ pub fn Load(cx: &Block, pointer_val: ValueRef) -> ValueRef {
         let ccx = cx.fcx.ccx;
         if cx.unreachable.get() {
             let ty = val_ty(pointer_val);
-            let eltty = if ty.kind() == lib::llvm::Array {
+            let eltty = if ty.kind() == llvm::Array {
                 ty.element_type()
             } else {
                 ccx.int_type
@@ -382,11 +381,11 @@ pub fn AtomicLoad(cx: &Block, pointer_val: ValueRef, order: AtomicOrdering) -> V
 
 
 pub fn LoadRangeAssert(cx: &Block, pointer_val: ValueRef, lo: c_ulonglong,
-                       hi: c_ulonglong, signed: lib::llvm::Bool) -> ValueRef {
+                       hi: c_ulonglong, signed: llvm::Bool) -> ValueRef {
     if cx.unreachable.get() {
         let ccx = cx.fcx.ccx;
         let ty = val_ty(pointer_val);
-        let eltty = if ty.kind() == lib::llvm::Array {
+        let eltty = if ty.kind() == llvm::Array {
             ty.element_type()
         } else {
             ccx.int_type
@@ -647,7 +646,7 @@ pub fn Phi(cx: &Block, ty: Type, vals: &[ValueRef],
 
 pub fn AddIncomingToPhi(phi: ValueRef, val: ValueRef, bb: BasicBlockRef) {
     unsafe {
-        if llvm::LLVMIsUndef(phi) == lib::llvm::True { return; }
+        if llvm::LLVMIsUndef(phi) == llvm::True { return; }
         llvm::LLVMAddIncoming(phi, &val, &bb, 1 as c_uint);
     }
 }
@@ -656,7 +655,7 @@ pub fn _UndefReturn(cx: &Block, fn_: ValueRef) -> ValueRef {
     unsafe {
         let ccx = cx.fcx.ccx;
         let ty = val_ty(fn_);
-        let retty = if ty.kind() == lib::llvm::Integer {
+        let retty = if ty.kind() == llvm::Integer {
             ty.return_type()
         } else {
             ccx.int_type
diff --git a/src/librustc/middle/trans/builder.rs b/src/librustc/middle/trans/builder.rs
index 3a9e3e4cf9b..32e91c337f0 100644
--- a/src/librustc/middle/trans/builder.rs
+++ b/src/librustc/middle/trans/builder.rs
@@ -10,11 +10,10 @@
 
 #![allow(dead_code)] // FFI wrappers
 
-use lib;
-use lib::llvm::llvm;
-use lib::llvm::{CallConv, AtomicBinOp, AtomicOrdering, AsmDialect};
-use lib::llvm::{Opcode, IntPredicate, RealPredicate, False};
-use lib::llvm::{ValueRef, BasicBlockRef, BuilderRef, ModuleRef};
+use llvm;
+use llvm::{CallConv, AtomicBinOp, AtomicOrdering, AsmDialect};
+use llvm::{Opcode, IntPredicate, RealPredicate, False};
+use llvm::{ValueRef, BasicBlockRef, BuilderRef, ModuleRef};
 use middle::trans::base;
 use middle::trans::common::*;
 use middle::trans::machine::llalign_of_pref;
@@ -460,7 +459,7 @@ impl<'a> Builder<'a> {
         self.count_insn("load.volatile");
         unsafe {
             let insn = llvm::LLVMBuildLoad(self.llbuilder, ptr, noname());
-            llvm::LLVMSetVolatile(insn, lib::llvm::True);
+            llvm::LLVMSetVolatile(insn, llvm::True);
             insn
         }
     }
@@ -477,7 +476,7 @@ impl<'a> Builder<'a> {
 
 
     pub fn load_range_assert(&self, ptr: ValueRef, lo: c_ulonglong,
-                           hi: c_ulonglong, signed: lib::llvm::Bool) -> ValueRef {
+                           hi: c_ulonglong, signed: llvm::Bool) -> ValueRef {
         let value = self.load(ptr);
 
         unsafe {
@@ -487,7 +486,7 @@ impl<'a> Builder<'a> {
 
             let v = [min, max];
 
-            llvm::LLVMSetMetadata(value, lib::llvm::MD_range as c_uint,
+            llvm::LLVMSetMetadata(value, llvm::MD_range as c_uint,
                                   llvm::LLVMMDNodeInContext(self.ccx.llcx,
                                                             v.as_ptr(), v.len() as c_uint));
         }
@@ -514,7 +513,7 @@ impl<'a> Builder<'a> {
         self.count_insn("store.volatile");
         unsafe {
             let insn = llvm::LLVMBuildStore(self.llbuilder, val, ptr);
-            llvm::LLVMSetVolatile(insn, lib::llvm::True);
+            llvm::LLVMSetVolatile(insn, llvm::True);
         }
     }
 
@@ -788,10 +787,10 @@ impl<'a> Builder<'a> {
                          dia: AsmDialect) -> ValueRef {
         self.count_insn("inlineasm");
 
-        let volatile = if volatile { lib::llvm::True }
-                       else        { lib::llvm::False };
-        let alignstack = if alignstack { lib::llvm::True }
-                         else          { lib::llvm::False };
+        let volatile = if volatile { llvm::True }
+                       else        { llvm::False };
+        let alignstack = if alignstack { llvm::True }
+                         else          { llvm::False };
 
         let argtys = inputs.iter().map(|v| {
             debug!("Asm Input Type: {:?}", self.ccx.tn.val_to_string(*v));
@@ -832,7 +831,7 @@ impl<'a> Builder<'a> {
                           conv: CallConv, attributes: &[(uint, u64)]) -> ValueRef {
         self.count_insn("callwithconv");
         let v = self.call(llfn, args, attributes);
-        lib::llvm::SetInstructionCallConv(v, conv);
+        llvm::SetInstructionCallConv(v, conv);
         v
     }
 
@@ -945,7 +944,7 @@ impl<'a> Builder<'a> {
     pub fn set_cleanup(&self, landing_pad: ValueRef) {
         self.count_insn("setcleanup");
         unsafe {
-            llvm::LLVMSetCleanup(landing_pad, lib::llvm::True);
+            llvm::LLVMSetCleanup(landing_pad, llvm::True);
         }
     }
 
diff --git a/src/librustc/middle/trans/cabi.rs b/src/librustc/middle/trans/cabi.rs
index df1347f6d8f..0a10fb8b172 100644
--- a/src/librustc/middle/trans/cabi.rs
+++ b/src/librustc/middle/trans/cabi.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use lib::llvm::Attribute;
+use llvm::Attribute;
 use std::option;
 use middle::trans::context::CrateContext;
 use middle::trans::cabi_x86;
diff --git a/src/librustc/middle/trans/cabi_arm.rs b/src/librustc/middle/trans/cabi_arm.rs
index c44a4e02ad4..0e2bf2104fd 100644
--- a/src/librustc/middle/trans/cabi_arm.rs
+++ b/src/librustc/middle/trans/cabi_arm.rs
@@ -10,8 +10,9 @@
 
 #![allow(non_uppercase_pattern_statics)]
 
-use lib::llvm::{llvm, Integer, Pointer, Float, Double, Struct, Array};
-use lib::llvm::{StructRetAttribute, ZExtAttribute};
+use llvm;
+use llvm::{Integer, Pointer, Float, Double, Struct, Array};
+use llvm::{StructRetAttribute, ZExtAttribute};
 use middle::trans::cabi::{FnType, ArgType};
 use middle::trans::context::CrateContext;
 use middle::trans::type_::Type;
diff --git a/src/librustc/middle/trans/cabi_mips.rs b/src/librustc/middle/trans/cabi_mips.rs
index 9e5b38d2f7d..d0709068687 100644
--- a/src/librustc/middle/trans/cabi_mips.rs
+++ b/src/librustc/middle/trans/cabi_mips.rs
@@ -12,8 +12,9 @@
 
 use libc::c_uint;
 use std::cmp;
-use lib::llvm::{llvm, Integer, Pointer, Float, Double, Struct, Array};
-use lib::llvm::{StructRetAttribute, ZExtAttribute};
+use llvm;
+use llvm::{Integer, Pointer, Float, Double, Struct, Array};
+use llvm::{StructRetAttribute, ZExtAttribute};
 use middle::trans::context::CrateContext;
 use middle::trans::cabi::*;
 use middle::trans::type_::Type;
diff --git a/src/librustc/middle/trans/cabi_x86.rs b/src/librustc/middle/trans/cabi_x86.rs
index 0d88c611cba..6bb3d992f50 100644
--- a/src/librustc/middle/trans/cabi_x86.rs
+++ b/src/librustc/middle/trans/cabi_x86.rs
@@ -10,7 +10,7 @@
 
 
 use syntax::abi::{OsWin32, OsMacos, OsiOS};
-use lib::llvm::*;
+use llvm::*;
 use super::cabi::*;
 use super::common::*;
 use super::machine::*;
diff --git a/src/librustc/middle/trans/cabi_x86_64.rs b/src/librustc/middle/trans/cabi_x86_64.rs
index 5b8ddfe1be7..493aca0ddf0 100644
--- a/src/librustc/middle/trans/cabi_x86_64.rs
+++ b/src/librustc/middle/trans/cabi_x86_64.rs
@@ -13,9 +13,10 @@
 
 #![allow(non_uppercase_pattern_statics)]
 
-use lib::llvm::{llvm, Integer, Pointer, Float, Double};
-use lib::llvm::{Struct, Array, Attribute};
-use lib::llvm::{StructRetAttribute, ByValAttribute, ZExtAttribute};
+use llvm;
+use llvm::{Integer, Pointer, Float, Double};
+use llvm::{Struct, Array, Attribute};
+use llvm::{StructRetAttribute, ByValAttribute, ZExtAttribute};
 use middle::trans::cabi::*;
 use middle::trans::context::CrateContext;
 use middle::trans::type_::Type;
diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs
index 15415620c5b..db2d17c85db 100644
--- a/src/librustc/middle/trans/callee.rs
+++ b/src/librustc/middle/trans/callee.rs
@@ -19,8 +19,8 @@
 use arena::TypedArena;
 use back::abi;
 use back::link;
-use lib::llvm::ValueRef;
-use lib::llvm::llvm;
+use llvm;
+use llvm::ValueRef;
 use metadata::csearch;
 use middle::def;
 use middle::subst;
diff --git a/src/librustc/middle/trans/cleanup.rs b/src/librustc/middle/trans/cleanup.rs
index 0485b100446..6e40445d8f9 100644
--- a/src/librustc/middle/trans/cleanup.rs
+++ b/src/librustc/middle/trans/cleanup.rs
@@ -13,7 +13,7 @@
  * drop glue. See discussion in `doc.rs` for a high-level summary.
  */
 
-use lib::llvm::{BasicBlockRef, ValueRef};
+use llvm::{BasicBlockRef, ValueRef};
 use middle::trans::base;
 use middle::trans::build;
 use middle::trans::callee;
diff --git a/src/librustc/middle/trans/closure.rs b/src/librustc/middle/trans/closure.rs
index ef147eb22b5..f2400f6bfef 100644
--- a/src/librustc/middle/trans/closure.rs
+++ b/src/librustc/middle/trans/closure.rs
@@ -12,7 +12,7 @@
 use back::abi;
 use back::link::mangle_internal_name_by_path_and_seq;
 use driver::config::FullDebugInfo;
-use lib::llvm::ValueRef;
+use llvm::ValueRef;
 use middle::def;
 use middle::freevars;
 use middle::lang_items::ClosureExchangeMallocFnLangItem;
diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs
index 23a391cb86d..945185f5953 100644
--- a/src/librustc/middle/trans/common.rs
+++ b/src/librustc/middle/trans/common.rs
@@ -13,10 +13,9 @@
 //! Code that is useful in various trans modules.
 
 use driver::session::Session;
-use lib::llvm::{ValueRef, BasicBlockRef, BuilderRef};
-use lib::llvm::{True, False, Bool};
-use lib::llvm::llvm;
-use lib;
+use llvm;
+use llvm::{ValueRef, BasicBlockRef, BuilderRef};
+use llvm::{True, False, Bool};
 use middle::def;
 use middle::lang_items::LangItem;
 use middle::subst;
@@ -570,7 +569,7 @@ pub fn C_cstr(cx: &CrateContext, s: InternedString, null_terminated: bool) -> Va
         });
         llvm::LLVMSetInitializer(g, sc);
         llvm::LLVMSetGlobalConstant(g, True);
-        lib::llvm::SetLinkage(g, lib::llvm::InternalLinkage);
+        llvm::SetLinkage(g, llvm::InternalLinkage);
 
         cx.const_cstr_cache.borrow_mut().insert(s, g);
         g
@@ -599,7 +598,7 @@ pub fn C_binary_slice(cx: &CrateContext, data: &[u8]) -> ValueRef {
         });
         llvm::LLVMSetInitializer(g, lldata);
         llvm::LLVMSetGlobalConstant(g, True);
-        lib::llvm::SetLinkage(g, lib::llvm::InternalLinkage);
+        llvm::SetLinkage(g, llvm::InternalLinkage);
 
         let cs = llvm::LLVMConstPointerCast(g, Type::i8p(cx).to_ref());
         C_struct(cx, [cs, C_uint(cx, len)], false)
diff --git a/src/librustc/middle/trans/consts.rs b/src/librustc/middle/trans/consts.rs
index 11a8207f8c4..2fd468d8fda 100644
--- a/src/librustc/middle/trans/consts.rs
+++ b/src/librustc/middle/trans/consts.rs
@@ -10,9 +10,10 @@
 
 
 use back::abi;
-use lib::llvm::{llvm, ConstFCmp, ConstICmp, SetLinkage, PrivateLinkage, ValueRef, Bool, True,
+use llvm;
+use llvm::{ConstFCmp, ConstICmp, SetLinkage, PrivateLinkage, ValueRef, Bool, True,
     False};
-use lib::llvm::{IntEQ, IntNE, IntUGT, IntUGE, IntULT, IntULE, IntSGT, IntSGE, IntSLT, IntSLE,
+use llvm::{IntEQ, IntNE, IntUGT, IntUGE, IntULT, IntULE, IntSGT, IntSGE, IntSLT, IntSLE,
     RealOEQ, RealOGT, RealOGE, RealOLT, RealOLE, RealONE};
 
 use metadata::csearch;
diff --git a/src/librustc/middle/trans/context.rs b/src/librustc/middle/trans/context.rs
index 5ee69e02af9..8c55f33a0d4 100644
--- a/src/librustc/middle/trans/context.rs
+++ b/src/librustc/middle/trans/context.rs
@@ -10,9 +10,10 @@
 
 use driver::config::NoDebugInfo;
 use driver::session::Session;
-use lib::llvm::{ContextRef, ModuleRef, ValueRef};
-use lib::llvm::{llvm, TargetData};
-use lib::llvm::mk_target_data;
+use llvm;
+use llvm::{ContextRef, ModuleRef, ValueRef};
+use llvm::{TargetData};
+use llvm::mk_target_data;
 use metadata::common::LinkMeta;
 use middle::resolve;
 use middle::trans::adt;
diff --git a/src/librustc/middle/trans/controlflow.rs b/src/librustc/middle/trans/controlflow.rs
index acc44d08d3c..845684bb037 100644
--- a/src/librustc/middle/trans/controlflow.rs
+++ b/src/librustc/middle/trans/controlflow.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use lib::llvm::*;
+use llvm::*;
 use driver::config::FullDebugInfo;
 use middle::def;
 use middle::lang_items::{FailFnLangItem, FailBoundsCheckFnLangItem};
diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs
index b65f5a5c7d6..d4b2b04745b 100644
--- a/src/librustc/middle/trans/datum.rs
+++ b/src/librustc/middle/trans/datum.rs
@@ -13,7 +13,7 @@
  * Datums are and how they are intended to be used.
  */
 
-use lib::llvm::ValueRef;
+use llvm::ValueRef;
 use middle::trans::base::*;
 use middle::trans::common::*;
 use middle::trans::cleanup;
diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs
index e3af8f93ead..6e81c10c4a0 100644
--- a/src/librustc/middle/trans/debuginfo.rs
+++ b/src/librustc/middle/trans/debuginfo.rs
@@ -180,9 +180,9 @@ seen before (which is most of the time). */
 
 use driver::config;
 use driver::config::{FullDebugInfo, LimitedDebugInfo, NoDebugInfo};
-use lib::llvm::llvm;
-use lib::llvm::{ModuleRef, ContextRef, ValueRef};
-use lib::llvm::debuginfo::*;
+use llvm;
+use llvm::{ModuleRef, ContextRef, ValueRef};
+use llvm::debuginfo::*;
 use metadata::csearch;
 use middle::subst;
 use middle::trans::adt;
diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs
index 516c46564cd..60bf80191cb 100644
--- a/src/librustc/middle/trans/expr.rs
+++ b/src/librustc/middle/trans/expr.rs
@@ -34,8 +34,8 @@
 #![allow(non_camel_case_types)]
 
 use back::abi;
-use lib::llvm::{ValueRef, llvm};
-use lib;
+use llvm;
+use llvm::{ValueRef};
 use metadata::csearch;
 use middle::def;
 use middle::lang_items::MallocFnLangItem;
@@ -548,7 +548,7 @@ fn trans_index<'a>(bcx: &'a Block<'a>,
             debug!("trans_index: base {}", bcx.val_to_string(base));
             debug!("trans_index: len {}", bcx.val_to_string(len));
 
-            let bounds_check = ICmp(bcx, lib::llvm::IntUGE, ix_val, len);
+            let bounds_check = ICmp(bcx, llvm::IntUGE, ix_val, len);
             let expect = ccx.get_intrinsic(&("llvm.expect.i1"));
             let expected = Call(bcx,
                                 expect,
diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs
index f73984d3b36..56fbccefede 100644
--- a/src/librustc/middle/trans/foreign.rs
+++ b/src/librustc/middle/trans/foreign.rs
@@ -10,9 +10,8 @@
 
 
 use back::{link};
-use lib::llvm::llvm;
-use lib::llvm::{ValueRef, CallConv, Linkage};
-use lib;
+use llvm;
+use llvm::{ValueRef, CallConv, Linkage};
 use middle::weak_lang_items;
 use middle::trans::base::push_ctxt;
 use middle::trans::base;
@@ -88,14 +87,14 @@ pub fn llvm_calling_convention(ccx: &CrateContext,
             // It's the ABI's job to select this, not us.
             System => ccx.sess().bug("system abi should be selected elsewhere"),
 
-            Stdcall => lib::llvm::X86StdcallCallConv,
-            Fastcall => lib::llvm::X86FastcallCallConv,
-            C => lib::llvm::CCallConv,
-            Win64 => lib::llvm::X86_64_Win64,
+            Stdcall => llvm::X86StdcallCallConv,
+            Fastcall => llvm::X86FastcallCallConv,
+            C => llvm::CCallConv,
+            Win64 => llvm::X86_64_Win64,
 
             // These API constants ought to be more specific...
-            Cdecl => lib::llvm::CCallConv,
-            Aapcs => lib::llvm::CCallConv,
+            Cdecl => llvm::CCallConv,
+            Aapcs => llvm::CCallConv,
         }
     })
 }
@@ -110,17 +109,17 @@ pub fn llvm_linkage_by_name(name: &str) -> Option<Linkage> {
     // ghost, dllimport, dllexport and linkonce_odr_autohide are not supported
     // and don't have to be, LLVM treats them as no-ops.
     match name {
-        "appending" => Some(lib::llvm::AppendingLinkage),
-        "available_externally" => Some(lib::llvm::AvailableExternallyLinkage),
-        "common" => Some(lib::llvm::CommonLinkage),
-        "extern_weak" => Some(lib::llvm::ExternalWeakLinkage),
-        "external" => Some(lib::llvm::ExternalLinkage),
-        "internal" => Some(lib::llvm::InternalLinkage),
-        "linkonce" => Some(lib::llvm::LinkOnceAnyLinkage),
-        "linkonce_odr" => Some(lib::llvm::LinkOnceODRLinkage),
-        "private" => Some(lib::llvm::PrivateLinkage),
-        "weak" => Some(lib::llvm::WeakAnyLinkage),
-        "weak_odr" => Some(lib::llvm::WeakODRLinkage),
+        "appending" => Some(llvm::AppendingLinkage),
+        "available_externally" => Some(llvm::AvailableExternallyLinkage),
+        "common" => Some(llvm::CommonLinkage),
+        "extern_weak" => Some(llvm::ExternalWeakLinkage),
+        "external" => Some(llvm::ExternalLinkage),
+        "internal" => Some(llvm::InternalLinkage),
+        "linkonce" => Some(llvm::LinkOnceAnyLinkage),
+        "linkonce_odr" => Some(llvm::LinkOnceODRLinkage),
+        "private" => Some(llvm::PrivateLinkage),
+        "weak" => Some(llvm::WeakAnyLinkage),
+        "weak_odr" => Some(llvm::WeakODRLinkage),
         _ => None,
     }
 }
@@ -157,14 +156,14 @@ pub fn register_static(ccx: &CrateContext,
                 let g1 = ident.get().with_c_str(|buf| {
                     llvm::LLVMAddGlobal(ccx.llmod, llty2.to_ref(), buf)
                 });
-                lib::llvm::SetLinkage(g1, linkage);
+                llvm::SetLinkage(g1, linkage);
 
                 let mut real_name = "_rust_extern_with_linkage_".to_string();
                 real_name.push_str(ident.get());
                 let g2 = real_name.with_c_str(|buf| {
                     llvm::LLVMAddGlobal(ccx.llmod, llty.to_ref(), buf)
                 });
-                lib::llvm::SetLinkage(g2, lib::llvm::InternalLinkage);
+                llvm::SetLinkage(g2, llvm::InternalLinkage);
                 llvm::LLVMSetInitializer(g2, g1);
                 g2
             }
@@ -217,7 +216,7 @@ pub fn register_foreign_item_fn(ccx: &CrateContext, abi: Abi, fty: ty::t,
     // Make sure the calling convention is right for variadic functions
     // (should've been caught if not in typeck)
     if tys.fn_sig.variadic {
-        assert!(cc == lib::llvm::CCallConv);
+        assert!(cc == llvm::CCallConv);
     }
 
     // Create the LLVM value for the C extern fn
@@ -347,7 +346,7 @@ pub fn trans_native_call<'a>(
             llarg_rust
         } else {
             if ty::type_is_bool(*passed_arg_tys.get(i)) {
-                let val = LoadRangeAssert(bcx, llarg_rust, 0, 2, lib::llvm::False);
+                let val = LoadRangeAssert(bcx, llarg_rust, 0, 2, llvm::False);
                 Trunc(bcx, val, Type::i1(bcx.ccx()))
             } else {
                 Load(bcx, llarg_rust)
@@ -384,9 +383,9 @@ pub fn trans_native_call<'a>(
     if fn_type.ret_ty.is_indirect() {
         // The outptr can be noalias and nocapture because it's entirely
         // invisible to the program. We can also mark it as nonnull
-        attrs.push((1, lib::llvm::NoAliasAttribute as u64));
-        attrs.push((1, lib::llvm::NoCaptureAttribute as u64));
-        attrs.push((1, lib::llvm::NonNullAttribute as u64));
+        attrs.push((1, llvm::NoAliasAttribute as u64));
+        attrs.push((1, llvm::NoCaptureAttribute as u64));
+        attrs.push((1, llvm::NonNullAttribute as u64));
     };
 
     // Add attributes that depend on the concrete foreign ABI
@@ -531,7 +530,7 @@ pub fn register_rust_fn_with_foreign_abi(ccx: &CrateContext,
     let cconv = match ty::get(t).sty {
         ty::ty_bare_fn(ref fn_ty) => {
             let c = llvm_calling_convention(ccx, fn_ty.abi);
-            c.unwrap_or(lib::llvm::CCallConv)
+            c.unwrap_or(llvm::CCallConv)
         }
         _ => fail!("expected bare fn in register_rust_fn_with_foreign_abi")
     };
@@ -743,7 +742,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: &CrateContext,
                 llforeign_arg
             } else {
                 if ty::type_is_bool(rust_ty) {
-                    let tmp = builder.load_range_assert(llforeign_arg, 0, 2, lib::llvm::False);
+                    let tmp = builder.load_range_assert(llforeign_arg, 0, 2, llvm::False);
                     builder.trunc(tmp, Type::i1(ccx))
                 } else {
                     builder.load(llforeign_arg)
diff --git a/src/librustc/middle/trans/glue.rs b/src/librustc/middle/trans/glue.rs
index 4d9f004e3dc..40065d0bc50 100644
--- a/src/librustc/middle/trans/glue.rs
+++ b/src/librustc/middle/trans/glue.rs
@@ -15,8 +15,8 @@
 
 use back::abi;
 use back::link::*;
-use lib::llvm::{llvm, ValueRef, True};
-use lib;
+use llvm;
+use llvm::{ValueRef, True};
 use middle::lang_items::{FreeFnLangItem, ExchangeFreeFnLangItem};
 use middle::subst;
 use middle::trans::adt;
@@ -492,7 +492,7 @@ fn make_generic_glue(ccx: &CrateContext,
 
     let bcx = init_function(&fcx, false, ty::mk_nil());
 
-    lib::llvm::SetLinkage(llfn, lib::llvm::InternalLinkage);
+    llvm::SetLinkage(llfn, llvm::InternalLinkage);
     ccx.stats.n_glues_created.set(ccx.stats.n_glues_created.get() + 1u);
     // All glue functions take values passed *by alias*; this is a
     // requirement since in many contexts glue is invoked indirectly and
@@ -550,7 +550,7 @@ pub fn emit_tydescs(ccx: &CrateContext) {
             let gvar = ti.tydesc;
             llvm::LLVMSetInitializer(gvar, tydesc);
             llvm::LLVMSetGlobalConstant(gvar, True);
-            lib::llvm::SetLinkage(gvar, lib::llvm::InternalLinkage);
+            llvm::SetLinkage(gvar, llvm::InternalLinkage);
         }
     };
 }
diff --git a/src/librustc/middle/trans/inline.rs b/src/librustc/middle/trans/inline.rs
index f11577482b6..d64eeb727e7 100644
--- a/src/librustc/middle/trans/inline.rs
+++ b/src/librustc/middle/trans/inline.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use lib::llvm::{AvailableExternallyLinkage, SetLinkage};
+use llvm::{AvailableExternallyLinkage, SetLinkage};
 use metadata::csearch;
 use middle::astencode;
 use middle::trans::base::{push_ctxt, trans_item, get_item_val, trans_fn};
diff --git a/src/librustc/middle/trans/intrinsic.rs b/src/librustc/middle/trans/intrinsic.rs
index 309c700bfe8..af5cdf7a1be 100644
--- a/src/librustc/middle/trans/intrinsic.rs
+++ b/src/librustc/middle/trans/intrinsic.rs
@@ -10,8 +10,8 @@
 
 #![allow(non_uppercase_pattern_statics)]
 
-use lib::llvm::{SequentiallyConsistent, Acquire, Release, Xchg, ValueRef};
-use lib;
+use llvm;
+use llvm::{SequentiallyConsistent, Acquire, Release, Xchg, ValueRef};
 use middle::subst;
 use middle::subst::FnSpace;
 use middle::trans::base::*;
diff --git a/src/librustc/middle/trans/llrepr.rs b/src/librustc/middle/trans/llrepr.rs
index f7884ca5643..2740e5695be 100644
--- a/src/librustc/middle/trans/llrepr.rs
+++ b/src/librustc/middle/trans/llrepr.rs
@@ -10,7 +10,7 @@
 
 use middle::trans::context::CrateContext;
 use middle::trans::type_::Type;
-use lib::llvm::ValueRef;
+use llvm::ValueRef;
 
 pub trait LlvmRepr {
     fn llrepr(&self, ccx: &CrateContext) -> String;
diff --git a/src/librustc/middle/trans/machine.rs b/src/librustc/middle/trans/machine.rs
index 7a7e3a9b759..15bbc5ae845 100644
--- a/src/librustc/middle/trans/machine.rs
+++ b/src/librustc/middle/trans/machine.rs
@@ -10,9 +10,9 @@
 
 // Information concerning the machine representation of various types.
 
-use lib::llvm::{ValueRef};
-use lib::llvm::False;
-use lib::llvm::llvm;
+use llvm;
+use llvm::{ValueRef};
+use llvm::False;
 use middle::trans::common::*;
 
 use middle::trans::type_::Type;
diff --git a/src/librustc/middle/trans/meth.rs b/src/librustc/middle/trans/meth.rs
index 6b54556bbe0..092a524e48a 100644
--- a/src/librustc/middle/trans/meth.rs
+++ b/src/librustc/middle/trans/meth.rs
@@ -10,9 +10,8 @@
 
 
 use back::abi;
-use lib::llvm::llvm;
-use lib::llvm::ValueRef;
-use lib;
+use llvm;
+use llvm::ValueRef;
 use metadata::csearch;
 use middle::subst;
 use middle::trans::base::*;
@@ -460,8 +459,8 @@ pub fn make_vtable<I: Iterator<ValueRef>>(ccx: &CrateContext,
             llvm::LLVMAddGlobal(ccx.llmod, val_ty(tbl).to_ref(), buf)
         });
         llvm::LLVMSetInitializer(vt_gvar, tbl);
-        llvm::LLVMSetGlobalConstant(vt_gvar, lib::llvm::True);
-        lib::llvm::SetLinkage(vt_gvar, lib::llvm::InternalLinkage);
+        llvm::LLVMSetGlobalConstant(vt_gvar, llvm::True);
+        llvm::SetLinkage(vt_gvar, llvm::InternalLinkage);
         vt_gvar
     }
 }
diff --git a/src/librustc/middle/trans/monomorphize.rs b/src/librustc/middle/trans/monomorphize.rs
index 01544214ccf..7687e82654a 100644
--- a/src/librustc/middle/trans/monomorphize.rs
+++ b/src/librustc/middle/trans/monomorphize.rs
@@ -10,7 +10,7 @@
 
 use back::link::exported_name;
 use driver::session;
-use lib::llvm::ValueRef;
+use llvm::ValueRef;
 use middle::subst;
 use middle::subst::Subst;
 use middle::trans::base::{set_llvm_fn_attrs, set_inline_hint};
diff --git a/src/librustc/middle/trans/reflect.rs b/src/librustc/middle/trans/reflect.rs
index e50eb8f0be9..bc156fc3791 100644
--- a/src/librustc/middle/trans/reflect.rs
+++ b/src/librustc/middle/trans/reflect.rs
@@ -9,7 +9,8 @@
 // except according to those terms.
 
 use back::link::mangle_internal_name_by_path_and_seq;
-use lib::llvm::{ValueRef, llvm};
+use llvm;
+use llvm::{ValueRef};
 use middle::trans::adt;
 use middle::trans::base::*;
 use middle::trans::build::*;
diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs
index a6e554039e7..07571b2f4c4 100644
--- a/src/librustc/middle/trans/tvec.rs
+++ b/src/librustc/middle/trans/tvec.rs
@@ -11,8 +11,8 @@
 #![allow(non_camel_case_types)]
 
 use back::abi;
-use lib;
-use lib::llvm::{llvm, ValueRef};
+use llvm;
+use llvm::{ValueRef};
 use middle::lang_items::StrDupUniqFnLangItem;
 use middle::trans::base::*;
 use middle::trans::base;
@@ -543,7 +543,7 @@ pub fn iter_vec_loop<'r,
     { // i < count
         let lhs = Load(cond_bcx, loop_counter);
         let rhs = count;
-        let cond_val = ICmp(cond_bcx, lib::llvm::IntULT, lhs, rhs);
+        let cond_val = ICmp(cond_bcx, llvm::IntULT, lhs, rhs);
 
         CondBr(cond_bcx, cond_val, body_bcx.llbb, next_bcx.llbb);
     }
@@ -599,7 +599,7 @@ pub fn iter_vec_raw<'r,
         let data_ptr =
             Phi(header_bcx, val_ty(data_ptr), [data_ptr], [bcx.llbb]);
         let not_yet_at_end =
-            ICmp(header_bcx, lib::llvm::IntULT, data_ptr, data_end_ptr);
+            ICmp(header_bcx, llvm::IntULT, data_ptr, data_end_ptr);
         let body_bcx = fcx.new_temp_block("iter_vec_loop_body");
         let next_bcx = fcx.new_temp_block("iter_vec_next");
         CondBr(header_bcx, not_yet_at_end, body_bcx.llbb, next_bcx.llbb);
diff --git a/src/librustc/middle/trans/type_.rs b/src/librustc/middle/trans/type_.rs
index 54de3996811..10ee8f9ffc7 100644
--- a/src/librustc/middle/trans/type_.rs
+++ b/src/librustc/middle/trans/type_.rs
@@ -10,8 +10,9 @@
 
 #![allow(non_uppercase_pattern_statics)]
 
-use lib::llvm::{llvm, TypeRef, Bool, False, True, TypeKind, ValueRef};
-use lib::llvm::{Float, Double, X86_FP80, PPC_FP128, FP128};
+use llvm;
+use llvm::{TypeRef, Bool, False, True, TypeKind, ValueRef};
+use llvm::{Float, Double, X86_FP80, PPC_FP128, FP128};
 
 use middle::trans::context::CrateContext;
 
diff --git a/src/librustc/middle/trans/value.rs b/src/librustc/middle/trans/value.rs
index e627b859f42..2db6a87a9dc 100644
--- a/src/librustc/middle/trans/value.rs
+++ b/src/librustc/middle/trans/value.rs
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use lib::llvm::{llvm, UseRef, ValueRef};
+use llvm;
+use llvm::{UseRef, ValueRef};
 use middle::trans::basic_block::BasicBlock;
 use middle::trans::common::Block;
 use libc::c_uint;
diff --git a/src/librustc_llvm/archive_ro.rs b/src/librustc_llvm/archive_ro.rs
index 0b0577f7e8c..6c3778787e2 100644
--- a/src/librustc_llvm/archive_ro.rs
+++ b/src/librustc_llvm/archive_ro.rs
@@ -12,7 +12,6 @@
 
 use libc;
 use ArchiveRef;
-use llvm;
 
 use std::raw;
 use std::mem;
@@ -31,7 +30,7 @@ impl ArchiveRO {
     pub fn open(dst: &Path) -> Option<ArchiveRO> {
         unsafe {
             let ar = dst.with_c_str(|dst| {
-                llvm::LLVMRustOpenArchive(dst)
+                ::LLVMRustOpenArchive(dst)
             });
             if ar.is_null() {
                 None
@@ -46,7 +45,7 @@ impl ArchiveRO {
         unsafe {
             let mut size = 0 as libc::size_t;
             let ptr = file.with_c_str(|file| {
-                llvm::LLVMRustArchiveReadSection(self.ptr, file, &mut size)
+                ::LLVMRustArchiveReadSection(self.ptr, file, &mut size)
             });
             if ptr.is_null() {
                 None
@@ -63,7 +62,7 @@ impl ArchiveRO {
 impl Drop for ArchiveRO {
     fn drop(&mut self) {
         unsafe {
-            llvm::LLVMRustDestroyArchive(self.ptr);
+            ::LLVMRustDestroyArchive(self.ptr);
         }
     }
 }
diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs
index f46a41835f6..3d0c5a82170 100644
--- a/src/librustc_llvm/lib.rs
+++ b/src/librustc_llvm/lib.rs
@@ -30,7 +30,12 @@
 extern crate libc;
 
 use std::c_str::ToCStr;
-use libc::{c_uint, c_ushort, uint64_t, c_int, size_t};
+use libc::{c_uint, c_ushort, uint64_t, c_int, size_t, c_char};
+use libc::{c_longlong, c_ulonglong};
+use debuginfo::{DIBuilderRef, DIDescriptor,
+                DIFile, DILexicalBlock, DISubprogram, DIType,
+                DIBasicType, DIDerivedType, DICompositeType,
+                DIVariable, DIGlobalVariable, DIArray, DISubrange};
 
 pub mod archive_ro;
 
@@ -340,1538 +345,1527 @@ pub mod debuginfo {
     }
 }
 
-pub mod llvm {
-    use super::{AtomicBinOp, AtomicOrdering, BasicBlockRef, ExecutionEngineRef};
-    use super::{Bool, BuilderRef, ContextRef, MemoryBufferRef, ModuleRef};
-    use super::{ObjectFileRef, Opcode, PassManagerRef, PassManagerBuilderRef};
-    use super::{SectionIteratorRef, TargetDataRef, TypeKind, TypeRef, UseRef};
-    use super::{ValueRef, TargetMachineRef, FileType, ArchiveRef};
-    use super::{CodeGenModel, RelocMode, CodeGenOptLevel};
-    use super::debuginfo::*;
-    use libc::{c_char, c_int, c_longlong, c_ushort, c_uint, c_ulonglong,
-               size_t, uint64_t};
-
-    // Link to our native llvm bindings (things that we need to use the C++ api
-    // for) and because llvm is written in C++ we need to link against libstdc++
-    //
-    // You'll probably notice that there is an omission of all LLVM libraries
-    // from this location. This is because the set of LLVM libraries that we
-    // link to is mostly defined by LLVM, and the `llvm-config` tool is used to
-    // figure out the exact set of libraries. To do this, the build system
-    // generates an llvmdeps.rs file next to this one which will be
-    // automatically updated whenever LLVM is updated to include an up-to-date
-    // set of the libraries we need to link to LLVM for.
-    #[link(name = "rustllvm", kind = "static")]
-    extern {
-        /* Create and destroy contexts. */
-        pub fn LLVMContextCreate() -> ContextRef;
-        pub fn LLVMContextDispose(C: ContextRef);
-        pub fn LLVMGetMDKindIDInContext(C: ContextRef,
-                                        Name: *const c_char,
-                                        SLen: c_uint)
-                                        -> c_uint;
 
-        /* Create and destroy modules. */
-        pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char,
-                                                 C: ContextRef)
-                                                 -> ModuleRef;
-        pub fn LLVMGetModuleContext(M: ModuleRef) -> ContextRef;
-        pub fn LLVMDisposeModule(M: ModuleRef);
-
-        /** Data layout. See Module::getDataLayout. */
-        pub fn LLVMGetDataLayout(M: ModuleRef) -> *const c_char;
-        pub fn LLVMSetDataLayout(M: ModuleRef, Triple: *const c_char);
-
-        /** Target triple. See Module::getTargetTriple. */
-        pub fn LLVMGetTarget(M: ModuleRef) -> *const c_char;
-        pub fn LLVMSetTarget(M: ModuleRef, Triple: *const c_char);
-
-        /** See Module::dump. */
-        pub fn LLVMDumpModule(M: ModuleRef);
-
-        /** See Module::setModuleInlineAsm. */
-        pub fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *const c_char);
-
-        /** See llvm::LLVMTypeKind::getTypeID. */
-        pub fn LLVMGetTypeKind(Ty: TypeRef) -> TypeKind;
-
-        /** See llvm::LLVMType::getContext. */
-        pub fn LLVMGetTypeContext(Ty: TypeRef) -> ContextRef;
-
-        /* Operations on integer types */
-        pub fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef;
-        pub fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef;
-        pub fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef;
-        pub fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef;
-        pub fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef;
-        pub fn LLVMIntTypeInContext(C: ContextRef, NumBits: c_uint)
-                                    -> TypeRef;
-
-        pub fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> c_uint;
-
-        /* Operations on real types */
-        pub fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef;
-        pub fn LLVMDoubleTypeInContext(C: ContextRef) -> TypeRef;
-        pub fn LLVMX86FP80TypeInContext(C: ContextRef) -> TypeRef;
-        pub fn LLVMFP128TypeInContext(C: ContextRef) -> TypeRef;
-        pub fn LLVMPPCFP128TypeInContext(C: ContextRef) -> TypeRef;
-
-        /* Operations on function types */
-        pub fn LLVMFunctionType(ReturnType: TypeRef,
-                                ParamTypes: *const TypeRef,
-                                ParamCount: c_uint,
-                                IsVarArg: Bool)
+// Link to our native llvm bindings (things that we need to use the C++ api
+// for) and because llvm is written in C++ we need to link against libstdc++
+//
+// You'll probably notice that there is an omission of all LLVM libraries
+// from this location. This is because the set of LLVM libraries that we
+// link to is mostly defined by LLVM, and the `llvm-config` tool is used to
+// figure out the exact set of libraries. To do this, the build system
+// generates an llvmdeps.rs file next to this one which will be
+// automatically updated whenever LLVM is updated to include an up-to-date
+// set of the libraries we need to link to LLVM for.
+#[link(name = "rustllvm", kind = "static")]
+extern {
+    /* Create and destroy contexts. */
+    pub fn LLVMContextCreate() -> ContextRef;
+    pub fn LLVMContextDispose(C: ContextRef);
+    pub fn LLVMGetMDKindIDInContext(C: ContextRef,
+                                    Name: *const c_char,
+                                    SLen: c_uint)
+                                    -> c_uint;
+
+    /* Create and destroy modules. */
+    pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char,
+                                             C: ContextRef)
+                                             -> ModuleRef;
+    pub fn LLVMGetModuleContext(M: ModuleRef) -> ContextRef;
+    pub fn LLVMDisposeModule(M: ModuleRef);
+
+    /** Data layout. See Module::getDataLayout. */
+    pub fn LLVMGetDataLayout(M: ModuleRef) -> *const c_char;
+    pub fn LLVMSetDataLayout(M: ModuleRef, Triple: *const c_char);
+
+    /** Target triple. See Module::getTargetTriple. */
+    pub fn LLVMGetTarget(M: ModuleRef) -> *const c_char;
+    pub fn LLVMSetTarget(M: ModuleRef, Triple: *const c_char);
+
+    /** See Module::dump. */
+    pub fn LLVMDumpModule(M: ModuleRef);
+
+    /** See Module::setModuleInlineAsm. */
+    pub fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *const c_char);
+
+    /** See llvm::LLVMTypeKind::getTypeID. */
+    pub fn LLVMGetTypeKind(Ty: TypeRef) -> TypeKind;
+
+    /** See llvm::LLVMType::getContext. */
+    pub fn LLVMGetTypeContext(Ty: TypeRef) -> ContextRef;
+
+    /* Operations on integer types */
+    pub fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef;
+    pub fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef;
+    pub fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef;
+    pub fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef;
+    pub fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef;
+    pub fn LLVMIntTypeInContext(C: ContextRef, NumBits: c_uint)
                                 -> TypeRef;
-        pub fn LLVMIsFunctionVarArg(FunctionTy: TypeRef) -> Bool;
-        pub fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
-        pub fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint;
-        pub fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *const TypeRef);
-
-        /* Operations on struct types */
-        pub fn LLVMStructTypeInContext(C: ContextRef,
-                                       ElementTypes: *const TypeRef,
-                                       ElementCount: c_uint,
-                                       Packed: Bool)
-                                       -> TypeRef;
-        pub fn LLVMCountStructElementTypes(StructTy: TypeRef) -> c_uint;
-        pub fn LLVMGetStructElementTypes(StructTy: TypeRef,
-                                         Dest: *mut TypeRef);
-        pub fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
-
-        /* Operations on array, pointer, and vector types (sequence types) */
-        pub fn LLVMRustArrayType(ElementType: TypeRef, ElementCount: u64) -> TypeRef;
-        pub fn LLVMPointerType(ElementType: TypeRef, AddressSpace: c_uint)
-                               -> TypeRef;
-        pub fn LLVMVectorType(ElementType: TypeRef, ElementCount: c_uint)
-                              -> TypeRef;
-
-        pub fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
-        pub fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint;
-        pub fn LLVMGetPointerAddressSpace(PointerTy: TypeRef) -> c_uint;
-        pub fn LLVMGetPointerToGlobal(EE: ExecutionEngineRef, V: ValueRef)
-                                      -> *const ();
-        pub fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint;
-
-        /* Operations on other types */
-        pub fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
-        pub fn LLVMLabelTypeInContext(C: ContextRef) -> TypeRef;
-        pub fn LLVMMetadataTypeInContext(C: ContextRef) -> TypeRef;
-
-        /* Operations on all values */
-        pub fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
-        pub fn LLVMGetValueName(Val: ValueRef) -> *const c_char;
-        pub fn LLVMSetValueName(Val: ValueRef, Name: *const c_char);
-        pub fn LLVMDumpValue(Val: ValueRef);
-        pub fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
-        pub fn LLVMHasMetadata(Val: ValueRef) -> c_int;
-        pub fn LLVMGetMetadata(Val: ValueRef, KindID: c_uint) -> ValueRef;
-        pub fn LLVMSetMetadata(Val: ValueRef, KindID: c_uint, Node: ValueRef);
-
-        /* Operations on Uses */
-        pub fn LLVMGetFirstUse(Val: ValueRef) -> UseRef;
-        pub fn LLVMGetNextUse(U: UseRef) -> UseRef;
-        pub fn LLVMGetUser(U: UseRef) -> ValueRef;
-        pub fn LLVMGetUsedValue(U: UseRef) -> ValueRef;
-
-        /* Operations on Users */
-        pub fn LLVMGetNumOperands(Val: ValueRef) -> c_int;
-        pub fn LLVMGetOperand(Val: ValueRef, Index: c_uint) -> ValueRef;
-        pub fn LLVMSetOperand(Val: ValueRef, Index: c_uint, Op: ValueRef);
-
-        /* Operations on constants of any type */
-        pub fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
-        /* all zeroes */
-        pub fn LLVMConstAllOnes(Ty: TypeRef) -> ValueRef;
-        pub fn LLVMConstICmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef)
-                             -> ValueRef;
-        pub fn LLVMConstFCmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef)
-                             -> ValueRef;
-        /* only for int/vector */
-        pub fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
-        pub fn LLVMIsConstant(Val: ValueRef) -> Bool;
-        pub fn LLVMIsNull(Val: ValueRef) -> Bool;
-        pub fn LLVMIsUndef(Val: ValueRef) -> Bool;
-        pub fn LLVMConstPointerNull(Ty: TypeRef) -> ValueRef;
-
-        /* Operations on metadata */
-        pub fn LLVMMDStringInContext(C: ContextRef,
-                                     Str: *const c_char,
-                                     SLen: c_uint)
-                                     -> ValueRef;
-        pub fn LLVMMDNodeInContext(C: ContextRef,
-                                   Vals: *const ValueRef,
-                                   Count: c_uint)
-                                   -> ValueRef;
-        pub fn LLVMAddNamedMetadataOperand(M: ModuleRef,
-                                           Str: *const c_char,
-                                           Val: ValueRef);
 
-        /* Operations on scalar constants */
-        pub fn LLVMConstInt(IntTy: TypeRef, N: c_ulonglong, SignExtend: Bool)
-                            -> ValueRef;
-        pub fn LLVMConstIntOfString(IntTy: TypeRef, Text: *const c_char, Radix: u8)
-                                    -> ValueRef;
-        pub fn LLVMConstIntOfStringAndSize(IntTy: TypeRef,
-                                           Text: *const c_char,
-                                           SLen: c_uint,
-                                           Radix: u8)
-                                           -> ValueRef;
-        pub fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
-        pub fn LLVMConstRealOfString(RealTy: TypeRef, Text: *const c_char)
-                                     -> ValueRef;
-        pub fn LLVMConstRealOfStringAndSize(RealTy: TypeRef,
-                                            Text: *const c_char,
-                                            SLen: c_uint)
-                                            -> ValueRef;
-        pub fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> c_ulonglong;
-        pub fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> c_longlong;
+    pub fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> c_uint;
+
+    /* Operations on real types */
+    pub fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef;
+    pub fn LLVMDoubleTypeInContext(C: ContextRef) -> TypeRef;
+    pub fn LLVMX86FP80TypeInContext(C: ContextRef) -> TypeRef;
+    pub fn LLVMFP128TypeInContext(C: ContextRef) -> TypeRef;
+    pub fn LLVMPPCFP128TypeInContext(C: ContextRef) -> TypeRef;
+
+    /* Operations on function types */
+    pub fn LLVMFunctionType(ReturnType: TypeRef,
+                            ParamTypes: *const TypeRef,
+                            ParamCount: c_uint,
+                            IsVarArg: Bool)
+                            -> TypeRef;
+    pub fn LLVMIsFunctionVarArg(FunctionTy: TypeRef) -> Bool;
+    pub fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
+    pub fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint;
+    pub fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *const TypeRef);
+
+    /* Operations on struct types */
+    pub fn LLVMStructTypeInContext(C: ContextRef,
+                                   ElementTypes: *const TypeRef,
+                                   ElementCount: c_uint,
+                                   Packed: Bool)
+                                   -> TypeRef;
+    pub fn LLVMCountStructElementTypes(StructTy: TypeRef) -> c_uint;
+    pub fn LLVMGetStructElementTypes(StructTy: TypeRef,
+                                     Dest: *mut TypeRef);
+    pub fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
+
+    /* Operations on array, pointer, and vector types (sequence types) */
+    pub fn LLVMRustArrayType(ElementType: TypeRef, ElementCount: u64) -> TypeRef;
+    pub fn LLVMPointerType(ElementType: TypeRef, AddressSpace: c_uint)
+                           -> TypeRef;
+    pub fn LLVMVectorType(ElementType: TypeRef, ElementCount: c_uint)
+                          -> TypeRef;
+
+    pub fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
+    pub fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint;
+    pub fn LLVMGetPointerAddressSpace(PointerTy: TypeRef) -> c_uint;
+    pub fn LLVMGetPointerToGlobal(EE: ExecutionEngineRef, V: ValueRef)
+                                  -> *const ();
+    pub fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint;
+
+    /* Operations on other types */
+    pub fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
+    pub fn LLVMLabelTypeInContext(C: ContextRef) -> TypeRef;
+    pub fn LLVMMetadataTypeInContext(C: ContextRef) -> TypeRef;
+
+    /* Operations on all values */
+    pub fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
+    pub fn LLVMGetValueName(Val: ValueRef) -> *const c_char;
+    pub fn LLVMSetValueName(Val: ValueRef, Name: *const c_char);
+    pub fn LLVMDumpValue(Val: ValueRef);
+    pub fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
+    pub fn LLVMHasMetadata(Val: ValueRef) -> c_int;
+    pub fn LLVMGetMetadata(Val: ValueRef, KindID: c_uint) -> ValueRef;
+    pub fn LLVMSetMetadata(Val: ValueRef, KindID: c_uint, Node: ValueRef);
+
+    /* Operations on Uses */
+    pub fn LLVMGetFirstUse(Val: ValueRef) -> UseRef;
+    pub fn LLVMGetNextUse(U: UseRef) -> UseRef;
+    pub fn LLVMGetUser(U: UseRef) -> ValueRef;
+    pub fn LLVMGetUsedValue(U: UseRef) -> ValueRef;
+
+    /* Operations on Users */
+    pub fn LLVMGetNumOperands(Val: ValueRef) -> c_int;
+    pub fn LLVMGetOperand(Val: ValueRef, Index: c_uint) -> ValueRef;
+    pub fn LLVMSetOperand(Val: ValueRef, Index: c_uint, Op: ValueRef);
+
+    /* Operations on constants of any type */
+    pub fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
+    /* all zeroes */
+    pub fn LLVMConstAllOnes(Ty: TypeRef) -> ValueRef;
+    pub fn LLVMConstICmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef)
+                         -> ValueRef;
+    pub fn LLVMConstFCmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef)
+                         -> ValueRef;
+    /* only for int/vector */
+    pub fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
+    pub fn LLVMIsConstant(Val: ValueRef) -> Bool;
+    pub fn LLVMIsNull(Val: ValueRef) -> Bool;
+    pub fn LLVMIsUndef(Val: ValueRef) -> Bool;
+    pub fn LLVMConstPointerNull(Ty: TypeRef) -> ValueRef;
+
+    /* Operations on metadata */
+    pub fn LLVMMDStringInContext(C: ContextRef,
+                                 Str: *const c_char,
+                                 SLen: c_uint)
+                                 -> ValueRef;
+    pub fn LLVMMDNodeInContext(C: ContextRef,
+                               Vals: *const ValueRef,
+                               Count: c_uint)
+                               -> ValueRef;
+    pub fn LLVMAddNamedMetadataOperand(M: ModuleRef,
+                                       Str: *const c_char,
+                                       Val: ValueRef);
+
+    /* Operations on scalar constants */
+    pub fn LLVMConstInt(IntTy: TypeRef, N: c_ulonglong, SignExtend: Bool)
+                        -> ValueRef;
+    pub fn LLVMConstIntOfString(IntTy: TypeRef, Text: *const c_char, Radix: u8)
+                                -> ValueRef;
+    pub fn LLVMConstIntOfStringAndSize(IntTy: TypeRef,
+                                       Text: *const c_char,
+                                       SLen: c_uint,
+                                       Radix: u8)
+                                       -> ValueRef;
+    pub fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
+    pub fn LLVMConstRealOfString(RealTy: TypeRef, Text: *const c_char)
+                                 -> ValueRef;
+    pub fn LLVMConstRealOfStringAndSize(RealTy: TypeRef,
+                                        Text: *const c_char,
+                                        SLen: c_uint)
+                                        -> ValueRef;
+    pub fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> c_ulonglong;
+    pub fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> c_longlong;
 
 
-        /* Operations on composite constants */
-        pub fn LLVMConstStringInContext(C: ContextRef,
-                                        Str: *const c_char,
-                                        Length: c_uint,
-                                        DontNullTerminate: Bool)
-                                        -> ValueRef;
-        pub fn LLVMConstStructInContext(C: ContextRef,
-                                        ConstantVals: *const ValueRef,
-                                        Count: c_uint,
-                                        Packed: Bool)
-                                        -> ValueRef;
+    /* Operations on composite constants */
+    pub fn LLVMConstStringInContext(C: ContextRef,
+                                    Str: *const c_char,
+                                    Length: c_uint,
+                                    DontNullTerminate: Bool)
+                                    -> ValueRef;
+    pub fn LLVMConstStructInContext(C: ContextRef,
+                                    ConstantVals: *const ValueRef,
+                                    Count: c_uint,
+                                    Packed: Bool)
+                                    -> ValueRef;
 
-        pub fn LLVMConstArray(ElementTy: TypeRef,
-                              ConstantVals: *const ValueRef,
-                              Length: c_uint)
-                              -> ValueRef;
-        pub fn LLVMConstVector(ScalarConstantVals: *const ValueRef, Size: c_uint)
-                               -> ValueRef;
+    pub fn LLVMConstArray(ElementTy: TypeRef,
+                          ConstantVals: *const ValueRef,
+                          Length: c_uint)
+                          -> ValueRef;
+    pub fn LLVMConstVector(ScalarConstantVals: *const ValueRef, Size: c_uint)
+                           -> ValueRef;
 
-        /* Constant expressions */
-        pub fn LLVMAlignOf(Ty: TypeRef) -> ValueRef;
-        pub fn LLVMSizeOf(Ty: TypeRef) -> ValueRef;
-        pub fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef;
-        pub fn LLVMConstNSWNeg(ConstantVal: ValueRef) -> ValueRef;
-        pub fn LLVMConstNUWNeg(ConstantVal: ValueRef) -> ValueRef;
-        pub fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef;
-        pub fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef;
-        pub fn LLVMConstAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
+    /* Constant expressions */
+    pub fn LLVMAlignOf(Ty: TypeRef) -> ValueRef;
+    pub fn LLVMSizeOf(Ty: TypeRef) -> ValueRef;
+    pub fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef;
+    pub fn LLVMConstNSWNeg(ConstantVal: ValueRef) -> ValueRef;
+    pub fn LLVMConstNUWNeg(ConstantVal: ValueRef) -> ValueRef;
+    pub fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef;
+    pub fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef;
+    pub fn LLVMConstAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                        -> ValueRef;
+    pub fn LLVMConstNSWAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                           -> ValueRef;
+    pub fn LLVMConstNUWAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                           -> ValueRef;
+    pub fn LLVMConstFAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                         -> ValueRef;
+    pub fn LLVMConstSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                        -> ValueRef;
+    pub fn LLVMConstNSWSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                           -> ValueRef;
+    pub fn LLVMConstNUWSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                           -> ValueRef;
+    pub fn LLVMConstFSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                         -> ValueRef;
+    pub fn LLVMConstMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                        -> ValueRef;
+    pub fn LLVMConstNSWMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                           -> ValueRef;
+    pub fn LLVMConstNUWMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                           -> ValueRef;
+    pub fn LLVMConstFMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                         -> ValueRef;
+    pub fn LLVMConstUDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                         -> ValueRef;
+    pub fn LLVMConstSDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                         -> ValueRef;
+    pub fn LLVMConstExactSDiv(LHSConstant: ValueRef,
+                              RHSConstant: ValueRef)
+                              -> ValueRef;
+    pub fn LLVMConstFDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                         -> ValueRef;
+    pub fn LLVMConstURem(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                         -> ValueRef;
+    pub fn LLVMConstSRem(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                         -> ValueRef;
+    pub fn LLVMConstFRem(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                         -> ValueRef;
+    pub fn LLVMConstAnd(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                        -> ValueRef;
+    pub fn LLVMConstOr(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                       -> ValueRef;
+    pub fn LLVMConstXor(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                        -> ValueRef;
+    pub fn LLVMConstShl(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                        -> ValueRef;
+    pub fn LLVMConstLShr(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                         -> ValueRef;
+    pub fn LLVMConstAShr(LHSConstant: ValueRef, RHSConstant: ValueRef)
+                         -> ValueRef;
+    pub fn LLVMConstGEP(ConstantVal: ValueRef,
+                        ConstantIndices: *const ValueRef,
+                        NumIndices: c_uint)
+                        -> ValueRef;
+    pub fn LLVMConstInBoundsGEP(ConstantVal: ValueRef,
+                                ConstantIndices: *const ValueRef,
+                                NumIndices: c_uint)
+                                -> ValueRef;
+    pub fn LLVMConstTrunc(ConstantVal: ValueRef, ToType: TypeRef)
+                          -> ValueRef;
+    pub fn LLVMConstSExt(ConstantVal: ValueRef, ToType: TypeRef)
+                         -> ValueRef;
+    pub fn LLVMConstZExt(ConstantVal: ValueRef, ToType: TypeRef)
+                         -> ValueRef;
+    pub fn LLVMConstFPTrunc(ConstantVal: ValueRef, ToType: TypeRef)
                             -> ValueRef;
-        pub fn LLVMConstNSWAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
-                               -> ValueRef;
-        pub fn LLVMConstNUWAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
-                               -> ValueRef;
-        pub fn LLVMConstFAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
+    pub fn LLVMConstFPExt(ConstantVal: ValueRef, ToType: TypeRef)
+                          -> ValueRef;
+    pub fn LLVMConstUIToFP(ConstantVal: ValueRef, ToType: TypeRef)
+                           -> ValueRef;
+    pub fn LLVMConstSIToFP(ConstantVal: ValueRef, ToType: TypeRef)
+                           -> ValueRef;
+    pub fn LLVMConstFPToUI(ConstantVal: ValueRef, ToType: TypeRef)
+                           -> ValueRef;
+    pub fn LLVMConstFPToSI(ConstantVal: ValueRef, ToType: TypeRef)
+                           -> ValueRef;
+    pub fn LLVMConstPtrToInt(ConstantVal: ValueRef, ToType: TypeRef)
                              -> ValueRef;
-        pub fn LLVMConstSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
-                            -> ValueRef;
-        pub fn LLVMConstNSWSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
-                               -> ValueRef;
-        pub fn LLVMConstNUWSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
-                               -> ValueRef;
-        pub fn LLVMConstFSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
+    pub fn LLVMConstIntToPtr(ConstantVal: ValueRef, ToType: TypeRef)
                              -> ValueRef;
-        pub fn LLVMConstMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
+    pub fn LLVMConstBitCast(ConstantVal: ValueRef, ToType: TypeRef)
                             -> ValueRef;
-        pub fn LLVMConstNSWMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
-                               -> ValueRef;
-        pub fn LLVMConstNUWMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
-                               -> ValueRef;
-        pub fn LLVMConstFMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
-                             -> ValueRef;
-        pub fn LLVMConstUDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
-                             -> ValueRef;
-        pub fn LLVMConstSDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
-                             -> ValueRef;
-        pub fn LLVMConstExactSDiv(LHSConstant: ValueRef,
-                                  RHSConstant: ValueRef)
+    pub fn LLVMConstZExtOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
                                   -> ValueRef;
-        pub fn LLVMConstFDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
-                             -> ValueRef;
-        pub fn LLVMConstURem(LHSConstant: ValueRef, RHSConstant: ValueRef)
-                             -> ValueRef;
-        pub fn LLVMConstSRem(LHSConstant: ValueRef, RHSConstant: ValueRef)
-                             -> ValueRef;
-        pub fn LLVMConstFRem(LHSConstant: ValueRef, RHSConstant: ValueRef)
-                             -> ValueRef;
-        pub fn LLVMConstAnd(LHSConstant: ValueRef, RHSConstant: ValueRef)
+    pub fn LLVMConstSExtOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
+                                  -> ValueRef;
+    pub fn LLVMConstTruncOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
+                                   -> ValueRef;
+    pub fn LLVMConstPointerCast(ConstantVal: ValueRef, ToType: TypeRef)
+                                -> ValueRef;
+    pub fn LLVMConstIntCast(ConstantVal: ValueRef,
+                            ToType: TypeRef,
+                            isSigned: Bool)
                             -> ValueRef;
-        pub fn LLVMConstOr(LHSConstant: ValueRef, RHSConstant: ValueRef)
+    pub fn LLVMConstFPCast(ConstantVal: ValueRef, ToType: TypeRef)
                            -> ValueRef;
-        pub fn LLVMConstXor(LHSConstant: ValueRef, RHSConstant: ValueRef)
-                            -> ValueRef;
-        pub fn LLVMConstShl(LHSConstant: ValueRef, RHSConstant: ValueRef)
-                            -> ValueRef;
-        pub fn LLVMConstLShr(LHSConstant: ValueRef, RHSConstant: ValueRef)
-                             -> ValueRef;
-        pub fn LLVMConstAShr(LHSConstant: ValueRef, RHSConstant: ValueRef)
-                             -> ValueRef;
-        pub fn LLVMConstGEP(ConstantVal: ValueRef,
-                            ConstantIndices: *const ValueRef,
-                            NumIndices: c_uint)
-                            -> ValueRef;
-        pub fn LLVMConstInBoundsGEP(ConstantVal: ValueRef,
-                                    ConstantIndices: *const ValueRef,
-                                    NumIndices: c_uint)
-                                    -> ValueRef;
-        pub fn LLVMConstTrunc(ConstantVal: ValueRef, ToType: TypeRef)
-                              -> ValueRef;
-        pub fn LLVMConstSExt(ConstantVal: ValueRef, ToType: TypeRef)
-                             -> ValueRef;
-        pub fn LLVMConstZExt(ConstantVal: ValueRef, ToType: TypeRef)
-                             -> ValueRef;
-        pub fn LLVMConstFPTrunc(ConstantVal: ValueRef, ToType: TypeRef)
-                                -> ValueRef;
-        pub fn LLVMConstFPExt(ConstantVal: ValueRef, ToType: TypeRef)
-                              -> ValueRef;
-        pub fn LLVMConstUIToFP(ConstantVal: ValueRef, ToType: TypeRef)
-                               -> ValueRef;
-        pub fn LLVMConstSIToFP(ConstantVal: ValueRef, ToType: TypeRef)
-                               -> ValueRef;
-        pub fn LLVMConstFPToUI(ConstantVal: ValueRef, ToType: TypeRef)
-                               -> ValueRef;
-        pub fn LLVMConstFPToSI(ConstantVal: ValueRef, ToType: TypeRef)
-                               -> ValueRef;
-        pub fn LLVMConstPtrToInt(ConstantVal: ValueRef, ToType: TypeRef)
-                                 -> ValueRef;
-        pub fn LLVMConstIntToPtr(ConstantVal: ValueRef, ToType: TypeRef)
+    pub fn LLVMConstSelect(ConstantCondition: ValueRef,
+                           ConstantIfTrue: ValueRef,
+                           ConstantIfFalse: ValueRef)
+                           -> ValueRef;
+    pub fn LLVMConstExtractElement(VectorConstant: ValueRef,
+                                   IndexConstant: ValueRef)
+                                   -> ValueRef;
+    pub fn LLVMConstInsertElement(VectorConstant: ValueRef,
+                                  ElementValueConstant: ValueRef,
+                                  IndexConstant: ValueRef)
+                                  -> ValueRef;
+    pub fn LLVMConstShuffleVector(VectorAConstant: ValueRef,
+                                  VectorBConstant: ValueRef,
+                                  MaskConstant: ValueRef)
+                                  -> ValueRef;
+    pub fn LLVMConstExtractValue(AggConstant: ValueRef,
+                                 IdxList: *const c_uint,
+                                 NumIdx: c_uint)
                                  -> ValueRef;
-        pub fn LLVMConstBitCast(ConstantVal: ValueRef, ToType: TypeRef)
-                                -> ValueRef;
-        pub fn LLVMConstZExtOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
-                                      -> ValueRef;
-        pub fn LLVMConstSExtOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
-                                      -> ValueRef;
-        pub fn LLVMConstTruncOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
-                                       -> ValueRef;
-        pub fn LLVMConstPointerCast(ConstantVal: ValueRef, ToType: TypeRef)
-                                    -> ValueRef;
-        pub fn LLVMConstIntCast(ConstantVal: ValueRef,
-                                ToType: TypeRef,
-                                isSigned: Bool)
+    pub fn LLVMConstInsertValue(AggConstant: ValueRef,
+                                ElementValueConstant: ValueRef,
+                                IdxList: *const c_uint,
+                                NumIdx: c_uint)
                                 -> ValueRef;
-        pub fn LLVMConstFPCast(ConstantVal: ValueRef, ToType: TypeRef)
-                               -> ValueRef;
-        pub fn LLVMConstSelect(ConstantCondition: ValueRef,
-                               ConstantIfTrue: ValueRef,
-                               ConstantIfFalse: ValueRef)
-                               -> ValueRef;
-        pub fn LLVMConstExtractElement(VectorConstant: ValueRef,
-                                       IndexConstant: ValueRef)
-                                       -> ValueRef;
-        pub fn LLVMConstInsertElement(VectorConstant: ValueRef,
-                                      ElementValueConstant: ValueRef,
-                                      IndexConstant: ValueRef)
-                                      -> ValueRef;
-        pub fn LLVMConstShuffleVector(VectorAConstant: ValueRef,
-                                      VectorBConstant: ValueRef,
-                                      MaskConstant: ValueRef)
-                                      -> ValueRef;
-        pub fn LLVMConstExtractValue(AggConstant: ValueRef,
-                                     IdxList: *const c_uint,
-                                     NumIdx: c_uint)
-                                     -> ValueRef;
-        pub fn LLVMConstInsertValue(AggConstant: ValueRef,
-                                    ElementValueConstant: ValueRef,
-                                    IdxList: *const c_uint,
-                                    NumIdx: c_uint)
-                                    -> ValueRef;
-        pub fn LLVMConstInlineAsm(Ty: TypeRef,
-                                  AsmString: *const c_char,
-                                  Constraints: *const c_char,
-                                  HasSideEffects: Bool,
-                                  IsAlignStack: Bool)
-                                  -> ValueRef;
-        pub fn LLVMBlockAddress(F: ValueRef, BB: BasicBlockRef) -> ValueRef;
-
+    pub fn LLVMConstInlineAsm(Ty: TypeRef,
+                              AsmString: *const c_char,
+                              Constraints: *const c_char,
+                              HasSideEffects: Bool,
+                              IsAlignStack: Bool)
+                              -> ValueRef;
+    pub fn LLVMBlockAddress(F: ValueRef, BB: BasicBlockRef) -> ValueRef;
 
 
-        /* Operations on global variables, functions, and aliases (globals) */
-        pub fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef;
-        pub fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
-        pub fn LLVMGetLinkage(Global: ValueRef) -> c_uint;
-        pub fn LLVMSetLinkage(Global: ValueRef, Link: c_uint);
-        pub fn LLVMGetSection(Global: ValueRef) -> *const c_char;
-        pub fn LLVMSetSection(Global: ValueRef, Section: *const c_char);
-        pub fn LLVMGetVisibility(Global: ValueRef) -> c_uint;
-        pub fn LLVMSetVisibility(Global: ValueRef, Viz: c_uint);
-        pub fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
-        pub fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint);
 
+    /* Operations on global variables, functions, and aliases (globals) */
+    pub fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef;
+    pub fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
+    pub fn LLVMGetLinkage(Global: ValueRef) -> c_uint;
+    pub fn LLVMSetLinkage(Global: ValueRef, Link: c_uint);
+    pub fn LLVMGetSection(Global: ValueRef) -> *const c_char;
+    pub fn LLVMSetSection(Global: ValueRef, Section: *const c_char);
+    pub fn LLVMGetVisibility(Global: ValueRef) -> c_uint;
+    pub fn LLVMSetVisibility(Global: ValueRef, Viz: c_uint);
+    pub fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
+    pub fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint);
 
-        /* Operations on global variables */
-        pub fn LLVMAddGlobal(M: ModuleRef, Ty: TypeRef, Name: *const c_char)
-                             -> ValueRef;
-        pub fn LLVMAddGlobalInAddressSpace(M: ModuleRef,
-                                           Ty: TypeRef,
-                                           Name: *const c_char,
-                                           AddressSpace: c_uint)
-                                           -> ValueRef;
-        pub fn LLVMGetNamedGlobal(M: ModuleRef, Name: *const c_char) -> ValueRef;
-        pub fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
-        pub fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef;
-        pub fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
-        pub fn LLVMGetPreviousGlobal(GlobalVar: ValueRef) -> ValueRef;
-        pub fn LLVMDeleteGlobal(GlobalVar: ValueRef);
-        pub fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef;
-        pub fn LLVMSetInitializer(GlobalVar: ValueRef,
-                                         ConstantVal: ValueRef);
-        pub fn LLVMIsThreadLocal(GlobalVar: ValueRef) -> Bool;
-        pub fn LLVMSetThreadLocal(GlobalVar: ValueRef, IsThreadLocal: Bool);
-        pub fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool;
-        pub fn LLVMSetGlobalConstant(GlobalVar: ValueRef, IsConstant: Bool);
-
-        /* Operations on aliases */
-        pub fn LLVMAddAlias(M: ModuleRef,
-                            Ty: TypeRef,
-                            Aliasee: ValueRef,
-                            Name: *const c_char)
-                            -> ValueRef;
 
-        /* Operations on functions */
-        pub fn LLVMAddFunction(M: ModuleRef,
-                               Name: *const c_char,
-                               FunctionTy: TypeRef)
-                               -> ValueRef;
-        pub fn LLVMGetNamedFunction(M: ModuleRef, Name: *const c_char) -> ValueRef;
-        pub fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
-        pub fn LLVMGetLastFunction(M: ModuleRef) -> ValueRef;
-        pub fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
-        pub fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef;
-        pub fn LLVMDeleteFunction(Fn: ValueRef);
-        pub fn LLVMGetOrInsertFunction(M: ModuleRef,
+    /* Operations on global variables */
+    pub fn LLVMAddGlobal(M: ModuleRef, Ty: TypeRef, Name: *const c_char)
+                         -> ValueRef;
+    pub fn LLVMAddGlobalInAddressSpace(M: ModuleRef,
+                                       Ty: TypeRef,
                                        Name: *const c_char,
-                                       FunctionTy: TypeRef)
+                                       AddressSpace: c_uint)
                                        -> ValueRef;
-        pub fn LLVMGetIntrinsicID(Fn: ValueRef) -> c_uint;
-        pub fn LLVMGetFunctionCallConv(Fn: ValueRef) -> c_uint;
-        pub fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
-        pub fn LLVMGetGC(Fn: ValueRef) -> *const c_char;
-        pub fn LLVMSetGC(Fn: ValueRef, Name: *const c_char);
-        pub fn LLVMAddFunctionAttribute(Fn: ValueRef, index: c_uint, PA: uint64_t);
-        pub fn LLVMAddFunctionAttrString(Fn: ValueRef, index: c_uint, Name: *const c_char);
-        pub fn LLVMRemoveFunctionAttrString(Fn: ValueRef, index: c_uint, Name: *const c_char);
-        pub fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong;
-
-        /* Operations on parameters */
-        pub fn LLVMCountParams(Fn: ValueRef) -> c_uint;
-        pub fn LLVMGetParams(Fn: ValueRef, Params: *const ValueRef);
-        pub fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef;
-        pub fn LLVMGetParamParent(Inst: ValueRef) -> ValueRef;
-        pub fn LLVMGetFirstParam(Fn: ValueRef) -> ValueRef;
-        pub fn LLVMGetLastParam(Fn: ValueRef) -> ValueRef;
-        pub fn LLVMGetNextParam(Arg: ValueRef) -> ValueRef;
-        pub fn LLVMGetPreviousParam(Arg: ValueRef) -> ValueRef;
-        pub fn LLVMAddAttribute(Arg: ValueRef, PA: c_uint);
-        pub fn LLVMRemoveAttribute(Arg: ValueRef, PA: c_uint);
-        pub fn LLVMGetAttribute(Arg: ValueRef) -> c_uint;
-        pub fn LLVMSetParamAlignment(Arg: ValueRef, align: c_uint);
-
-        /* Operations on basic blocks */
-        pub fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
-        pub fn LLVMValueIsBasicBlock(Val: ValueRef) -> Bool;
-        pub fn LLVMValueAsBasicBlock(Val: ValueRef) -> BasicBlockRef;
-        pub fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
-        pub fn LLVMCountBasicBlocks(Fn: ValueRef) -> c_uint;
-        pub fn LLVMGetBasicBlocks(Fn: ValueRef, BasicBlocks: *const ValueRef);
-        pub fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
-        pub fn LLVMGetLastBasicBlock(Fn: ValueRef) -> BasicBlockRef;
-        pub fn LLVMGetNextBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
-        pub fn LLVMGetPreviousBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
-        pub fn LLVMGetEntryBasicBlock(Fn: ValueRef) -> BasicBlockRef;
-
-        pub fn LLVMAppendBasicBlockInContext(C: ContextRef,
-                                             Fn: ValueRef,
-                                             Name: *const c_char)
-                                             -> BasicBlockRef;
-        pub fn LLVMInsertBasicBlockInContext(C: ContextRef,
-                                             BB: BasicBlockRef,
-                                             Name: *const c_char)
-                                             -> BasicBlockRef;
-        pub fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
-
-        pub fn LLVMMoveBasicBlockAfter(BB: BasicBlockRef,
-                                       MoveAfter: BasicBlockRef);
-
-        pub fn LLVMMoveBasicBlockBefore(BB: BasicBlockRef,
-                                        MoveBefore: BasicBlockRef);
-
-        /* Operations on instructions */
-        pub fn LLVMGetInstructionParent(Inst: ValueRef) -> BasicBlockRef;
-        pub fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef;
-        pub fn LLVMGetLastInstruction(BB: BasicBlockRef) -> ValueRef;
-        pub fn LLVMGetNextInstruction(Inst: ValueRef) -> ValueRef;
-        pub fn LLVMGetPreviousInstruction(Inst: ValueRef) -> ValueRef;
-        pub fn LLVMInstructionEraseFromParent(Inst: ValueRef);
-
-        /* Operations on call sites */
-        pub fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint);
-        pub fn LLVMGetInstructionCallConv(Instr: ValueRef) -> c_uint;
-        pub fn LLVMAddInstrAttribute(Instr: ValueRef,
-                                     index: c_uint,
-                                     IA: c_uint);
-        pub fn LLVMRemoveInstrAttribute(Instr: ValueRef,
-                                        index: c_uint,
-                                        IA: c_uint);
-        pub fn LLVMSetInstrParamAlignment(Instr: ValueRef,
-                                          index: c_uint,
-                                          align: c_uint);
-        pub fn LLVMAddCallSiteAttribute(Instr: ValueRef,
-                                        index: c_uint,
-                                        Val: uint64_t);
-
-        /* Operations on call instructions (only) */
-        pub fn LLVMIsTailCall(CallInst: ValueRef) -> Bool;
-        pub fn LLVMSetTailCall(CallInst: ValueRef, IsTailCall: Bool);
-
-        /* Operations on load/store instructions (only) */
-        pub fn LLVMGetVolatile(MemoryAccessInst: ValueRef) -> Bool;
-        pub fn LLVMSetVolatile(MemoryAccessInst: ValueRef, volatile: Bool);
-
-        /* Operations on phi nodes */
-        pub fn LLVMAddIncoming(PhiNode: ValueRef,
-                               IncomingValues: *const ValueRef,
-                               IncomingBlocks: *const BasicBlockRef,
-                               Count: c_uint);
-        pub fn LLVMCountIncoming(PhiNode: ValueRef) -> c_uint;
-        pub fn LLVMGetIncomingValue(PhiNode: ValueRef, Index: c_uint)
-                                    -> ValueRef;
-        pub fn LLVMGetIncomingBlock(PhiNode: ValueRef, Index: c_uint)
-                                    -> BasicBlockRef;
-
-        /* Instruction builders */
-        pub fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
-        pub fn LLVMPositionBuilder(Builder: BuilderRef,
-                                   Block: BasicBlockRef,
-                                   Instr: ValueRef);
-        pub fn LLVMPositionBuilderBefore(Builder: BuilderRef,
-                                         Instr: ValueRef);
-        pub fn LLVMPositionBuilderAtEnd(Builder: BuilderRef,
-                                        Block: BasicBlockRef);
-        pub fn LLVMGetInsertBlock(Builder: BuilderRef) -> BasicBlockRef;
-        pub fn LLVMClearInsertionPosition(Builder: BuilderRef);
-        pub fn LLVMInsertIntoBuilder(Builder: BuilderRef, Instr: ValueRef);
-        pub fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef,
-                                             Instr: ValueRef,
-                                             Name: *const c_char);
-        pub fn LLVMDisposeBuilder(Builder: BuilderRef);
-        pub fn LLVMDisposeExecutionEngine(EE: ExecutionEngineRef);
-
-        /* Metadata */
-        pub fn LLVMSetCurrentDebugLocation(Builder: BuilderRef, L: ValueRef);
-        pub fn LLVMGetCurrentDebugLocation(Builder: BuilderRef) -> ValueRef;
-        pub fn LLVMSetInstDebugLocation(Builder: BuilderRef, Inst: ValueRef);
-
-        /* Terminators */
-        pub fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
-        pub fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
-        pub fn LLVMBuildAggregateRet(B: BuilderRef,
-                                     RetVals: *const ValueRef,
-                                     N: c_uint)
-                                     -> ValueRef;
-        pub fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
-        pub fn LLVMBuildCondBr(B: BuilderRef,
-                               If: ValueRef,
-                               Then: BasicBlockRef,
-                               Else: BasicBlockRef)
-                               -> ValueRef;
-        pub fn LLVMBuildSwitch(B: BuilderRef,
-                               V: ValueRef,
-                               Else: BasicBlockRef,
-                               NumCases: c_uint)
-                               -> ValueRef;
-        pub fn LLVMBuildIndirectBr(B: BuilderRef,
-                                   Addr: ValueRef,
-                                   NumDests: c_uint)
-                                   -> ValueRef;
-        pub fn LLVMBuildInvoke(B: BuilderRef,
-                               Fn: ValueRef,
-                               Args: *const ValueRef,
-                               NumArgs: c_uint,
-                               Then: BasicBlockRef,
-                               Catch: BasicBlockRef,
-                               Name: *const c_char)
-                               -> ValueRef;
-        pub fn LLVMBuildLandingPad(B: BuilderRef,
-                                   Ty: TypeRef,
-                                   PersFn: ValueRef,
-                                   NumClauses: c_uint,
-                                   Name: *const c_char)
+    pub fn LLVMGetNamedGlobal(M: ModuleRef, Name: *const c_char) -> ValueRef;
+    pub fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
+    pub fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef;
+    pub fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
+    pub fn LLVMGetPreviousGlobal(GlobalVar: ValueRef) -> ValueRef;
+    pub fn LLVMDeleteGlobal(GlobalVar: ValueRef);
+    pub fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef;
+    pub fn LLVMSetInitializer(GlobalVar: ValueRef,
+                              ConstantVal: ValueRef);
+    pub fn LLVMIsThreadLocal(GlobalVar: ValueRef) -> Bool;
+    pub fn LLVMSetThreadLocal(GlobalVar: ValueRef, IsThreadLocal: Bool);
+    pub fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool;
+    pub fn LLVMSetGlobalConstant(GlobalVar: ValueRef, IsConstant: Bool);
+
+    /* Operations on aliases */
+    pub fn LLVMAddAlias(M: ModuleRef,
+                        Ty: TypeRef,
+                        Aliasee: ValueRef,
+                        Name: *const c_char)
+                        -> ValueRef;
+
+    /* Operations on functions */
+    pub fn LLVMAddFunction(M: ModuleRef,
+                           Name: *const c_char,
+                           FunctionTy: TypeRef)
+                           -> ValueRef;
+    pub fn LLVMGetNamedFunction(M: ModuleRef, Name: *const c_char) -> ValueRef;
+    pub fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
+    pub fn LLVMGetLastFunction(M: ModuleRef) -> ValueRef;
+    pub fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
+    pub fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef;
+    pub fn LLVMDeleteFunction(Fn: ValueRef);
+    pub fn LLVMGetOrInsertFunction(M: ModuleRef,
+                                   Name: *const c_char,
+                                   FunctionTy: TypeRef)
                                    -> ValueRef;
-        pub fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
-        pub fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
-
-        /* Add a case to the switch instruction */
-        pub fn LLVMAddCase(Switch: ValueRef,
-                           OnVal: ValueRef,
-                           Dest: BasicBlockRef);
-
-        /* Add a destination to the indirectbr instruction */
-        pub fn LLVMAddDestination(IndirectBr: ValueRef, Dest: BasicBlockRef);
-
-        /* Add a clause to the landing pad instruction */
-        pub fn LLVMAddClause(LandingPad: ValueRef, ClauseVal: ValueRef);
-
-        /* Set the cleanup on a landing pad instruction */
-        pub fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
-
-        /* Arithmetic */
-        pub fn LLVMBuildAdd(B: BuilderRef,
-                            LHS: ValueRef,
-                            RHS: ValueRef,
-                            Name: *const c_char)
-                            -> ValueRef;
-        pub fn LLVMBuildNSWAdd(B: BuilderRef,
-                               LHS: ValueRef,
-                               RHS: ValueRef,
-                               Name: *const c_char)
-                               -> ValueRef;
-        pub fn LLVMBuildNUWAdd(B: BuilderRef,
-                               LHS: ValueRef,
-                               RHS: ValueRef,
-                               Name: *const c_char)
-                               -> ValueRef;
-        pub fn LLVMBuildFAdd(B: BuilderRef,
-                             LHS: ValueRef,
-                             RHS: ValueRef,
-                             Name: *const c_char)
-                             -> ValueRef;
-        pub fn LLVMBuildSub(B: BuilderRef,
-                            LHS: ValueRef,
-                            RHS: ValueRef,
-                            Name: *const c_char)
-                            -> ValueRef;
-        pub fn LLVMBuildNSWSub(B: BuilderRef,
-                               LHS: ValueRef,
-                               RHS: ValueRef,
-                               Name: *const c_char)
-                               -> ValueRef;
-        pub fn LLVMBuildNUWSub(B: BuilderRef,
-                               LHS: ValueRef,
-                               RHS: ValueRef,
-                               Name: *const c_char)
-                               -> ValueRef;
-        pub fn LLVMBuildFSub(B: BuilderRef,
-                             LHS: ValueRef,
-                             RHS: ValueRef,
-                             Name: *const c_char)
-                             -> ValueRef;
-        pub fn LLVMBuildMul(B: BuilderRef,
-                            LHS: ValueRef,
-                            RHS: ValueRef,
-                            Name: *const c_char)
-                            -> ValueRef;
-        pub fn LLVMBuildNSWMul(B: BuilderRef,
-                               LHS: ValueRef,
-                               RHS: ValueRef,
-                               Name: *const c_char)
+    pub fn LLVMGetIntrinsicID(Fn: ValueRef) -> c_uint;
+    pub fn LLVMGetFunctionCallConv(Fn: ValueRef) -> c_uint;
+    pub fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
+    pub fn LLVMGetGC(Fn: ValueRef) -> *const c_char;
+    pub fn LLVMSetGC(Fn: ValueRef, Name: *const c_char);
+    pub fn LLVMAddFunctionAttribute(Fn: ValueRef, index: c_uint, PA: uint64_t);
+    pub fn LLVMAddFunctionAttrString(Fn: ValueRef, index: c_uint, Name: *const c_char);
+    pub fn LLVMRemoveFunctionAttrString(Fn: ValueRef, index: c_uint, Name: *const c_char);
+    pub fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong;
+
+    /* Operations on parameters */
+    pub fn LLVMCountParams(Fn: ValueRef) -> c_uint;
+    pub fn LLVMGetParams(Fn: ValueRef, Params: *const ValueRef);
+    pub fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef;
+    pub fn LLVMGetParamParent(Inst: ValueRef) -> ValueRef;
+    pub fn LLVMGetFirstParam(Fn: ValueRef) -> ValueRef;
+    pub fn LLVMGetLastParam(Fn: ValueRef) -> ValueRef;
+    pub fn LLVMGetNextParam(Arg: ValueRef) -> ValueRef;
+    pub fn LLVMGetPreviousParam(Arg: ValueRef) -> ValueRef;
+    pub fn LLVMAddAttribute(Arg: ValueRef, PA: c_uint);
+    pub fn LLVMRemoveAttribute(Arg: ValueRef, PA: c_uint);
+    pub fn LLVMGetAttribute(Arg: ValueRef) -> c_uint;
+    pub fn LLVMSetParamAlignment(Arg: ValueRef, align: c_uint);
+
+    /* Operations on basic blocks */
+    pub fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
+    pub fn LLVMValueIsBasicBlock(Val: ValueRef) -> Bool;
+    pub fn LLVMValueAsBasicBlock(Val: ValueRef) -> BasicBlockRef;
+    pub fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
+    pub fn LLVMCountBasicBlocks(Fn: ValueRef) -> c_uint;
+    pub fn LLVMGetBasicBlocks(Fn: ValueRef, BasicBlocks: *const ValueRef);
+    pub fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
+    pub fn LLVMGetLastBasicBlock(Fn: ValueRef) -> BasicBlockRef;
+    pub fn LLVMGetNextBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
+    pub fn LLVMGetPreviousBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
+    pub fn LLVMGetEntryBasicBlock(Fn: ValueRef) -> BasicBlockRef;
+
+    pub fn LLVMAppendBasicBlockInContext(C: ContextRef,
+                                         Fn: ValueRef,
+                                         Name: *const c_char)
+                                         -> BasicBlockRef;
+    pub fn LLVMInsertBasicBlockInContext(C: ContextRef,
+                                         BB: BasicBlockRef,
+                                         Name: *const c_char)
+                                         -> BasicBlockRef;
+    pub fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
+
+    pub fn LLVMMoveBasicBlockAfter(BB: BasicBlockRef,
+                                   MoveAfter: BasicBlockRef);
+
+    pub fn LLVMMoveBasicBlockBefore(BB: BasicBlockRef,
+                                    MoveBefore: BasicBlockRef);
+
+    /* Operations on instructions */
+    pub fn LLVMGetInstructionParent(Inst: ValueRef) -> BasicBlockRef;
+    pub fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef;
+    pub fn LLVMGetLastInstruction(BB: BasicBlockRef) -> ValueRef;
+    pub fn LLVMGetNextInstruction(Inst: ValueRef) -> ValueRef;
+    pub fn LLVMGetPreviousInstruction(Inst: ValueRef) -> ValueRef;
+    pub fn LLVMInstructionEraseFromParent(Inst: ValueRef);
+
+    /* Operations on call sites */
+    pub fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint);
+    pub fn LLVMGetInstructionCallConv(Instr: ValueRef) -> c_uint;
+    pub fn LLVMAddInstrAttribute(Instr: ValueRef,
+                                 index: c_uint,
+                                 IA: c_uint);
+    pub fn LLVMRemoveInstrAttribute(Instr: ValueRef,
+                                    index: c_uint,
+                                    IA: c_uint);
+    pub fn LLVMSetInstrParamAlignment(Instr: ValueRef,
+                                      index: c_uint,
+                                      align: c_uint);
+    pub fn LLVMAddCallSiteAttribute(Instr: ValueRef,
+                                    index: c_uint,
+                                    Val: uint64_t);
+
+    /* Operations on call instructions (only) */
+    pub fn LLVMIsTailCall(CallInst: ValueRef) -> Bool;
+    pub fn LLVMSetTailCall(CallInst: ValueRef, IsTailCall: Bool);
+
+    /* Operations on load/store instructions (only) */
+    pub fn LLVMGetVolatile(MemoryAccessInst: ValueRef) -> Bool;
+    pub fn LLVMSetVolatile(MemoryAccessInst: ValueRef, volatile: Bool);
+
+    /* Operations on phi nodes */
+    pub fn LLVMAddIncoming(PhiNode: ValueRef,
+                           IncomingValues: *const ValueRef,
+                           IncomingBlocks: *const BasicBlockRef,
+                           Count: c_uint);
+    pub fn LLVMCountIncoming(PhiNode: ValueRef) -> c_uint;
+    pub fn LLVMGetIncomingValue(PhiNode: ValueRef, Index: c_uint)
+                                -> ValueRef;
+    pub fn LLVMGetIncomingBlock(PhiNode: ValueRef, Index: c_uint)
+                                -> BasicBlockRef;
+
+    /* Instruction builders */
+    pub fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
+    pub fn LLVMPositionBuilder(Builder: BuilderRef,
+                               Block: BasicBlockRef,
+                               Instr: ValueRef);
+    pub fn LLVMPositionBuilderBefore(Builder: BuilderRef,
+                                     Instr: ValueRef);
+    pub fn LLVMPositionBuilderAtEnd(Builder: BuilderRef,
+                                    Block: BasicBlockRef);
+    pub fn LLVMGetInsertBlock(Builder: BuilderRef) -> BasicBlockRef;
+    pub fn LLVMClearInsertionPosition(Builder: BuilderRef);
+    pub fn LLVMInsertIntoBuilder(Builder: BuilderRef, Instr: ValueRef);
+    pub fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef,
+                                         Instr: ValueRef,
+                                         Name: *const c_char);
+    pub fn LLVMDisposeBuilder(Builder: BuilderRef);
+    pub fn LLVMDisposeExecutionEngine(EE: ExecutionEngineRef);
+
+    /* Metadata */
+    pub fn LLVMSetCurrentDebugLocation(Builder: BuilderRef, L: ValueRef);
+    pub fn LLVMGetCurrentDebugLocation(Builder: BuilderRef) -> ValueRef;
+    pub fn LLVMSetInstDebugLocation(Builder: BuilderRef, Inst: ValueRef);
+
+    /* Terminators */
+    pub fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
+    pub fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
+    pub fn LLVMBuildAggregateRet(B: BuilderRef,
+                                 RetVals: *const ValueRef,
+                                 N: c_uint)
+                                 -> ValueRef;
+    pub fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
+    pub fn LLVMBuildCondBr(B: BuilderRef,
+                           If: ValueRef,
+                           Then: BasicBlockRef,
+                           Else: BasicBlockRef)
+                           -> ValueRef;
+    pub fn LLVMBuildSwitch(B: BuilderRef,
+                           V: ValueRef,
+                           Else: BasicBlockRef,
+                           NumCases: c_uint)
+                           -> ValueRef;
+    pub fn LLVMBuildIndirectBr(B: BuilderRef,
+                               Addr: ValueRef,
+                               NumDests: c_uint)
                                -> ValueRef;
-        pub fn LLVMBuildNUWMul(B: BuilderRef,
-                               LHS: ValueRef,
-                               RHS: ValueRef,
+    pub fn LLVMBuildInvoke(B: BuilderRef,
+                           Fn: ValueRef,
+                           Args: *const ValueRef,
+                           NumArgs: c_uint,
+                           Then: BasicBlockRef,
+                           Catch: BasicBlockRef,
+                           Name: *const c_char)
+                           -> ValueRef;
+    pub fn LLVMBuildLandingPad(B: BuilderRef,
+                               Ty: TypeRef,
+                               PersFn: ValueRef,
+                               NumClauses: c_uint,
                                Name: *const c_char)
                                -> ValueRef;
-        pub fn LLVMBuildFMul(B: BuilderRef,
-                             LHS: ValueRef,
-                             RHS: ValueRef,
-                             Name: *const c_char)
-                             -> ValueRef;
-        pub fn LLVMBuildUDiv(B: BuilderRef,
-                             LHS: ValueRef,
-                             RHS: ValueRef,
-                             Name: *const c_char)
-                             -> ValueRef;
-        pub fn LLVMBuildSDiv(B: BuilderRef,
-                             LHS: ValueRef,
-                             RHS: ValueRef,
-                             Name: *const c_char)
-                             -> ValueRef;
-        pub fn LLVMBuildExactSDiv(B: BuilderRef,
-                                  LHS: ValueRef,
-                                  RHS: ValueRef,
-                                  Name: *const c_char)
-                                  -> ValueRef;
-        pub fn LLVMBuildFDiv(B: BuilderRef,
-                             LHS: ValueRef,
-                             RHS: ValueRef,
-                             Name: *const c_char)
-                             -> ValueRef;
-        pub fn LLVMBuildURem(B: BuilderRef,
-                             LHS: ValueRef,
-                             RHS: ValueRef,
-                             Name: *const c_char)
-                             -> ValueRef;
-        pub fn LLVMBuildSRem(B: BuilderRef,
-                             LHS: ValueRef,
-                             RHS: ValueRef,
-                             Name: *const c_char)
-                             -> ValueRef;
-        pub fn LLVMBuildFRem(B: BuilderRef,
-                             LHS: ValueRef,
-                             RHS: ValueRef,
-                             Name: *const c_char)
-                             -> ValueRef;
-        pub fn LLVMBuildShl(B: BuilderRef,
-                            LHS: ValueRef,
-                            RHS: ValueRef,
-                            Name: *const c_char)
-                            -> ValueRef;
-        pub fn LLVMBuildLShr(B: BuilderRef,
-                             LHS: ValueRef,
-                             RHS: ValueRef,
-                             Name: *const c_char)
-                             -> ValueRef;
-        pub fn LLVMBuildAShr(B: BuilderRef,
-                             LHS: ValueRef,
-                             RHS: ValueRef,
-                             Name: *const c_char)
-                             -> ValueRef;
-        pub fn LLVMBuildAnd(B: BuilderRef,
-                            LHS: ValueRef,
-                            RHS: ValueRef,
-                            Name: *const c_char)
-                            -> ValueRef;
-        pub fn LLVMBuildOr(B: BuilderRef,
+    pub fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
+    pub fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
+
+    /* Add a case to the switch instruction */
+    pub fn LLVMAddCase(Switch: ValueRef,
+                       OnVal: ValueRef,
+                       Dest: BasicBlockRef);
+
+    /* Add a destination to the indirectbr instruction */
+    pub fn LLVMAddDestination(IndirectBr: ValueRef, Dest: BasicBlockRef);
+
+    /* Add a clause to the landing pad instruction */
+    pub fn LLVMAddClause(LandingPad: ValueRef, ClauseVal: ValueRef);
+
+    /* Set the cleanup on a landing pad instruction */
+    pub fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
+
+    /* Arithmetic */
+    pub fn LLVMBuildAdd(B: BuilderRef,
+                        LHS: ValueRef,
+                        RHS: ValueRef,
+                        Name: *const c_char)
+                        -> ValueRef;
+    pub fn LLVMBuildNSWAdd(B: BuilderRef,
                            LHS: ValueRef,
                            RHS: ValueRef,
                            Name: *const c_char)
                            -> ValueRef;
-        pub fn LLVMBuildXor(B: BuilderRef,
-                            LHS: ValueRef,
-                            RHS: ValueRef,
-                            Name: *const c_char)
-                            -> ValueRef;
-        pub fn LLVMBuildBinOp(B: BuilderRef,
-                              Op: Opcode,
+    pub fn LLVMBuildNUWAdd(B: BuilderRef,
+                           LHS: ValueRef,
+                           RHS: ValueRef,
+                           Name: *const c_char)
+                           -> ValueRef;
+    pub fn LLVMBuildFAdd(B: BuilderRef,
+                         LHS: ValueRef,
+                         RHS: ValueRef,
+                         Name: *const c_char)
+                         -> ValueRef;
+    pub fn LLVMBuildSub(B: BuilderRef,
+                        LHS: ValueRef,
+                        RHS: ValueRef,
+                        Name: *const c_char)
+                        -> ValueRef;
+    pub fn LLVMBuildNSWSub(B: BuilderRef,
+                           LHS: ValueRef,
+                           RHS: ValueRef,
+                           Name: *const c_char)
+                           -> ValueRef;
+    pub fn LLVMBuildNUWSub(B: BuilderRef,
+                           LHS: ValueRef,
+                           RHS: ValueRef,
+                           Name: *const c_char)
+                           -> ValueRef;
+    pub fn LLVMBuildFSub(B: BuilderRef,
+                         LHS: ValueRef,
+                         RHS: ValueRef,
+                         Name: *const c_char)
+                         -> ValueRef;
+    pub fn LLVMBuildMul(B: BuilderRef,
+                        LHS: ValueRef,
+                        RHS: ValueRef,
+                        Name: *const c_char)
+                        -> ValueRef;
+    pub fn LLVMBuildNSWMul(B: BuilderRef,
+                           LHS: ValueRef,
+                           RHS: ValueRef,
+                           Name: *const c_char)
+                           -> ValueRef;
+    pub fn LLVMBuildNUWMul(B: BuilderRef,
+                           LHS: ValueRef,
+                           RHS: ValueRef,
+                           Name: *const c_char)
+                           -> ValueRef;
+    pub fn LLVMBuildFMul(B: BuilderRef,
+                         LHS: ValueRef,
+                         RHS: ValueRef,
+                         Name: *const c_char)
+                         -> ValueRef;
+    pub fn LLVMBuildUDiv(B: BuilderRef,
+                         LHS: ValueRef,
+                         RHS: ValueRef,
+                         Name: *const c_char)
+                         -> ValueRef;
+    pub fn LLVMBuildSDiv(B: BuilderRef,
+                         LHS: ValueRef,
+                         RHS: ValueRef,
+                         Name: *const c_char)
+                         -> ValueRef;
+    pub fn LLVMBuildExactSDiv(B: BuilderRef,
                               LHS: ValueRef,
                               RHS: ValueRef,
                               Name: *const c_char)
                               -> ValueRef;
-        pub fn LLVMBuildNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
-                            -> ValueRef;
-        pub fn LLVMBuildNSWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
-                               -> ValueRef;
-        pub fn LLVMBuildNUWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
-                               -> ValueRef;
-        pub fn LLVMBuildFNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
-                             -> ValueRef;
-        pub fn LLVMBuildNot(B: BuilderRef, V: ValueRef, Name: *const c_char)
-                            -> ValueRef;
+    pub fn LLVMBuildFDiv(B: BuilderRef,
+                         LHS: ValueRef,
+                         RHS: ValueRef,
+                         Name: *const c_char)
+                         -> ValueRef;
+    pub fn LLVMBuildURem(B: BuilderRef,
+                         LHS: ValueRef,
+                         RHS: ValueRef,
+                         Name: *const c_char)
+                         -> ValueRef;
+    pub fn LLVMBuildSRem(B: BuilderRef,
+                         LHS: ValueRef,
+                         RHS: ValueRef,
+                         Name: *const c_char)
+                         -> ValueRef;
+    pub fn LLVMBuildFRem(B: BuilderRef,
+                         LHS: ValueRef,
+                         RHS: ValueRef,
+                         Name: *const c_char)
+                         -> ValueRef;
+    pub fn LLVMBuildShl(B: BuilderRef,
+                        LHS: ValueRef,
+                        RHS: ValueRef,
+                        Name: *const c_char)
+                        -> ValueRef;
+    pub fn LLVMBuildLShr(B: BuilderRef,
+                         LHS: ValueRef,
+                         RHS: ValueRef,
+                         Name: *const c_char)
+                         -> ValueRef;
+    pub fn LLVMBuildAShr(B: BuilderRef,
+                         LHS: ValueRef,
+                         RHS: ValueRef,
+                         Name: *const c_char)
+                         -> ValueRef;
+    pub fn LLVMBuildAnd(B: BuilderRef,
+                        LHS: ValueRef,
+                        RHS: ValueRef,
+                        Name: *const c_char)
+                        -> ValueRef;
+    pub fn LLVMBuildOr(B: BuilderRef,
+                       LHS: ValueRef,
+                       RHS: ValueRef,
+                       Name: *const c_char)
+                           -> ValueRef;
+    pub fn LLVMBuildXor(B: BuilderRef,
+                        LHS: ValueRef,
+                        RHS: ValueRef,
+                        Name: *const c_char)
+                        -> ValueRef;
+    pub fn LLVMBuildBinOp(B: BuilderRef,
+                          Op: Opcode,
+                          LHS: ValueRef,
+                          RHS: ValueRef,
+                          Name: *const c_char)
+                          -> ValueRef;
+    pub fn LLVMBuildNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
+                        -> ValueRef;
+    pub fn LLVMBuildNSWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
+                           -> ValueRef;
+    pub fn LLVMBuildNUWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
+                           -> ValueRef;
+    pub fn LLVMBuildFNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
+                         -> ValueRef;
+    pub fn LLVMBuildNot(B: BuilderRef, V: ValueRef, Name: *const c_char)
+                        -> ValueRef;
 
-        /* Memory */
-        pub fn LLVMBuildMalloc(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
-                               -> ValueRef;
-        pub fn LLVMBuildArrayMalloc(B: BuilderRef,
-                                    Ty: TypeRef,
-                                    Val: ValueRef,
-                                    Name: *const c_char)
-                                    -> ValueRef;
-        pub fn LLVMBuildAlloca(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
-                               -> ValueRef;
-        pub fn LLVMBuildArrayAlloca(B: BuilderRef,
-                                    Ty: TypeRef,
-                                    Val: ValueRef,
+    /* Memory */
+    pub fn LLVMBuildMalloc(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
+                           -> ValueRef;
+    pub fn LLVMBuildArrayMalloc(B: BuilderRef,
+                                Ty: TypeRef,
+                                Val: ValueRef,
+                                Name: *const c_char)
+                                -> ValueRef;
+    pub fn LLVMBuildAlloca(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
+                           -> ValueRef;
+    pub fn LLVMBuildArrayAlloca(B: BuilderRef,
+                                Ty: TypeRef,
+                                Val: ValueRef,
+                                Name: *const c_char)
+                                -> ValueRef;
+    pub fn LLVMBuildFree(B: BuilderRef, PointerVal: ValueRef) -> ValueRef;
+    pub fn LLVMBuildLoad(B: BuilderRef,
+                         PointerVal: ValueRef,
+                         Name: *const c_char)
+                         -> ValueRef;
+
+    pub fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef)
+                          -> ValueRef;
+
+    pub fn LLVMBuildGEP(B: BuilderRef,
+                        Pointer: ValueRef,
+                        Indices: *const ValueRef,
+                        NumIndices: c_uint,
+                        Name: *const c_char)
+                        -> ValueRef;
+    pub fn LLVMBuildInBoundsGEP(B: BuilderRef,
+                                Pointer: ValueRef,
+                                Indices: *const ValueRef,
+                                NumIndices: c_uint,
+                                Name: *const c_char)
+                                -> ValueRef;
+    pub fn LLVMBuildStructGEP(B: BuilderRef,
+                              Pointer: ValueRef,
+                              Idx: c_uint,
+                              Name: *const c_char)
+                              -> ValueRef;
+    pub fn LLVMBuildGlobalString(B: BuilderRef,
+                                 Str: *const c_char,
+                                 Name: *const c_char)
+                                 -> ValueRef;
+    pub fn LLVMBuildGlobalStringPtr(B: BuilderRef,
+                                    Str: *const c_char,
                                     Name: *const c_char)
                                     -> ValueRef;
-        pub fn LLVMBuildFree(B: BuilderRef, PointerVal: ValueRef) -> ValueRef;
-        pub fn LLVMBuildLoad(B: BuilderRef,
-                             PointerVal: ValueRef,
-                             Name: *const c_char)
-                             -> ValueRef;
 
-        pub fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef)
-                              -> ValueRef;
-
-        pub fn LLVMBuildGEP(B: BuilderRef,
-                            Pointer: ValueRef,
-                            Indices: *const ValueRef,
-                            NumIndices: c_uint,
+    /* Casts */
+    pub fn LLVMBuildTrunc(B: BuilderRef,
+                          Val: ValueRef,
+                          DestTy: TypeRef,
+                          Name: *const c_char)
+                          -> ValueRef;
+    pub fn LLVMBuildZExt(B: BuilderRef,
+                         Val: ValueRef,
+                         DestTy: TypeRef,
+                         Name: *const c_char)
+                         -> ValueRef;
+    pub fn LLVMBuildSExt(B: BuilderRef,
+                         Val: ValueRef,
+                         DestTy: TypeRef,
+                         Name: *const c_char)
+                         -> ValueRef;
+    pub fn LLVMBuildFPToUI(B: BuilderRef,
+                           Val: ValueRef,
+                           DestTy: TypeRef,
+                           Name: *const c_char)
+                           -> ValueRef;
+    pub fn LLVMBuildFPToSI(B: BuilderRef,
+                           Val: ValueRef,
+                           DestTy: TypeRef,
+                           Name: *const c_char)
+                           -> ValueRef;
+    pub fn LLVMBuildUIToFP(B: BuilderRef,
+                           Val: ValueRef,
+                           DestTy: TypeRef,
+                           Name: *const c_char)
+                           -> ValueRef;
+    pub fn LLVMBuildSIToFP(B: BuilderRef,
+                           Val: ValueRef,
+                           DestTy: TypeRef,
+                           Name: *const c_char)
+                           -> ValueRef;
+    pub fn LLVMBuildFPTrunc(B: BuilderRef,
+                            Val: ValueRef,
+                            DestTy: TypeRef,
                             Name: *const c_char)
                             -> ValueRef;
-        pub fn LLVMBuildInBoundsGEP(B: BuilderRef,
-                                    Pointer: ValueRef,
-                                    Indices: *const ValueRef,
-                                    NumIndices: c_uint,
-                                    Name: *const c_char)
-                                    -> ValueRef;
-        pub fn LLVMBuildStructGEP(B: BuilderRef,
-                                  Pointer: ValueRef,
-                                  Idx: c_uint,
-                                  Name: *const c_char)
-                                  -> ValueRef;
-        pub fn LLVMBuildGlobalString(B: BuilderRef,
-                                     Str: *const c_char,
-                                     Name: *const c_char)
-                                     -> ValueRef;
-        pub fn LLVMBuildGlobalStringPtr(B: BuilderRef,
-                                        Str: *const c_char,
-                                        Name: *const c_char)
-                                        -> ValueRef;
-
-        /* Casts */
-        pub fn LLVMBuildTrunc(B: BuilderRef,
-                              Val: ValueRef,
-                              DestTy: TypeRef,
-                              Name: *const c_char)
-                              -> ValueRef;
-        pub fn LLVMBuildZExt(B: BuilderRef,
+    pub fn LLVMBuildFPExt(B: BuilderRef,
+                          Val: ValueRef,
+                          DestTy: TypeRef,
+                          Name: *const c_char)
+                          -> ValueRef;
+    pub fn LLVMBuildPtrToInt(B: BuilderRef,
                              Val: ValueRef,
                              DestTy: TypeRef,
                              Name: *const c_char)
                              -> ValueRef;
-        pub fn LLVMBuildSExt(B: BuilderRef,
+    pub fn LLVMBuildIntToPtr(B: BuilderRef,
                              Val: ValueRef,
                              DestTy: TypeRef,
                              Name: *const c_char)
                              -> ValueRef;
-        pub fn LLVMBuildFPToUI(B: BuilderRef,
-                               Val: ValueRef,
-                               DestTy: TypeRef,
-                               Name: *const c_char)
-                               -> ValueRef;
-        pub fn LLVMBuildFPToSI(B: BuilderRef,
-                               Val: ValueRef,
-                               DestTy: TypeRef,
-                               Name: *const c_char)
-                               -> ValueRef;
-        pub fn LLVMBuildUIToFP(B: BuilderRef,
-                               Val: ValueRef,
-                               DestTy: TypeRef,
-                               Name: *const c_char)
-                               -> ValueRef;
-        pub fn LLVMBuildSIToFP(B: BuilderRef,
-                               Val: ValueRef,
-                               DestTy: TypeRef,
-                               Name: *const c_char)
-                               -> ValueRef;
-        pub fn LLVMBuildFPTrunc(B: BuilderRef,
+    pub fn LLVMBuildBitCast(B: BuilderRef,
+                            Val: ValueRef,
+                            DestTy: TypeRef,
+                            Name: *const c_char)
+                            -> ValueRef;
+    pub fn LLVMBuildZExtOrBitCast(B: BuilderRef,
+                                  Val: ValueRef,
+                                  DestTy: TypeRef,
+                                  Name: *const c_char)
+                                  -> ValueRef;
+    pub fn LLVMBuildSExtOrBitCast(B: BuilderRef,
+                                  Val: ValueRef,
+                                  DestTy: TypeRef,
+                                  Name: *const c_char)
+                                  -> ValueRef;
+    pub fn LLVMBuildTruncOrBitCast(B: BuilderRef,
+                                   Val: ValueRef,
+                                   DestTy: TypeRef,
+                                   Name: *const c_char)
+                                   -> ValueRef;
+    pub fn LLVMBuildCast(B: BuilderRef,
+                         Op: Opcode,
+                         Val: ValueRef,
+                         DestTy: TypeRef,
+                         Name: *const c_char) -> ValueRef;
+    pub fn LLVMBuildPointerCast(B: BuilderRef,
                                 Val: ValueRef,
                                 DestTy: TypeRef,
                                 Name: *const c_char)
                                 -> ValueRef;
-        pub fn LLVMBuildFPExt(B: BuilderRef,
-                              Val: ValueRef,
-                              DestTy: TypeRef,
-                              Name: *const c_char)
-                              -> ValueRef;
-        pub fn LLVMBuildPtrToInt(B: BuilderRef,
-                                 Val: ValueRef,
-                                 DestTy: TypeRef,
-                                 Name: *const c_char)
-                                 -> ValueRef;
-        pub fn LLVMBuildIntToPtr(B: BuilderRef,
-                                 Val: ValueRef,
-                                 DestTy: TypeRef,
+    pub fn LLVMBuildIntCast(B: BuilderRef,
+                            Val: ValueRef,
+                            DestTy: TypeRef,
+                            Name: *const c_char)
+                            -> ValueRef;
+    pub fn LLVMBuildFPCast(B: BuilderRef,
+                           Val: ValueRef,
+                           DestTy: TypeRef,
+                           Name: *const c_char)
+                           -> ValueRef;
+
+    /* Comparisons */
+    pub fn LLVMBuildICmp(B: BuilderRef,
+                         Op: c_uint,
+                         LHS: ValueRef,
+                         RHS: ValueRef,
+                         Name: *const c_char)
+                         -> ValueRef;
+    pub fn LLVMBuildFCmp(B: BuilderRef,
+                         Op: c_uint,
+                         LHS: ValueRef,
+                         RHS: ValueRef,
+                         Name: *const c_char)
+                         -> ValueRef;
+
+    /* Miscellaneous instructions */
+    pub fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
+                        -> ValueRef;
+    pub fn LLVMBuildCall(B: BuilderRef,
+                         Fn: ValueRef,
+                         Args: *const ValueRef,
+                         NumArgs: c_uint,
+                         Name: *const c_char)
+                         -> ValueRef;
+    pub fn LLVMBuildSelect(B: BuilderRef,
+                           If: ValueRef,
+                           Then: ValueRef,
+                           Else: ValueRef,
+                           Name: *const c_char)
+                           -> ValueRef;
+    pub fn LLVMBuildVAArg(B: BuilderRef,
+                          list: ValueRef,
+                          Ty: TypeRef,
+                          Name: *const c_char)
+                          -> ValueRef;
+    pub fn LLVMBuildExtractElement(B: BuilderRef,
+                                   VecVal: ValueRef,
+                                   Index: ValueRef,
+                                   Name: *const c_char)
+                                   -> ValueRef;
+    pub fn LLVMBuildInsertElement(B: BuilderRef,
+                                  VecVal: ValueRef,
+                                  EltVal: ValueRef,
+                                  Index: ValueRef,
+                                  Name: *const c_char)
+                                  -> ValueRef;
+    pub fn LLVMBuildShuffleVector(B: BuilderRef,
+                                  V1: ValueRef,
+                                  V2: ValueRef,
+                                  Mask: ValueRef,
+                                  Name: *const c_char)
+                                  -> ValueRef;
+    pub fn LLVMBuildExtractValue(B: BuilderRef,
+                                 AggVal: ValueRef,
+                                 Index: c_uint,
                                  Name: *const c_char)
                                  -> ValueRef;
-        pub fn LLVMBuildBitCast(B: BuilderRef,
-                                Val: ValueRef,
-                                DestTy: TypeRef,
+    pub fn LLVMBuildInsertValue(B: BuilderRef,
+                                AggVal: ValueRef,
+                                EltVal: ValueRef,
+                                Index: c_uint,
                                 Name: *const c_char)
                                 -> ValueRef;
-        pub fn LLVMBuildZExtOrBitCast(B: BuilderRef,
-                                      Val: ValueRef,
-                                      DestTy: TypeRef,
-                                      Name: *const c_char)
-                                      -> ValueRef;
-        pub fn LLVMBuildSExtOrBitCast(B: BuilderRef,
-                                      Val: ValueRef,
-                                      DestTy: TypeRef,
-                                      Name: *const c_char)
-                                      -> ValueRef;
-        pub fn LLVMBuildTruncOrBitCast(B: BuilderRef,
-                                       Val: ValueRef,
-                                       DestTy: TypeRef,
-                                       Name: *const c_char)
-                                       -> ValueRef;
-        pub fn LLVMBuildCast(B: BuilderRef,
-                             Op: Opcode,
-                             Val: ValueRef,
-                             DestTy: TypeRef,
-                             Name: *const c_char) -> ValueRef;
-        pub fn LLVMBuildPointerCast(B: BuilderRef,
-                                    Val: ValueRef,
-                                    DestTy: TypeRef,
-                                    Name: *const c_char)
-                                    -> ValueRef;
-        pub fn LLVMBuildIntCast(B: BuilderRef,
-                                Val: ValueRef,
-                                DestTy: TypeRef,
-                                Name: *const c_char)
-                                -> ValueRef;
-        pub fn LLVMBuildFPCast(B: BuilderRef,
-                               Val: ValueRef,
-                               DestTy: TypeRef,
-                               Name: *const c_char)
-                               -> ValueRef;
 
-        /* Comparisons */
-        pub fn LLVMBuildICmp(B: BuilderRef,
-                             Op: c_uint,
-                             LHS: ValueRef,
-                             RHS: ValueRef,
-                             Name: *const c_char)
-                             -> ValueRef;
-        pub fn LLVMBuildFCmp(B: BuilderRef,
-                             Op: c_uint,
-                             LHS: ValueRef,
-                             RHS: ValueRef,
-                             Name: *const c_char)
-                             -> ValueRef;
-
-        /* Miscellaneous instructions */
-        pub fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
-                            -> ValueRef;
-        pub fn LLVMBuildCall(B: BuilderRef,
-                             Fn: ValueRef,
-                             Args: *const ValueRef,
-                             NumArgs: c_uint,
-                             Name: *const c_char)
-                             -> ValueRef;
-        pub fn LLVMBuildSelect(B: BuilderRef,
-                               If: ValueRef,
-                               Then: ValueRef,
-                               Else: ValueRef,
-                               Name: *const c_char)
-                               -> ValueRef;
-        pub fn LLVMBuildVAArg(B: BuilderRef,
-                              list: ValueRef,
-                              Ty: TypeRef,
-                              Name: *const c_char)
+    pub fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *const c_char)
+                           -> ValueRef;
+    pub fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: *const c_char)
                               -> ValueRef;
-        pub fn LLVMBuildExtractElement(B: BuilderRef,
-                                       VecVal: ValueRef,
-                                       Index: ValueRef,
-                                       Name: *const c_char)
-                                       -> ValueRef;
-        pub fn LLVMBuildInsertElement(B: BuilderRef,
-                                      VecVal: ValueRef,
-                                      EltVal: ValueRef,
-                                      Index: ValueRef,
-                                      Name: *const c_char)
-                                      -> ValueRef;
-        pub fn LLVMBuildShuffleVector(B: BuilderRef,
-                                      V1: ValueRef,
-                                      V2: ValueRef,
-                                      Mask: ValueRef,
-                                      Name: *const c_char)
-                                      -> ValueRef;
-        pub fn LLVMBuildExtractValue(B: BuilderRef,
-                                     AggVal: ValueRef,
-                                     Index: c_uint,
-                                     Name: *const c_char)
-                                     -> ValueRef;
-        pub fn LLVMBuildInsertValue(B: BuilderRef,
-                                    AggVal: ValueRef,
-                                    EltVal: ValueRef,
-                                    Index: c_uint,
-                                    Name: *const c_char)
-                                    -> ValueRef;
+    pub fn LLVMBuildPtrDiff(B: BuilderRef,
+                            LHS: ValueRef,
+                            RHS: ValueRef,
+                            Name: *const c_char)
+                            -> ValueRef;
 
-        pub fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *const c_char)
+    /* Atomic Operations */
+    pub fn LLVMBuildAtomicLoad(B: BuilderRef,
+                               PointerVal: ValueRef,
+                               Name: *const c_char,
+                               Order: AtomicOrdering,
+                               Alignment: c_uint)
                                -> ValueRef;
-        pub fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: *const c_char)
-                                  -> ValueRef;
-        pub fn LLVMBuildPtrDiff(B: BuilderRef,
-                                LHS: ValueRef,
-                                RHS: ValueRef,
-                                Name: *const c_char)
-                                -> ValueRef;
 
-        /* Atomic Operations */
-        pub fn LLVMBuildAtomicLoad(B: BuilderRef,
-                                   PointerVal: ValueRef,
-                                   Name: *const c_char,
-                                   Order: AtomicOrdering,
-                                   Alignment: c_uint)
-                                   -> ValueRef;
-
-        pub fn LLVMBuildAtomicStore(B: BuilderRef,
-                                    Val: ValueRef,
-                                    Ptr: ValueRef,
-                                    Order: AtomicOrdering,
-                                    Alignment: c_uint)
-                                    -> ValueRef;
+    pub fn LLVMBuildAtomicStore(B: BuilderRef,
+                                Val: ValueRef,
+                                Ptr: ValueRef,
+                                Order: AtomicOrdering,
+                                Alignment: c_uint)
+                                -> ValueRef;
 
-        pub fn LLVMBuildAtomicCmpXchg(B: BuilderRef,
-                                      LHS: ValueRef,
-                                      CMP: ValueRef,
-                                      RHS: ValueRef,
-                                      Order: AtomicOrdering,
-                                      FailureOrder: AtomicOrdering)
-                                      -> ValueRef;
-        pub fn LLVMBuildAtomicRMW(B: BuilderRef,
-                                  Op: AtomicBinOp,
+    pub fn LLVMBuildAtomicCmpXchg(B: BuilderRef,
                                   LHS: ValueRef,
+                                  CMP: ValueRef,
                                   RHS: ValueRef,
                                   Order: AtomicOrdering,
-                                  SingleThreaded: Bool)
+                                  FailureOrder: AtomicOrdering)
                                   -> ValueRef;
+    pub fn LLVMBuildAtomicRMW(B: BuilderRef,
+                              Op: AtomicBinOp,
+                              LHS: ValueRef,
+                              RHS: ValueRef,
+                              Order: AtomicOrdering,
+                              SingleThreaded: Bool)
+                              -> ValueRef;
 
-        pub fn LLVMBuildAtomicFence(B: BuilderRef, Order: AtomicOrdering);
-
-
-        /* Selected entries from the downcasts. */
-        pub fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
-        pub fn LLVMIsAStoreInst(Inst: ValueRef) -> ValueRef;
-
-        /** Writes a module to the specified path. Returns 0 on success. */
-        pub fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: *const c_char) -> c_int;
-
-        /** Creates target data from a target layout string. */
-        pub fn LLVMCreateTargetData(StringRep: *const c_char) -> TargetDataRef;
-        /// Adds the target data to the given pass manager. The pass manager
-        /// references the target data only weakly.
-        pub fn LLVMAddTargetData(TD: TargetDataRef, PM: PassManagerRef);
-        /** Number of bytes clobbered when doing a Store to *T. */
-        pub fn LLVMStoreSizeOfType(TD: TargetDataRef, Ty: TypeRef)
-                                   -> c_ulonglong;
-
-        /** Number of bytes clobbered when doing a Store to *T. */
-        pub fn LLVMSizeOfTypeInBits(TD: TargetDataRef, Ty: TypeRef)
-                                    -> c_ulonglong;
-
-        /** Distance between successive elements in an array of T.
-        Includes ABI padding. */
-        pub fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
-
-        /** Returns the preferred alignment of a type. */
-        pub fn LLVMPreferredAlignmentOfType(TD: TargetDataRef, Ty: TypeRef)
-                                            -> c_uint;
-        /** Returns the minimum alignment of a type. */
-        pub fn LLVMABIAlignmentOfType(TD: TargetDataRef, Ty: TypeRef)
-                                      -> c_uint;
-
-        /// Computes the byte offset of the indexed struct element for a
-        /// target.
-        pub fn LLVMOffsetOfElement(TD: TargetDataRef,
-                                   StructTy: TypeRef,
-                                   Element: c_uint)
-                                   -> c_ulonglong;
-
-        /**
-         * Returns the minimum alignment of a type when part of a call frame.
-         */
-        pub fn LLVMCallFrameAlignmentOfType(TD: TargetDataRef, Ty: TypeRef)
-                                            -> c_uint;
-
-        /** Disposes target data. */
-        pub fn LLVMDisposeTargetData(TD: TargetDataRef);
-
-        /** Creates a pass manager. */
-        pub fn LLVMCreatePassManager() -> PassManagerRef;
-
-        /** Creates a function-by-function pass manager */
-        pub fn LLVMCreateFunctionPassManagerForModule(M: ModuleRef)
-                                                      -> PassManagerRef;
-
-        /** Disposes a pass manager. */
-        pub fn LLVMDisposePassManager(PM: PassManagerRef);
-
-        /** Runs a pass manager on a module. */
-        pub fn LLVMRunPassManager(PM: PassManagerRef, M: ModuleRef) -> Bool;
-
-        /** Runs the function passes on the provided function. */
-        pub fn LLVMRunFunctionPassManager(FPM: PassManagerRef, F: ValueRef)
-                                          -> Bool;
-
-        /** Initializes all the function passes scheduled in the manager */
-        pub fn LLVMInitializeFunctionPassManager(FPM: PassManagerRef) -> Bool;
-
-        /** Finalizes all the function passes scheduled in the manager */
-        pub fn LLVMFinalizeFunctionPassManager(FPM: PassManagerRef) -> Bool;
-
-        pub fn LLVMInitializePasses();
-
-        /** Adds a verification pass. */
-        pub fn LLVMAddVerifierPass(PM: PassManagerRef);
-
-        pub fn LLVMAddGlobalOptimizerPass(PM: PassManagerRef);
-        pub fn LLVMAddIPSCCPPass(PM: PassManagerRef);
-        pub fn LLVMAddDeadArgEliminationPass(PM: PassManagerRef);
-        pub fn LLVMAddInstructionCombiningPass(PM: PassManagerRef);
-        pub fn LLVMAddCFGSimplificationPass(PM: PassManagerRef);
-        pub fn LLVMAddFunctionInliningPass(PM: PassManagerRef);
-        pub fn LLVMAddFunctionAttrsPass(PM: PassManagerRef);
-        pub fn LLVMAddScalarReplAggregatesPass(PM: PassManagerRef);
-        pub fn LLVMAddScalarReplAggregatesPassSSA(PM: PassManagerRef);
-        pub fn LLVMAddJumpThreadingPass(PM: PassManagerRef);
-        pub fn LLVMAddConstantPropagationPass(PM: PassManagerRef);
-        pub fn LLVMAddReassociatePass(PM: PassManagerRef);
-        pub fn LLVMAddLoopRotatePass(PM: PassManagerRef);
-        pub fn LLVMAddLICMPass(PM: PassManagerRef);
-        pub fn LLVMAddLoopUnswitchPass(PM: PassManagerRef);
-        pub fn LLVMAddLoopDeletionPass(PM: PassManagerRef);
-        pub fn LLVMAddLoopUnrollPass(PM: PassManagerRef);
-        pub fn LLVMAddGVNPass(PM: PassManagerRef);
-        pub fn LLVMAddMemCpyOptPass(PM: PassManagerRef);
-        pub fn LLVMAddSCCPPass(PM: PassManagerRef);
-        pub fn LLVMAddDeadStoreEliminationPass(PM: PassManagerRef);
-        pub fn LLVMAddStripDeadPrototypesPass(PM: PassManagerRef);
-        pub fn LLVMAddConstantMergePass(PM: PassManagerRef);
-        pub fn LLVMAddArgumentPromotionPass(PM: PassManagerRef);
-        pub fn LLVMAddTailCallEliminationPass(PM: PassManagerRef);
-        pub fn LLVMAddIndVarSimplifyPass(PM: PassManagerRef);
-        pub fn LLVMAddAggressiveDCEPass(PM: PassManagerRef);
-        pub fn LLVMAddGlobalDCEPass(PM: PassManagerRef);
-        pub fn LLVMAddCorrelatedValuePropagationPass(PM: PassManagerRef);
-        pub fn LLVMAddPruneEHPass(PM: PassManagerRef);
-        pub fn LLVMAddSimplifyLibCallsPass(PM: PassManagerRef);
-        pub fn LLVMAddLoopIdiomPass(PM: PassManagerRef);
-        pub fn LLVMAddEarlyCSEPass(PM: PassManagerRef);
-        pub fn LLVMAddTypeBasedAliasAnalysisPass(PM: PassManagerRef);
-        pub fn LLVMAddBasicAliasAnalysisPass(PM: PassManagerRef);
-
-        pub fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
-        pub fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef);
-        pub fn LLVMPassManagerBuilderSetOptLevel(PMB: PassManagerBuilderRef,
-                                                 OptimizationLevel: c_uint);
-        pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: PassManagerBuilderRef,
-                                                  Value: Bool);
-        pub fn LLVMPassManagerBuilderSetDisableUnitAtATime(
-            PMB: PassManagerBuilderRef,
-            Value: Bool);
-        pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(
-            PMB: PassManagerBuilderRef,
-            Value: Bool);
-        pub fn LLVMPassManagerBuilderSetDisableSimplifyLibCalls(
-            PMB: PassManagerBuilderRef,
-            Value: Bool);
-        pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(
-            PMB: PassManagerBuilderRef,
-            threshold: c_uint);
-        pub fn LLVMPassManagerBuilderPopulateModulePassManager(
-            PMB: PassManagerBuilderRef,
-            PM: PassManagerRef);
-
-        pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(
-            PMB: PassManagerBuilderRef,
-            PM: PassManagerRef);
-        pub fn LLVMPassManagerBuilderPopulateLTOPassManager(
-            PMB: PassManagerBuilderRef,
-            PM: PassManagerRef,
-            Internalize: Bool,
-            RunInliner: Bool);
-
-        /** Destroys a memory buffer. */
-        pub fn LLVMDisposeMemoryBuffer(MemBuf: MemoryBufferRef);
-
-
-        /* Stuff that's in rustllvm/ because it's not upstream yet. */
-
-        /** Opens an object file. */
-        pub fn LLVMCreateObjectFile(MemBuf: MemoryBufferRef) -> ObjectFileRef;
-        /** Closes an object file. */
-        pub fn LLVMDisposeObjectFile(ObjFile: ObjectFileRef);
-
-        /** Enumerates the sections in an object file. */
-        pub fn LLVMGetSections(ObjFile: ObjectFileRef) -> SectionIteratorRef;
-        /** Destroys a section iterator. */
-        pub fn LLVMDisposeSectionIterator(SI: SectionIteratorRef);
-        /** Returns true if the section iterator is at the end of the section
-            list: */
-        pub fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef,
-                                          SI: SectionIteratorRef)
-                                          -> Bool;
-        /** Moves the section iterator to point to the next section. */
-        pub fn LLVMMoveToNextSection(SI: SectionIteratorRef);
-        /** Returns the current section size. */
-        pub fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
-        /** Returns the current section contents as a string buffer. */
-        pub fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *const c_char;
-
-        /** Reads the given file and returns it as a memory buffer. Use
-            LLVMDisposeMemoryBuffer() to get rid of it. */
-        pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *const c_char)
-            -> MemoryBufferRef;
-        /** Borrows the contents of the memory buffer (doesn't copy it) */
-        pub fn LLVMCreateMemoryBufferWithMemoryRange(InputData: *const c_char,
-                                                     InputDataLength: size_t,
-                                                     BufferName: *const c_char,
-                                                     RequiresNull: Bool)
-            -> MemoryBufferRef;
-        pub fn LLVMCreateMemoryBufferWithMemoryRangeCopy(InputData: *const c_char,
-                                                         InputDataLength: size_t,
-                                                         BufferName: *const c_char)
-            -> MemoryBufferRef;
+    pub fn LLVMBuildAtomicFence(B: BuilderRef, Order: AtomicOrdering);
 
-        pub fn LLVMIsMultithreaded() -> Bool;
-        pub fn LLVMStartMultithreaded() -> Bool;
 
-        /** Returns a string describing the last error caused by an LLVMRust*
-            call. */
-        pub fn LLVMRustGetLastError() -> *const c_char;
+    /* Selected entries from the downcasts. */
+    pub fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
+    pub fn LLVMIsAStoreInst(Inst: ValueRef) -> ValueRef;
 
-        /// Print the pass timings since static dtors aren't picking them up.
-        pub fn LLVMRustPrintPassTimings();
+    /** Writes a module to the specified path. Returns 0 on success. */
+    pub fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: *const c_char) -> c_int;
 
-        pub fn LLVMStructCreateNamed(C: ContextRef, Name: *const c_char) -> TypeRef;
+    /** Creates target data from a target layout string. */
+    pub fn LLVMCreateTargetData(StringRep: *const c_char) -> TargetDataRef;
+    /// Adds the target data to the given pass manager. The pass manager
+    /// references the target data only weakly.
+    pub fn LLVMAddTargetData(TD: TargetDataRef, PM: PassManagerRef);
+    /** Number of bytes clobbered when doing a Store to *T. */
+    pub fn LLVMStoreSizeOfType(TD: TargetDataRef, Ty: TypeRef)
+                               -> c_ulonglong;
 
-        pub fn LLVMStructSetBody(StructTy: TypeRef,
-                                 ElementTypes: *const TypeRef,
-                                 ElementCount: c_uint,
-                                 Packed: Bool);
+    /** Number of bytes clobbered when doing a Store to *T. */
+    pub fn LLVMSizeOfTypeInBits(TD: TargetDataRef, Ty: TypeRef)
+                                -> c_ulonglong;
 
-        pub fn LLVMConstNamedStruct(S: TypeRef,
-                                    ConstantVals: *const ValueRef,
-                                    Count: c_uint)
-                                    -> ValueRef;
+    /** Distance between successive elements in an array of T.
+    Includes ABI padding. */
+    pub fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
 
-        /** Enables LLVM debug output. */
-        pub fn LLVMSetDebug(Enabled: c_int);
+    /** Returns the preferred alignment of a type. */
+    pub fn LLVMPreferredAlignmentOfType(TD: TargetDataRef, Ty: TypeRef)
+                                        -> c_uint;
+    /** Returns the minimum alignment of a type. */
+    pub fn LLVMABIAlignmentOfType(TD: TargetDataRef, Ty: TypeRef)
+                                  -> c_uint;
+
+    /// Computes the byte offset of the indexed struct element for a
+    /// target.
+    pub fn LLVMOffsetOfElement(TD: TargetDataRef,
+                               StructTy: TypeRef,
+                               Element: c_uint)
+                               -> c_ulonglong;
+
+    /**
+     * Returns the minimum alignment of a type when part of a call frame.
+     */
+    pub fn LLVMCallFrameAlignmentOfType(TD: TargetDataRef, Ty: TypeRef)
+                                        -> c_uint;
 
-        /** Prepares inline assembly. */
-        pub fn LLVMInlineAsm(Ty: TypeRef,
-                             AsmString: *const c_char,
-                             Constraints: *const c_char,
-                             SideEffects: Bool,
-                             AlignStack: Bool,
-                             Dialect: c_uint)
-                             -> ValueRef;
+    /** Disposes target data. */
+    pub fn LLVMDisposeTargetData(TD: TargetDataRef);
+
+    /** Creates a pass manager. */
+    pub fn LLVMCreatePassManager() -> PassManagerRef;
+
+    /** Creates a function-by-function pass manager */
+    pub fn LLVMCreateFunctionPassManagerForModule(M: ModuleRef)
+                                                  -> PassManagerRef;
+
+    /** Disposes a pass manager. */
+    pub fn LLVMDisposePassManager(PM: PassManagerRef);
+
+    /** Runs a pass manager on a module. */
+    pub fn LLVMRunPassManager(PM: PassManagerRef, M: ModuleRef) -> Bool;
+
+    /** Runs the function passes on the provided function. */
+    pub fn LLVMRunFunctionPassManager(FPM: PassManagerRef, F: ValueRef)
+                                      -> Bool;
+
+    /** Initializes all the function passes scheduled in the manager */
+    pub fn LLVMInitializeFunctionPassManager(FPM: PassManagerRef) -> Bool;
+
+    /** Finalizes all the function passes scheduled in the manager */
+    pub fn LLVMFinalizeFunctionPassManager(FPM: PassManagerRef) -> Bool;
+
+    pub fn LLVMInitializePasses();
+
+    /** Adds a verification pass. */
+    pub fn LLVMAddVerifierPass(PM: PassManagerRef);
+
+    pub fn LLVMAddGlobalOptimizerPass(PM: PassManagerRef);
+    pub fn LLVMAddIPSCCPPass(PM: PassManagerRef);
+    pub fn LLVMAddDeadArgEliminationPass(PM: PassManagerRef);
+    pub fn LLVMAddInstructionCombiningPass(PM: PassManagerRef);
+    pub fn LLVMAddCFGSimplificationPass(PM: PassManagerRef);
+    pub fn LLVMAddFunctionInliningPass(PM: PassManagerRef);
+    pub fn LLVMAddFunctionAttrsPass(PM: PassManagerRef);
+    pub fn LLVMAddScalarReplAggregatesPass(PM: PassManagerRef);
+    pub fn LLVMAddScalarReplAggregatesPassSSA(PM: PassManagerRef);
+    pub fn LLVMAddJumpThreadingPass(PM: PassManagerRef);
+    pub fn LLVMAddConstantPropagationPass(PM: PassManagerRef);
+    pub fn LLVMAddReassociatePass(PM: PassManagerRef);
+    pub fn LLVMAddLoopRotatePass(PM: PassManagerRef);
+    pub fn LLVMAddLICMPass(PM: PassManagerRef);
+    pub fn LLVMAddLoopUnswitchPass(PM: PassManagerRef);
+    pub fn LLVMAddLoopDeletionPass(PM: PassManagerRef);
+    pub fn LLVMAddLoopUnrollPass(PM: PassManagerRef);
+    pub fn LLVMAddGVNPass(PM: PassManagerRef);
+    pub fn LLVMAddMemCpyOptPass(PM: PassManagerRef);
+    pub fn LLVMAddSCCPPass(PM: PassManagerRef);
+    pub fn LLVMAddDeadStoreEliminationPass(PM: PassManagerRef);
+    pub fn LLVMAddStripDeadPrototypesPass(PM: PassManagerRef);
+    pub fn LLVMAddConstantMergePass(PM: PassManagerRef);
+    pub fn LLVMAddArgumentPromotionPass(PM: PassManagerRef);
+    pub fn LLVMAddTailCallEliminationPass(PM: PassManagerRef);
+    pub fn LLVMAddIndVarSimplifyPass(PM: PassManagerRef);
+    pub fn LLVMAddAggressiveDCEPass(PM: PassManagerRef);
+    pub fn LLVMAddGlobalDCEPass(PM: PassManagerRef);
+    pub fn LLVMAddCorrelatedValuePropagationPass(PM: PassManagerRef);
+    pub fn LLVMAddPruneEHPass(PM: PassManagerRef);
+    pub fn LLVMAddSimplifyLibCallsPass(PM: PassManagerRef);
+    pub fn LLVMAddLoopIdiomPass(PM: PassManagerRef);
+    pub fn LLVMAddEarlyCSEPass(PM: PassManagerRef);
+    pub fn LLVMAddTypeBasedAliasAnalysisPass(PM: PassManagerRef);
+    pub fn LLVMAddBasicAliasAnalysisPass(PM: PassManagerRef);
+
+    pub fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
+    pub fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef);
+    pub fn LLVMPassManagerBuilderSetOptLevel(PMB: PassManagerBuilderRef,
+                                             OptimizationLevel: c_uint);
+    pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: PassManagerBuilderRef,
+                                              Value: Bool);
+    pub fn LLVMPassManagerBuilderSetDisableUnitAtATime(
+        PMB: PassManagerBuilderRef,
+        Value: Bool);
+    pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(
+        PMB: PassManagerBuilderRef,
+        Value: Bool);
+    pub fn LLVMPassManagerBuilderSetDisableSimplifyLibCalls(
+        PMB: PassManagerBuilderRef,
+        Value: Bool);
+    pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(
+        PMB: PassManagerBuilderRef,
+        threshold: c_uint);
+    pub fn LLVMPassManagerBuilderPopulateModulePassManager(
+        PMB: PassManagerBuilderRef,
+        PM: PassManagerRef);
+
+    pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(
+        PMB: PassManagerBuilderRef,
+        PM: PassManagerRef);
+    pub fn LLVMPassManagerBuilderPopulateLTOPassManager(
+        PMB: PassManagerBuilderRef,
+        PM: PassManagerRef,
+        Internalize: Bool,
+        RunInliner: Bool);
+
+    /** Destroys a memory buffer. */
+    pub fn LLVMDisposeMemoryBuffer(MemBuf: MemoryBufferRef);
+
+
+    /* Stuff that's in rustllvm/ because it's not upstream yet. */
+
+    /** Opens an object file. */
+    pub fn LLVMCreateObjectFile(MemBuf: MemoryBufferRef) -> ObjectFileRef;
+    /** Closes an object file. */
+    pub fn LLVMDisposeObjectFile(ObjFile: ObjectFileRef);
+
+    /** Enumerates the sections in an object file. */
+    pub fn LLVMGetSections(ObjFile: ObjectFileRef) -> SectionIteratorRef;
+    /** Destroys a section iterator. */
+    pub fn LLVMDisposeSectionIterator(SI: SectionIteratorRef);
+    /** Returns true if the section iterator is at the end of the section
+    list: */
+    pub fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef,
+                                      SI: SectionIteratorRef)
+                                      -> Bool;
+    /** Moves the section iterator to point to the next section. */
+    pub fn LLVMMoveToNextSection(SI: SectionIteratorRef);
+    /** Returns the current section size. */
+    pub fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
+    /** Returns the current section contents as a string buffer. */
+    pub fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *const c_char;
+
+    /** Reads the given file and returns it as a memory buffer. Use
+    LLVMDisposeMemoryBuffer() to get rid of it. */
+    pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *const c_char)
+                                                        -> MemoryBufferRef;
+    /** Borrows the contents of the memory buffer (doesn't copy it) */
+    pub fn LLVMCreateMemoryBufferWithMemoryRange(InputData: *const c_char,
+                                                 InputDataLength: size_t,
+                                                 BufferName: *const c_char,
+                                                 RequiresNull: Bool)
+                                                 -> MemoryBufferRef;
+    pub fn LLVMCreateMemoryBufferWithMemoryRangeCopy(InputData: *const c_char,
+                                                     InputDataLength: size_t,
+                                                     BufferName: *const c_char)
+                                                     -> MemoryBufferRef;
 
-        pub static LLVMRustDebugMetadataVersion: u32;
+    pub fn LLVMIsMultithreaded() -> Bool;
+    pub fn LLVMStartMultithreaded() -> Bool;
 
-        pub fn LLVMRustAddModuleFlag(M: ModuleRef,
-                                     name: *const c_char,
-                                     value: u32);
+    /** Returns a string describing the last error caused by an LLVMRust*
+    call. */
+    pub fn LLVMRustGetLastError() -> *const c_char;
 
-        pub fn LLVMDIBuilderCreate(M: ModuleRef) -> DIBuilderRef;
+    /// Print the pass timings since static dtors aren't picking them up.
+    pub fn LLVMRustPrintPassTimings();
 
-        pub fn LLVMDIBuilderDispose(Builder: DIBuilderRef);
+    pub fn LLVMStructCreateNamed(C: ContextRef, Name: *const c_char) -> TypeRef;
 
-        pub fn LLVMDIBuilderFinalize(Builder: DIBuilderRef);
+    pub fn LLVMStructSetBody(StructTy: TypeRef,
+                             ElementTypes: *const TypeRef,
+                             ElementCount: c_uint,
+                             Packed: Bool);
 
-        pub fn LLVMDIBuilderCreateCompileUnit(Builder: DIBuilderRef,
-                                              Lang: c_uint,
-                                              File: *const c_char,
-                                              Dir: *const c_char,
-                                              Producer: *const c_char,
-                                              isOptimized: bool,
-                                              Flags: *const c_char,
-                                              RuntimeVer: c_uint,
-                                              SplitName: *const c_char);
+    pub fn LLVMConstNamedStruct(S: TypeRef,
+                                ConstantVals: *const ValueRef,
+                                Count: c_uint)
+                                -> ValueRef;
 
-        pub fn LLVMDIBuilderCreateFile(Builder: DIBuilderRef,
-                                       Filename: *const c_char,
-                                       Directory: *const c_char)
-                                       -> DIFile;
+    /** Enables LLVM debug output. */
+    pub fn LLVMSetDebug(Enabled: c_int);
 
-        pub fn LLVMDIBuilderCreateSubroutineType(Builder: DIBuilderRef,
-                                                 File: DIFile,
-                                                 ParameterTypes: DIArray)
-                                                 -> DICompositeType;
+    /** Prepares inline assembly. */
+    pub fn LLVMInlineAsm(Ty: TypeRef,
+                         AsmString: *const c_char,
+                         Constraints: *const c_char,
+                         SideEffects: Bool,
+                         AlignStack: Bool,
+                         Dialect: c_uint)
+                         -> ValueRef;
 
-        pub fn LLVMDIBuilderCreateFunction(Builder: DIBuilderRef,
-                                           Scope: DIDescriptor,
-                                           Name: *const c_char,
-                                           LinkageName: *const c_char,
-                                           File: DIFile,
-                                           LineNo: c_uint,
-                                           Ty: DIType,
-                                           isLocalToUnit: bool,
-                                           isDefinition: bool,
-                                           ScopeLine: c_uint,
-                                           Flags: c_uint,
-                                           isOptimized: bool,
-                                           Fn: ValueRef,
-                                           TParam: ValueRef,
-                                           Decl: ValueRef)
-                                           -> DISubprogram;
-
-        pub fn LLVMDIBuilderCreateBasicType(Builder: DIBuilderRef,
-                                            Name: *const c_char,
-                                            SizeInBits: c_ulonglong,
-                                            AlignInBits: c_ulonglong,
-                                            Encoding: c_uint)
-                                            -> DIBasicType;
+    pub static LLVMRustDebugMetadataVersion: u32;
 
-        pub fn LLVMDIBuilderCreatePointerType(Builder: DIBuilderRef,
-                                              PointeeTy: DIType,
-                                              SizeInBits: c_ulonglong,
-                                              AlignInBits: c_ulonglong,
-                                              Name: *const c_char)
-                                              -> DIDerivedType;
+    pub fn LLVMRustAddModuleFlag(M: ModuleRef,
+                                 name: *const c_char,
+                                 value: u32);
 
-        pub fn LLVMDIBuilderCreateStructType(Builder: DIBuilderRef,
-                                             Scope: DIDescriptor,
-                                             Name: *const c_char,
+    pub fn LLVMDIBuilderCreate(M: ModuleRef) -> DIBuilderRef;
+
+    pub fn LLVMDIBuilderDispose(Builder: DIBuilderRef);
+
+    pub fn LLVMDIBuilderFinalize(Builder: DIBuilderRef);
+
+    pub fn LLVMDIBuilderCreateCompileUnit(Builder: DIBuilderRef,
+                                          Lang: c_uint,
+                                          File: *const c_char,
+                                          Dir: *const c_char,
+                                          Producer: *const c_char,
+                                          isOptimized: bool,
+                                          Flags: *const c_char,
+                                          RuntimeVer: c_uint,
+                                          SplitName: *const c_char);
+
+    pub fn LLVMDIBuilderCreateFile(Builder: DIBuilderRef,
+                                   Filename: *const c_char,
+                                   Directory: *const c_char)
+                                   -> DIFile;
+
+    pub fn LLVMDIBuilderCreateSubroutineType(Builder: DIBuilderRef,
                                              File: DIFile,
-                                             LineNumber: c_uint,
-                                             SizeInBits: c_ulonglong,
-                                             AlignInBits: c_ulonglong,
-                                             Flags: c_uint,
-                                             DerivedFrom: DIType,
-                                             Elements: DIArray,
-                                             RunTimeLang: c_uint,
-                                             VTableHolder: ValueRef,
-                                             UniqueId: *const c_char)
+                                             ParameterTypes: DIArray)
                                              -> DICompositeType;
 
-        pub fn LLVMDIBuilderCreateMemberType(Builder: DIBuilderRef,
-                                             Scope: DIDescriptor,
+    pub fn LLVMDIBuilderCreateFunction(Builder: DIBuilderRef,
+                                       Scope: DIDescriptor,
+                                       Name: *const c_char,
+                                       LinkageName: *const c_char,
+                                       File: DIFile,
+                                       LineNo: c_uint,
+                                       Ty: DIType,
+                                       isLocalToUnit: bool,
+                                       isDefinition: bool,
+                                       ScopeLine: c_uint,
+                                       Flags: c_uint,
+                                       isOptimized: bool,
+                                       Fn: ValueRef,
+                                       TParam: ValueRef,
+                                       Decl: ValueRef)
+                                       -> DISubprogram;
+
+    pub fn LLVMDIBuilderCreateBasicType(Builder: DIBuilderRef,
+                                        Name: *const c_char,
+                                        SizeInBits: c_ulonglong,
+                                        AlignInBits: c_ulonglong,
+                                        Encoding: c_uint)
+                                        -> DIBasicType;
+
+    pub fn LLVMDIBuilderCreatePointerType(Builder: DIBuilderRef,
+                                          PointeeTy: DIType,
+                                          SizeInBits: c_ulonglong,
+                                          AlignInBits: c_ulonglong,
+                                          Name: *const c_char)
+                                          -> DIDerivedType;
+
+    pub fn LLVMDIBuilderCreateStructType(Builder: DIBuilderRef,
+                                         Scope: DIDescriptor,
+                                         Name: *const c_char,
+                                         File: DIFile,
+                                         LineNumber: c_uint,
+                                         SizeInBits: c_ulonglong,
+                                         AlignInBits: c_ulonglong,
+                                         Flags: c_uint,
+                                         DerivedFrom: DIType,
+                                         Elements: DIArray,
+                                         RunTimeLang: c_uint,
+                                         VTableHolder: ValueRef,
+                                         UniqueId: *const c_char)
+                                         -> DICompositeType;
+
+    pub fn LLVMDIBuilderCreateMemberType(Builder: DIBuilderRef,
+                                         Scope: DIDescriptor,
+                                         Name: *const c_char,
+                                         File: DIFile,
+                                         LineNo: c_uint,
+                                         SizeInBits: c_ulonglong,
+                                         AlignInBits: c_ulonglong,
+                                         OffsetInBits: c_ulonglong,
+                                         Flags: c_uint,
+                                         Ty: DIType)
+                                         -> DIDerivedType;
+
+    pub fn LLVMDIBuilderCreateLexicalBlock(Builder: DIBuilderRef,
+                                           Scope: DIDescriptor,
+                                           File: DIFile,
+                                           Line: c_uint,
+                                           Col: c_uint,
+                                           Discriminator: c_uint)
+                                           -> DILexicalBlock;
+
+    pub fn LLVMDIBuilderCreateStaticVariable(Builder: DIBuilderRef,
+                                             Context: DIDescriptor,
                                              Name: *const c_char,
+                                             LinkageName: *const c_char,
                                              File: DIFile,
                                              LineNo: c_uint,
-                                             SizeInBits: c_ulonglong,
-                                             AlignInBits: c_ulonglong,
-                                             OffsetInBits: c_ulonglong,
-                                             Flags: c_uint,
-                                             Ty: DIType)
-                                             -> DIDerivedType;
-
-        pub fn LLVMDIBuilderCreateLexicalBlock(Builder: DIBuilderRef,
-                                               Scope: DIDescriptor,
-                                               File: DIFile,
-                                               Line: c_uint,
-                                               Col: c_uint,
-                                               Discriminator: c_uint)
-                                               -> DILexicalBlock;
-
-        pub fn LLVMDIBuilderCreateStaticVariable(Builder: DIBuilderRef,
-                                                 Context: DIDescriptor,
-                                                 Name: *const c_char,
-                                                 LinkageName: *const c_char,
-                                                 File: DIFile,
-                                                 LineNo: c_uint,
-                                                 Ty: DIType,
-                                                 isLocalToUnit: bool,
-                                                 Val: ValueRef,
-                                                 Decl: ValueRef)
-                                                 -> DIGlobalVariable;
-
-        pub fn LLVMDIBuilderCreateLocalVariable(Builder: DIBuilderRef,
-                                                Tag: c_uint,
-                                                Scope: DIDescriptor,
-                                                Name: *const c_char,
-                                                File: DIFile,
-                                                LineNo: c_uint,
-                                                Ty: DIType,
-                                                AlwaysPreserve: bool,
-                                                Flags: c_uint,
-                                                ArgNo: c_uint)
-                                                -> DIVariable;
-
-        pub fn LLVMDIBuilderCreateArrayType(Builder: DIBuilderRef,
-                                            Size: c_ulonglong,
-                                            AlignInBits: c_ulonglong,
-                                            Ty: DIType,
-                                            Subscripts: DIArray)
-                                            -> DIType;
-
-        pub fn LLVMDIBuilderCreateVectorType(Builder: DIBuilderRef,
-                                             Size: c_ulonglong,
-                                             AlignInBits: c_ulonglong,
                                              Ty: DIType,
-                                             Subscripts: DIArray)
-                                             -> DIType;
-
-        pub fn LLVMDIBuilderGetOrCreateSubrange(Builder: DIBuilderRef,
-                                                Lo: c_longlong,
-                                                Count: c_longlong)
-                                                -> DISubrange;
-
-        pub fn LLVMDIBuilderGetOrCreateArray(Builder: DIBuilderRef,
-                                             Ptr: *const DIDescriptor,
-                                             Count: c_uint)
-                                             -> DIArray;
-
-        pub fn LLVMDIBuilderInsertDeclareAtEnd(Builder: DIBuilderRef,
-                                               Val: ValueRef,
-                                               VarInfo: DIVariable,
-                                               InsertAtEnd: BasicBlockRef)
-                                               -> ValueRef;
-
-        pub fn LLVMDIBuilderInsertDeclareBefore(Builder: DIBuilderRef,
-                                                Val: ValueRef,
-                                                VarInfo: DIVariable,
-                                                InsertBefore: ValueRef)
-                                                -> ValueRef;
-
-        pub fn LLVMDIBuilderCreateEnumerator(Builder: DIBuilderRef,
-                                             Name: *const c_char,
-                                             Val: c_ulonglong)
-                                             -> ValueRef;
-
-        pub fn LLVMDIBuilderCreateEnumerationType(Builder: DIBuilderRef,
-                                                  Scope: ValueRef,
-                                                  Name: *const c_char,
-                                                  File: ValueRef,
-                                                  LineNumber: c_uint,
-                                                  SizeInBits: c_ulonglong,
-                                                  AlignInBits: c_ulonglong,
-                                                  Elements: ValueRef,
-                                                  ClassType: ValueRef)
-                                                  -> ValueRef;
-
-        pub fn LLVMDIBuilderCreateUnionType(Builder: DIBuilderRef,
-                                            Scope: ValueRef,
+                                             isLocalToUnit: bool,
+                                             Val: ValueRef,
+                                             Decl: ValueRef)
+                                             -> DIGlobalVariable;
+
+    pub fn LLVMDIBuilderCreateLocalVariable(Builder: DIBuilderRef,
+                                            Tag: c_uint,
+                                            Scope: DIDescriptor,
                                             Name: *const c_char,
-                                            File: ValueRef,
-                                            LineNumber: c_uint,
-                                            SizeInBits: c_ulonglong,
-                                            AlignInBits: c_ulonglong,
+                                            File: DIFile,
+                                            LineNo: c_uint,
+                                            Ty: DIType,
+                                            AlwaysPreserve: bool,
                                             Flags: c_uint,
-                                            Elements: ValueRef,
-                                            RunTimeLang: c_uint,
-                                            UniqueId: *const c_char)
-                                            -> ValueRef;
+                                            ArgNo: c_uint)
+                                            -> DIVariable;
+
+    pub fn LLVMDIBuilderCreateArrayType(Builder: DIBuilderRef,
+                                        Size: c_ulonglong,
+                                        AlignInBits: c_ulonglong,
+                                        Ty: DIType,
+                                        Subscripts: DIArray)
+                                        -> DIType;
+
+    pub fn LLVMDIBuilderCreateVectorType(Builder: DIBuilderRef,
+                                         Size: c_ulonglong,
+                                         AlignInBits: c_ulonglong,
+                                         Ty: DIType,
+                                         Subscripts: DIArray)
+                                         -> DIType;
+
+    pub fn LLVMDIBuilderGetOrCreateSubrange(Builder: DIBuilderRef,
+                                            Lo: c_longlong,
+                                            Count: c_longlong)
+                                            -> DISubrange;
+
+    pub fn LLVMDIBuilderGetOrCreateArray(Builder: DIBuilderRef,
+                                         Ptr: *const DIDescriptor,
+                                         Count: c_uint)
+                                         -> DIArray;
+
+    pub fn LLVMDIBuilderInsertDeclareAtEnd(Builder: DIBuilderRef,
+                                           Val: ValueRef,
+                                           VarInfo: DIVariable,
+                                           InsertAtEnd: BasicBlockRef)
+                                           -> ValueRef;
 
-        pub fn LLVMSetUnnamedAddr(GlobalVar: ValueRef, UnnamedAddr: Bool);
-
-        pub fn LLVMDIBuilderCreateTemplateTypeParameter(Builder: DIBuilderRef,
-                                                        Scope: ValueRef,
-                                                        Name: *const c_char,
-                                                        Ty: ValueRef,
-                                                        File: ValueRef,
-                                                        LineNo: c_uint,
-                                                        ColumnNo: c_uint)
-                                                        -> ValueRef;
-
-        pub fn LLVMDIBuilderCreateOpDeref(IntType: TypeRef) -> ValueRef;
-
-        pub fn LLVMDIBuilderCreateOpPlus(IntType: TypeRef) -> ValueRef;
-
-        pub fn LLVMDIBuilderCreateComplexVariable(Builder: DIBuilderRef,
-            Tag: c_uint,
-            Scope: ValueRef,
-            Name: *const c_char,
-            File: ValueRef,
-            LineNo: c_uint,
-            Ty: ValueRef,
-            AddrOps: *const ValueRef,
-            AddrOpsCount: c_uint,
-            ArgNo: c_uint)
-            -> ValueRef;
-
-        pub fn LLVMDIBuilderCreateNameSpace(Builder: DIBuilderRef,
-                                            Scope: ValueRef,
-                                            Name: *const c_char,
-                                            File: ValueRef,
-                                            LineNo: c_uint)
+    pub fn LLVMDIBuilderInsertDeclareBefore(Builder: DIBuilderRef,
+                                            Val: ValueRef,
+                                            VarInfo: DIVariable,
+                                            InsertBefore: ValueRef)
                                             -> ValueRef;
 
-        pub fn LLVMDICompositeTypeSetTypeArray(CompositeType: ValueRef, TypeArray: ValueRef);
-        pub fn LLVMTypeToString(Type: TypeRef) -> *const c_char;
-        pub fn LLVMValueToString(value_ref: ValueRef) -> *const c_char;
-
-        pub fn LLVMIsAArgument(value_ref: ValueRef) -> ValueRef;
-
-        pub fn LLVMIsAAllocaInst(value_ref: ValueRef) -> ValueRef;
-
-        pub fn LLVMInitializeX86TargetInfo();
-        pub fn LLVMInitializeX86Target();
-        pub fn LLVMInitializeX86TargetMC();
-        pub fn LLVMInitializeX86AsmPrinter();
-        pub fn LLVMInitializeX86AsmParser();
-        pub fn LLVMInitializeARMTargetInfo();
-        pub fn LLVMInitializeARMTarget();
-        pub fn LLVMInitializeARMTargetMC();
-        pub fn LLVMInitializeARMAsmPrinter();
-        pub fn LLVMInitializeARMAsmParser();
-        pub fn LLVMInitializeMipsTargetInfo();
-        pub fn LLVMInitializeMipsTarget();
-        pub fn LLVMInitializeMipsTargetMC();
-        pub fn LLVMInitializeMipsAsmPrinter();
-        pub fn LLVMInitializeMipsAsmParser();
-
-        pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: *const c_char) -> bool;
-        pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
-                                           CPU: *const c_char,
-                                           Features: *const c_char,
-                                           Model: CodeGenModel,
-                                           Reloc: RelocMode,
-                                           Level: CodeGenOptLevel,
-                                           EnableSegstk: bool,
-                                           UseSoftFP: bool,
-                                           NoFramePointerElim: bool,
-                                           FunctionSections: bool,
-                                           DataSections: bool) -> TargetMachineRef;
-        pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
-        pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef,
-                                         PM: PassManagerRef,
-                                         M: ModuleRef);
-        pub fn LLVMRustAddBuilderLibraryInfo(PMB: PassManagerBuilderRef,
-                                             M: ModuleRef,
-                                             DisableSimplifyLibCalls: bool);
-        pub fn LLVMRustAddLibraryInfo(PM: PassManagerRef, M: ModuleRef,
-                                      DisableSimplifyLibCalls: bool);
-        pub fn LLVMRustRunFunctionPassManager(PM: PassManagerRef, M: ModuleRef);
-        pub fn LLVMRustWriteOutputFile(T: TargetMachineRef,
-                                       PM: PassManagerRef,
-                                       M: ModuleRef,
-                                       Output: *const c_char,
-                                       FileType: FileType) -> bool;
-        pub fn LLVMRustPrintModule(PM: PassManagerRef,
+    pub fn LLVMDIBuilderCreateEnumerator(Builder: DIBuilderRef,
+                                         Name: *const c_char,
+                                         Val: c_ulonglong)
+                                         -> ValueRef;
+
+    pub fn LLVMDIBuilderCreateEnumerationType(Builder: DIBuilderRef,
+                                              Scope: ValueRef,
+                                              Name: *const c_char,
+                                              File: ValueRef,
+                                              LineNumber: c_uint,
+                                              SizeInBits: c_ulonglong,
+                                              AlignInBits: c_ulonglong,
+                                              Elements: ValueRef,
+                                              ClassType: ValueRef)
+                                              -> ValueRef;
+
+    pub fn LLVMDIBuilderCreateUnionType(Builder: DIBuilderRef,
+                                        Scope: ValueRef,
+                                        Name: *const c_char,
+                                        File: ValueRef,
+                                        LineNumber: c_uint,
+                                        SizeInBits: c_ulonglong,
+                                        AlignInBits: c_ulonglong,
+                                        Flags: c_uint,
+                                        Elements: ValueRef,
+                                        RunTimeLang: c_uint,
+                                        UniqueId: *const c_char)
+                                        -> ValueRef;
+
+    pub fn LLVMSetUnnamedAddr(GlobalVar: ValueRef, UnnamedAddr: Bool);
+
+    pub fn LLVMDIBuilderCreateTemplateTypeParameter(Builder: DIBuilderRef,
+                                                    Scope: ValueRef,
+                                                    Name: *const c_char,
+                                                    Ty: ValueRef,
+                                                    File: ValueRef,
+                                                    LineNo: c_uint,
+                                                    ColumnNo: c_uint)
+                                                    -> ValueRef;
+
+    pub fn LLVMDIBuilderCreateOpDeref(IntType: TypeRef) -> ValueRef;
+
+    pub fn LLVMDIBuilderCreateOpPlus(IntType: TypeRef) -> ValueRef;
+
+    pub fn LLVMDIBuilderCreateComplexVariable(Builder: DIBuilderRef,
+                                              Tag: c_uint,
+                                              Scope: ValueRef,
+                                              Name: *const c_char,
+                                              File: ValueRef,
+                                              LineNo: c_uint,
+                                              Ty: ValueRef,
+                                              AddrOps: *const ValueRef,
+                                              AddrOpsCount: c_uint,
+                                              ArgNo: c_uint)
+                                              -> ValueRef;
+
+    pub fn LLVMDIBuilderCreateNameSpace(Builder: DIBuilderRef,
+                                        Scope: ValueRef,
+                                        Name: *const c_char,
+                                        File: ValueRef,
+                                        LineNo: c_uint)
+                                        -> ValueRef;
+
+    pub fn LLVMDICompositeTypeSetTypeArray(CompositeType: ValueRef, TypeArray: ValueRef);
+    pub fn LLVMTypeToString(Type: TypeRef) -> *const c_char;
+    pub fn LLVMValueToString(value_ref: ValueRef) -> *const c_char;
+
+    pub fn LLVMIsAArgument(value_ref: ValueRef) -> ValueRef;
+
+    pub fn LLVMIsAAllocaInst(value_ref: ValueRef) -> ValueRef;
+
+    pub fn LLVMInitializeX86TargetInfo();
+    pub fn LLVMInitializeX86Target();
+    pub fn LLVMInitializeX86TargetMC();
+    pub fn LLVMInitializeX86AsmPrinter();
+    pub fn LLVMInitializeX86AsmParser();
+    pub fn LLVMInitializeARMTargetInfo();
+    pub fn LLVMInitializeARMTarget();
+    pub fn LLVMInitializeARMTargetMC();
+    pub fn LLVMInitializeARMAsmPrinter();
+    pub fn LLVMInitializeARMAsmParser();
+    pub fn LLVMInitializeMipsTargetInfo();
+    pub fn LLVMInitializeMipsTarget();
+    pub fn LLVMInitializeMipsTargetMC();
+    pub fn LLVMInitializeMipsAsmPrinter();
+    pub fn LLVMInitializeMipsAsmParser();
+
+    pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: *const c_char) -> bool;
+    pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
+                                       CPU: *const c_char,
+                                       Features: *const c_char,
+                                       Model: CodeGenModel,
+                                       Reloc: RelocMode,
+                                       Level: CodeGenOptLevel,
+                                       EnableSegstk: bool,
+                                       UseSoftFP: bool,
+                                       NoFramePointerElim: bool,
+                                       FunctionSections: bool,
+                                       DataSections: bool) -> TargetMachineRef;
+    pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
+    pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef,
+                                     PM: PassManagerRef,
+                                     M: ModuleRef);
+    pub fn LLVMRustAddBuilderLibraryInfo(PMB: PassManagerBuilderRef,
+                                         M: ModuleRef,
+                                         DisableSimplifyLibCalls: bool);
+    pub fn LLVMRustAddLibraryInfo(PM: PassManagerRef, M: ModuleRef,
+                                  DisableSimplifyLibCalls: bool);
+    pub fn LLVMRustRunFunctionPassManager(PM: PassManagerRef, M: ModuleRef);
+    pub fn LLVMRustWriteOutputFile(T: TargetMachineRef,
+                                   PM: PassManagerRef,
                                    M: ModuleRef,
-                                   Output: *const c_char);
-        pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
-        pub fn LLVMRustPrintPasses();
-        pub fn LLVMRustSetNormalizedTarget(M: ModuleRef, triple: *const c_char);
-        pub fn LLVMRustAddAlwaysInlinePass(P: PassManagerBuilderRef,
-                                           AddLifetimes: bool);
-        pub fn LLVMRustLinkInExternalBitcode(M: ModuleRef,
-                                             bc: *const c_char,
-                                             len: size_t) -> bool;
-        pub fn LLVMRustRunRestrictionPass(M: ModuleRef,
-                                          syms: *const *const c_char,
-                                          len: size_t);
-        pub fn LLVMRustMarkAllFunctionsNounwind(M: ModuleRef);
-
-        pub fn LLVMRustOpenArchive(path: *const c_char) -> ArchiveRef;
-        pub fn LLVMRustArchiveReadSection(AR: ArchiveRef, name: *const c_char,
-                                          out_len: *mut size_t) -> *const c_char;
-        pub fn LLVMRustDestroyArchive(AR: ArchiveRef);
-
-        pub fn LLVMRustSetDLLExportStorageClass(V: ValueRef);
-        pub fn LLVMVersionMajor() -> c_int;
-        pub fn LLVMVersionMinor() -> c_int;
-
-        pub fn LLVMRustGetSectionName(SI: SectionIteratorRef,
-                                      data: *mut *const c_char) -> c_int;
-    }
+                                   Output: *const c_char,
+                                   FileType: FileType) -> bool;
+    pub fn LLVMRustPrintModule(PM: PassManagerRef,
+                               M: ModuleRef,
+                               Output: *const c_char);
+    pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
+    pub fn LLVMRustPrintPasses();
+    pub fn LLVMRustSetNormalizedTarget(M: ModuleRef, triple: *const c_char);
+    pub fn LLVMRustAddAlwaysInlinePass(P: PassManagerBuilderRef,
+                                       AddLifetimes: bool);
+    pub fn LLVMRustLinkInExternalBitcode(M: ModuleRef,
+                                         bc: *const c_char,
+                                         len: size_t) -> bool;
+    pub fn LLVMRustRunRestrictionPass(M: ModuleRef,
+                                      syms: *const *const c_char,
+                                      len: size_t);
+    pub fn LLVMRustMarkAllFunctionsNounwind(M: ModuleRef);
+
+    pub fn LLVMRustOpenArchive(path: *const c_char) -> ArchiveRef;
+    pub fn LLVMRustArchiveReadSection(AR: ArchiveRef, name: *const c_char,
+                                      out_len: *mut size_t) -> *const c_char;
+    pub fn LLVMRustDestroyArchive(AR: ArchiveRef);
+
+    pub fn LLVMRustSetDLLExportStorageClass(V: ValueRef);
+    pub fn LLVMVersionMajor() -> c_int;
+    pub fn LLVMVersionMinor() -> c_int;
+
+    pub fn LLVMRustGetSectionName(SI: SectionIteratorRef,
+                                  data: *mut *const c_char) -> c_int;
 }
 
 pub fn SetInstructionCallConv(instr: ValueRef, cc: CallConv) {
     unsafe {
-        llvm::LLVMSetInstructionCallConv(instr, cc as c_uint);
+        LLVMSetInstructionCallConv(instr, cc as c_uint);
     }
 }
 pub fn SetFunctionCallConv(fn_: ValueRef, cc: CallConv) {
     unsafe {
-        llvm::LLVMSetFunctionCallConv(fn_, cc as c_uint);
+        LLVMSetFunctionCallConv(fn_, cc as c_uint);
     }
 }
 pub fn SetLinkage(global: ValueRef, link: Linkage) {
     unsafe {
-        llvm::LLVMSetLinkage(global, link as c_uint);
+        LLVMSetLinkage(global, link as c_uint);
     }
 }
 
 pub fn SetUnnamedAddr(global: ValueRef, unnamed: bool) {
     unsafe {
-        llvm::LLVMSetUnnamedAddr(global, unnamed as Bool);
+        LLVMSetUnnamedAddr(global, unnamed as Bool);
     }
 }
 
 pub fn set_thread_local(global: ValueRef, is_thread_local: bool) {
     unsafe {
-        llvm::LLVMSetThreadLocal(global, is_thread_local as Bool);
+        LLVMSetThreadLocal(global, is_thread_local as Bool);
     }
 }
 
 pub fn ConstICmp(pred: IntPredicate, v1: ValueRef, v2: ValueRef) -> ValueRef {
     unsafe {
-        llvm::LLVMConstICmp(pred as c_ushort, v1, v2)
+        LLVMConstICmp(pred as c_ushort, v1, v2)
     }
 }
 pub fn ConstFCmp(pred: RealPredicate, v1: ValueRef, v2: ValueRef) -> ValueRef {
     unsafe {
-        llvm::LLVMConstFCmp(pred as c_ushort, v1, v2)
+        LLVMConstFCmp(pred as c_ushort, v1, v2)
     }
 }
 
 pub fn SetFunctionAttribute(fn_: ValueRef, attr: Attribute) {
     unsafe {
-        llvm::LLVMAddFunctionAttribute(fn_, FunctionIndex as c_uint, attr as uint64_t)
+        LLVMAddFunctionAttribute(fn_, FunctionIndex as c_uint, attr as uint64_t)
     }
 }
 
@@ -1930,7 +1924,7 @@ pub struct TargetData {
 impl Drop for TargetData {
     fn drop(&mut self) {
         unsafe {
-            llvm::LLVMDisposeTargetData(self.lltd);
+            LLVMDisposeTargetData(self.lltd);
         }
     }
 }
@@ -1938,7 +1932,7 @@ impl Drop for TargetData {
 pub fn mk_target_data(string_rep: &str) -> TargetData {
     TargetData {
         lltd: string_rep.with_c_str(|buf| {
-            unsafe { llvm::LLVMCreateTargetData(buf) }
+            unsafe { LLVMCreateTargetData(buf) }
         })
     }
 }
@@ -1953,7 +1947,7 @@ impl ObjectFile {
     // This will take ownership of llmb
     pub fn new(llmb: MemoryBufferRef) -> Option<ObjectFile> {
         unsafe {
-            let llof = llvm::LLVMCreateObjectFile(llmb);
+            let llof = LLVMCreateObjectFile(llmb);
             if llof as int == 0 {
                 // LLVMCreateObjectFile took ownership of llmb
                 return None
@@ -1969,7 +1963,7 @@ impl ObjectFile {
 impl Drop for ObjectFile {
     fn drop(&mut self) {
         unsafe {
-            llvm::LLVMDisposeObjectFile(self.llof);
+            LLVMDisposeObjectFile(self.llof);
         }
     }
 }
@@ -1983,7 +1977,7 @@ pub struct SectionIter {
 impl Drop for SectionIter {
     fn drop(&mut self) {
         unsafe {
-            llvm::LLVMDisposeSectionIterator(self.llsi);
+            LLVMDisposeSectionIterator(self.llsi);
         }
     }
 }
@@ -1991,7 +1985,7 @@ impl Drop for SectionIter {
 pub fn mk_section_iter(llof: ObjectFileRef) -> SectionIter {
     unsafe {
         SectionIter {
-            llsi: llvm::LLVMGetSections(llof)
+            llsi: LLVMGetSections(llof)
         }
     }
 }
@@ -2001,39 +1995,39 @@ pub fn mk_section_iter(llof: ObjectFileRef) -> SectionIter {
 // away.  We're just calling lots of stuff until we transitively get
 // all of LLVM. This is worse than anything.
 pub unsafe fn static_link_hack_this_sucks() {
-    llvm::LLVMInitializePasses();
-
-    llvm::LLVMInitializeX86TargetInfo();
-    llvm::LLVMInitializeX86Target();
-    llvm::LLVMInitializeX86TargetMC();
-    llvm::LLVMInitializeX86AsmPrinter();
-    llvm::LLVMInitializeX86AsmParser();
-
-    llvm::LLVMInitializeARMTargetInfo();
-    llvm::LLVMInitializeARMTarget();
-    llvm::LLVMInitializeARMTargetMC();
-    llvm::LLVMInitializeARMAsmPrinter();
-    llvm::LLVMInitializeARMAsmParser();
-
-    llvm::LLVMInitializeMipsTargetInfo();
-    llvm::LLVMInitializeMipsTarget();
-    llvm::LLVMInitializeMipsTargetMC();
-    llvm::LLVMInitializeMipsAsmPrinter();
-    llvm::LLVMInitializeMipsAsmParser();
-
-    llvm::LLVMRustSetLLVMOptions(0 as c_int,
+    LLVMInitializePasses();
+
+    LLVMInitializeX86TargetInfo();
+    LLVMInitializeX86Target();
+    LLVMInitializeX86TargetMC();
+    LLVMInitializeX86AsmPrinter();
+    LLVMInitializeX86AsmParser();
+
+    LLVMInitializeARMTargetInfo();
+    LLVMInitializeARMTarget();
+    LLVMInitializeARMTargetMC();
+    LLVMInitializeARMAsmPrinter();
+    LLVMInitializeARMAsmParser();
+
+    LLVMInitializeMipsTargetInfo();
+    LLVMInitializeMipsTarget();
+    LLVMInitializeMipsTargetMC();
+    LLVMInitializeMipsAsmPrinter();
+    LLVMInitializeMipsAsmParser();
+
+    LLVMRustSetLLVMOptions(0 as c_int,
                                        0 as *const _);
 
-    llvm::LLVMPassManagerBuilderPopulateModulePassManager(0 as *mut _, 0 as *mut _);
-    llvm::LLVMPassManagerBuilderPopulateLTOPassManager(0 as *mut _, 0 as *mut _, False, False);
-    llvm::LLVMPassManagerBuilderPopulateFunctionPassManager(0 as *mut _, 0 as *mut _);
-    llvm::LLVMPassManagerBuilderSetOptLevel(0 as *mut _, 0 as c_uint);
-    llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(0 as *mut _, 0 as c_uint);
-    llvm::LLVMWriteBitcodeToFile(0 as *mut _, 0 as *const _);
-    llvm::LLVMPassManagerBuilderCreate();
-    llvm::LLVMPassManagerBuilderDispose(0 as *mut _);
+    LLVMPassManagerBuilderPopulateModulePassManager(0 as *mut _, 0 as *mut _);
+    LLVMPassManagerBuilderPopulateLTOPassManager(0 as *mut _, 0 as *mut _, False, False);
+    LLVMPassManagerBuilderPopulateFunctionPassManager(0 as *mut _, 0 as *mut _);
+    LLVMPassManagerBuilderSetOptLevel(0 as *mut _, 0 as c_uint);
+    LLVMPassManagerBuilderUseInlinerWithThreshold(0 as *mut _, 0 as c_uint);
+    LLVMWriteBitcodeToFile(0 as *mut _, 0 as *const _);
+    LLVMPassManagerBuilderCreate();
+    LLVMPassManagerBuilderDispose(0 as *mut _);
 
-    llvm::LLVMRustLinkInExternalBitcode(0 as *mut _, 0 as *const _, 0 as size_t);
+    LLVMRustLinkInExternalBitcode(0 as *mut _, 0 as *const _, 0 as size_t);
 
     LLVMLinkInJIT();
     LLVMLinkInMCJIT();