librustc: De-export back, lib, and util. rs=deexporting

This commit is contained in:
Patrick Walton
2013-01-29 15:48:50 -08:00
parent 3105bcfdc1
commit 2ea2628ca9
16 changed files with 758 additions and 725 deletions
+40 -40
View File
@@ -11,72 +11,72 @@
const rc_base_field_refcnt: uint = 0u;
pub const rc_base_field_refcnt: uint = 0u;
const task_field_refcnt: uint = 0u;
pub const task_field_refcnt: uint = 0u;
const task_field_stk: uint = 2u;
pub const task_field_stk: uint = 2u;
const task_field_runtime_sp: uint = 3u;
pub const task_field_runtime_sp: uint = 3u;
const task_field_rust_sp: uint = 4u;
pub const task_field_rust_sp: uint = 4u;
const task_field_gc_alloc_chain: uint = 5u;
pub const task_field_gc_alloc_chain: uint = 5u;
const task_field_dom: uint = 6u;
pub const task_field_dom: uint = 6u;
const n_visible_task_fields: uint = 7u;
pub const n_visible_task_fields: uint = 7u;
const dom_field_interrupt_flag: uint = 1u;
pub const dom_field_interrupt_flag: uint = 1u;
const frame_glue_fns_field_mark: uint = 0u;
pub const frame_glue_fns_field_mark: uint = 0u;
const frame_glue_fns_field_drop: uint = 1u;
pub const frame_glue_fns_field_drop: uint = 1u;
const frame_glue_fns_field_reloc: uint = 2u;
pub const frame_glue_fns_field_reloc: uint = 2u;
const box_field_refcnt: uint = 0u;
const box_field_tydesc: uint = 1u;
const box_field_prev: uint = 2u;
const box_field_next: uint = 3u;
const box_field_body: uint = 4u;
pub const box_field_refcnt: uint = 0u;
pub const box_field_tydesc: uint = 1u;
pub const box_field_prev: uint = 2u;
pub const box_field_next: uint = 3u;
pub const box_field_body: uint = 4u;
const general_code_alignment: uint = 16u;
pub const general_code_alignment: uint = 16u;
const tydesc_field_size: uint = 0u;
const tydesc_field_align: uint = 1u;
const tydesc_field_take_glue: uint = 2u;
const tydesc_field_drop_glue: uint = 3u;
const tydesc_field_free_glue: uint = 4u;
const tydesc_field_visit_glue: uint = 5u;
const tydesc_field_shape: uint = 6u;
const tydesc_field_shape_tables: uint = 7u;
const n_tydesc_fields: uint = 8u;
pub const tydesc_field_size: uint = 0u;
pub const tydesc_field_align: uint = 1u;
pub const tydesc_field_take_glue: uint = 2u;
pub const tydesc_field_drop_glue: uint = 3u;
pub const tydesc_field_free_glue: uint = 4u;
pub const tydesc_field_visit_glue: uint = 5u;
pub const tydesc_field_shape: uint = 6u;
pub const tydesc_field_shape_tables: uint = 7u;
pub const n_tydesc_fields: uint = 8u;
// The two halves of a closure: code and environment.
const fn_field_code: uint = 0u;
const fn_field_box: uint = 1u;
pub const fn_field_code: uint = 0u;
pub const fn_field_box: uint = 1u;
const vec_elt_fill: uint = 0u;
pub const vec_elt_fill: uint = 0u;
const vec_elt_alloc: uint = 1u;
pub const vec_elt_alloc: uint = 1u;
const vec_elt_elems: uint = 2u;
pub const vec_elt_elems: uint = 2u;
const slice_elt_base: uint = 0u;
const slice_elt_len: uint = 1u;
pub const slice_elt_base: uint = 0u;
pub const slice_elt_len: uint = 1u;
const worst_case_glue_call_args: uint = 7u;
pub const worst_case_glue_call_args: uint = 7u;
const abi_version: uint = 1u;
pub const abi_version: uint = 1u;
fn memcpy_glue_name() -> ~str { return ~"rust_memcpy_glue"; }
pub fn memcpy_glue_name() -> ~str { return ~"rust_memcpy_glue"; }
fn bzero_glue_name() -> ~str { return ~"rust_bzero_glue"; }
pub fn bzero_glue_name() -> ~str { return ~"rust_bzero_glue"; }
fn yield_glue_name() -> ~str { return ~"rust_yield_glue"; }
pub fn yield_glue_name() -> ~str { return ~"rust_yield_glue"; }
fn no_op_type_glue_name() -> ~str { return ~"rust_no_op_type_glue"; }
pub fn no_op_type_glue_name() -> ~str { return ~"rust_no_op_type_glue"; }
//
// Local Variables:
// mode: rust
+1 -1
View File
@@ -13,7 +13,7 @@
use session::sess_os_to_meta_os;
use metadata::loader::meta_section_name;
fn get_target_strs(target_os: session::os) -> target_strs::t {
pub fn get_target_strs(target_os: session::os) -> target_strs::t {
return {
module_asm: ~"",
+29 -35
View File
@@ -43,7 +43,8 @@
use syntax::attr;
use syntax::print::pprust;
enum output_type {
#[deriving_eq]
pub enum output_type {
output_type_none,
output_type_bitcode,
output_type_assembly,
@@ -52,13 +53,6 @@ enum output_type {
output_type_exe,
}
impl output_type : cmp::Eq {
pure fn eq(&self, other: &output_type) -> bool {
((*self) as uint) == ((*other) as uint)
}
pure fn ne(&self, other: &output_type) -> bool { !(*self).eq(other) }
}
pub fn llvm_err(sess: Session, +msg: ~str) -> ! {
unsafe {
let cstr = llvm::LLVMRustGetLastError();
@@ -170,15 +164,15 @@ pub fn exec(sess: Session,
}
}
mod write {
pub mod write {
use back::link::jit;
use back::link::{ModuleRef, WriteOutputFile, output_type};
use back::link::{WriteOutputFile, output_type};
use back::link::{output_type_assembly, output_type_bitcode};
use back::link::{output_type_exe, output_type_llvm_assembly};
use back::link::{output_type_object};
use driver::session;
use lib::llvm::llvm;
use lib::llvm::{False, True, mk_pass_manager, mk_target_data};
use lib::llvm::{False, True, ModuleRef, mk_pass_manager, mk_target_data};
use lib;
use session::Session;
@@ -456,7 +450,7 @@ pub fn run_passes(sess: Session, llmod: ModuleRef, output: &Path) {
*
*/
fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
symbol_hasher: &hash::State) -> link_meta {
type provided_metas =
@@ -575,7 +569,7 @@ fn crate_meta_vers(sess: Session, opt_vers: Option<@str>) -> @str {
return {name: name, vers: vers, extras_hash: extras_hash};
}
fn truncated_hash_result(symbol_hasher: &hash::State) -> ~str {
pub fn truncated_hash_result(symbol_hasher: &hash::State) -> ~str {
unsafe {
symbol_hasher.result_str()
}
@@ -583,7 +577,7 @@ fn truncated_hash_result(symbol_hasher: &hash::State) -> ~str {
// This calculates STH for a symbol, as defined above
fn symbol_hash(tcx: ty::ctxt, symbol_hasher: &hash::State, t: ty::t,
pub fn symbol_hash(tcx: ty::ctxt, symbol_hasher: &hash::State, t: ty::t,
link_meta: link_meta) -> @str {
// NB: do *not* use abbrevs here as we want the symbol names
// to be independent of one another in the crate.
@@ -601,7 +595,7 @@ fn symbol_hash(tcx: ty::ctxt, symbol_hasher: &hash::State, t: ty::t,
hash.to_managed()
}
fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> @str {
pub fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> @str {
match ccx.type_hashcodes.find(t) {
Some(h) => h,
None => {
@@ -615,7 +609,7 @@ fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> @str {
// Name sanitation. LLVM will happily accept identifiers with weird names, but
// gas doesn't!
fn sanitize(s: ~str) -> ~str {
pub fn sanitize(s: ~str) -> ~str {
let mut result = ~"";
for str::chars_each(s) |c| {
match c {
@@ -648,7 +642,7 @@ fn sanitize(s: ~str) -> ~str {
return result;
}
fn mangle(sess: Session, ss: path) -> ~str {
pub fn mangle(sess: Session, ss: path) -> ~str {
// Follow C++ namespace-mangling style
let mut n = ~"_ZN"; // Begin name-sequence.
@@ -663,26 +657,26 @@ fn mangle(sess: Session, ss: path) -> ~str {
n
}
fn exported_name(sess: Session,
+path: path,
hash: &str,
vers: &str) -> ~str {
pub fn exported_name(sess: Session,
+path: path,
hash: &str,
vers: &str) -> ~str {
return mangle(sess,
vec::append_one(
vec::append_one(path, path_name(sess.ident_of(hash.to_owned()))),
path_name(sess.ident_of(vers.to_owned()))));
}
fn mangle_exported_name(ccx: @crate_ctxt, +path: path, t: ty::t) -> ~str {
pub fn mangle_exported_name(ccx: @crate_ctxt, +path: path, t: ty::t) -> ~str {
let hash = get_symbol_hash(ccx, t);
return exported_name(ccx.sess, path,
hash,
ccx.link_meta.vers);
}
fn mangle_internal_name_by_type_only(ccx: @crate_ctxt,
t: ty::t,
name: &str) -> ~str {
pub fn mangle_internal_name_by_type_only(ccx: @crate_ctxt,
t: ty::t,
name: &str) -> ~str {
let s = ppaux::ty_to_short_str(ccx.tcx, t);
let hash = get_symbol_hash(ccx, t);
return mangle(ccx.sess,
@@ -691,23 +685,23 @@ fn mangle_internal_name_by_type_only(ccx: @crate_ctxt,
path_name(ccx.sess.ident_of(hash.to_owned()))]);
}
fn mangle_internal_name_by_path_and_seq(ccx: @crate_ctxt,
+path: path,
+flav: ~str) -> ~str {
pub fn mangle_internal_name_by_path_and_seq(ccx: @crate_ctxt,
+path: path,
+flav: ~str) -> ~str {
return mangle(ccx.sess,
vec::append_one(path, path_name((ccx.names)(flav))));
}
fn mangle_internal_name_by_path(ccx: @crate_ctxt, +path: path) -> ~str {
pub fn mangle_internal_name_by_path(ccx: @crate_ctxt, +path: path) -> ~str {
return mangle(ccx.sess, path);
}
fn mangle_internal_name_by_seq(ccx: @crate_ctxt, +flav: ~str) -> ~str {
pub fn mangle_internal_name_by_seq(ccx: @crate_ctxt, +flav: ~str) -> ~str {
return fmt!("%s_%u", flav, (ccx.names)(flav).repr);
}
fn output_dll_filename(os: session::os, lm: link_meta) -> ~str {
pub fn output_dll_filename(os: session::os, lm: link_meta) -> ~str {
let libname = fmt!("%s-%s-%s", lm.name, lm.extras_hash, lm.vers);
let (dll_prefix, dll_suffix) = match os {
session::os_win32 => (win32::DLL_PREFIX, win32::DLL_SUFFIX),
@@ -722,10 +716,10 @@ fn output_dll_filename(os: session::os, lm: link_meta) -> ~str {
// If the user wants an exe generated we need to invoke
// cc to link the object file with some libs
fn link_binary(sess: Session,
obj_filename: &Path,
out_filename: &Path,
lm: link_meta) {
pub fn link_binary(sess: Session,
obj_filename: &Path,
out_filename: &Path,
lm: link_meta) {
// Converts a library file-stem into a cc -l argument
fn unlib(config: @session::config, +stem: ~str) -> ~str {
if stem.starts_with("lib") &&
+11 -18
View File
@@ -21,14 +21,6 @@
use std::map::HashMap;
use std::map;
export get_absolute_rpath;
export get_install_prefix_rpath;
export get_relative_to;
export get_rpath_flags;
export get_rpath_relative_to_output;
export minimize_rpaths;
export rpaths_to_flags;
pure fn not_win32(os: session::os) -> bool {
match os {
session::os_win32 => false,
@@ -36,7 +28,8 @@
}
}
fn get_rpath_flags(sess: session::Session, out_filename: &Path) -> ~[~str] {
pub fn get_rpath_flags(sess: session::Session, out_filename: &Path)
-> ~[~str] {
let os = sess.targ_cfg.os;
// No rpath on windows
@@ -63,7 +56,7 @@ fn get_sysroot_absolute_rt_lib(sess: session::Session) -> Path {
sess.filesearch.sysroot().push_rel(&r).push(os::dll_filename("rustrt"))
}
fn rpaths_to_flags(rpaths: &[Path]) -> ~[~str] {
pub fn rpaths_to_flags(rpaths: &[Path]) -> ~[~str] {
vec::map(rpaths, |rpath| fmt!("-Wl,-rpath,%s",rpath.to_str()))
}
@@ -120,10 +113,10 @@ fn get_rpaths_relative_to_output(os: session::os,
})
}
fn get_rpath_relative_to_output(os: session::os,
output: &Path,
lib: &Path)
-> Path {
pub fn get_rpath_relative_to_output(os: session::os,
output: &Path,
lib: &Path)
-> Path {
use core::os;
assert not_win32(os);
@@ -141,7 +134,7 @@ fn get_rpath_relative_to_output(os: session::os,
}
// Find the relative path from one file to another
fn get_relative_to(abs1: &Path, abs2: &Path) -> Path {
pub fn get_relative_to(abs1: &Path, abs2: &Path) -> Path {
assert abs1.is_absolute;
assert abs2.is_absolute;
let abs1 = abs1.normalize();
@@ -178,11 +171,11 @@ fn get_absolute_rpaths(libs: &[Path]) -> ~[Path] {
vec::map(libs, |a| get_absolute_rpath(a) )
}
fn get_absolute_rpath(lib: &Path) -> Path {
pub fn get_absolute_rpath(lib: &Path) -> Path {
os::make_absolute(lib).dir_path()
}
fn get_install_prefix_rpath(target_triple: &str) -> Path {
pub fn get_install_prefix_rpath(target_triple: &str) -> Path {
let install_prefix = env!("CFG_PREFIX");
if install_prefix == ~"" {
@@ -193,7 +186,7 @@ fn get_install_prefix_rpath(target_triple: &str) -> Path {
os::make_absolute(&Path(install_prefix).push_rel(&tlib))
}
fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] {
pub fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] {
let set = map::HashMap();
let mut minimized = ~[];
for rpaths.each |rpath| {
+1 -1
View File
@@ -9,7 +9,7 @@
// except according to those terms.
type t = {
pub type t = {
module_asm: ~str,
meta_sect_name: ~str,
data_layout: ~str,
+3 -3
View File
@@ -17,15 +17,15 @@
T_size_t, T_void, T_vec2};
use lib::llvm::{type_names, ModuleRef, ValueRef, TypeRef};
type upcalls =
pub type upcalls =
{trace: ValueRef,
call_shim_on_c_stack: ValueRef,
call_shim_on_rust_stack: ValueRef,
rust_personality: ValueRef,
reset_stack_limit: ValueRef};
fn declare_upcalls(targ_cfg: @session::config,
llmod: ModuleRef) -> @upcalls {
pub fn declare_upcalls(targ_cfg: @session::config,
llmod: ModuleRef) -> @upcalls {
fn decl(llmod: ModuleRef, prefix: ~str, name: ~str,
tys: ~[TypeRef], rv: TypeRef) ->
ValueRef {
+1 -1
View File
@@ -14,7 +14,7 @@
use metadata::loader::meta_section_name;
use session::sess_os_to_meta_os;
fn get_target_strs(target_os: session::os) -> target_strs::t {
pub fn get_target_strs(target_os: session::os) -> target_strs::t {
return {
module_asm: ~"",
+1 -1
View File
@@ -14,7 +14,7 @@
use metadata::loader::meta_section_name;
use session::sess_os_to_meta_os;
fn get_target_strs(target_os: session::os) -> target_strs::t {
pub fn get_target_strs(target_os: session::os) -> target_strs::t {
return {
module_asm: ~"",
+4 -7
View File
@@ -15,10 +15,6 @@
use core::option;
use core::vec;
export strip_unconfigured_items;
export metas_in_cfg;
export strip_items;
type in_cfg_pred = fn@(+attrs: ~[ast::attribute]) -> bool;
type ctxt = @{
@@ -27,13 +23,13 @@
// Support conditional compilation by transforming the AST, stripping out
// any items that do not belong in the current configuration
fn strip_unconfigured_items(crate: @ast::crate) -> @ast::crate {
pub fn strip_unconfigured_items(crate: @ast::crate) -> @ast::crate {
do strip_items(crate) |attrs| {
in_cfg(/*bad*/copy crate.node.config, attrs)
}
}
fn strip_items(crate: @ast::crate, in_cfg: in_cfg_pred)
pub fn strip_items(crate: @ast::crate, in_cfg: in_cfg_pred)
-> @ast::crate {
let ctxt = @{in_cfg: in_cfg};
@@ -179,7 +175,8 @@ fn in_cfg(+cfg: ast::crate_cfg, +attrs: ~[ast::attribute]) -> bool {
metas_in_cfg(cfg, attr::attr_metas(attrs))
}
fn metas_in_cfg(cfg: ast::crate_cfg, +metas: ~[@ast::meta_item]) -> bool {
pub fn metas_in_cfg(cfg: ast::crate_cfg,
+metas: ~[@ast::meta_item]) -> bool {
// The "cfg" attributes on the item
let cfg_metas = attr::find_meta_items_by_name(metas, ~"cfg");
+2 -4
View File
@@ -19,12 +19,10 @@
use syntax::codemap;
use syntax::fold;
export maybe_inject_libcore_ref;
const CORE_VERSION: &static/str = "0.6";
fn maybe_inject_libcore_ref(sess: Session,
crate: @ast::crate) -> @ast::crate {
pub fn maybe_inject_libcore_ref(sess: Session,
crate: @ast::crate) -> @ast::crate {
if use_core(crate) {
inject_libcore_ref(sess, crate)
} else {
+1 -3
View File
@@ -16,9 +16,7 @@
use core::vec;
export inject_intrinsic;
fn inject_intrinsic(sess: Session, crate: @ast::crate) -> @ast::crate {
pub fn inject_intrinsic(sess: Session, crate: @ast::crate) -> @ast::crate {
let intrinsic_module = @(include_str!("intrinsic.rs").to_owned());
let item = parse::parse_item_from_source_str(~"<intrinsic>",
+2 -4
View File
@@ -27,8 +27,6 @@
use syntax::{ast, ast_util};
use syntax::attr::attrs_contains_name;
export modify_for_testing;
type node_id_gen = fn@() -> ast::node_id;
type test = {span: span, path: ~[ast::ident],
@@ -42,8 +40,8 @@
// Traverse the crate, collecting all the test functions, eliding any
// existing main functions, and synthesizing a main test harness
fn modify_for_testing(sess: session::Session,
crate: @ast::crate) -> @ast::crate {
pub fn modify_for_testing(sess: session::Session,
crate: @ast::crate) -> @ast::crate {
// We generate the test harness when building in the 'test'
// configuration, either with the '--test' or '--cfg test'
+620 -549
View File
@@ -22,15 +22,15 @@
use core::vec;
use std::map::HashMap;
type Opcode = u32;
type Bool = c_uint;
pub type Opcode = u32;
pub type Bool = c_uint;
const True: Bool = 1 as Bool;
const False: Bool = 0 as Bool;
pub const True: Bool = 1 as Bool;
pub const False: Bool = 0 as Bool;
// Consts for the LLVM CallConv type, pre-cast to uint.
enum CallConv {
pub enum CallConv {
CCallConv = 0,
FastCallConv = 8,
ColdCallConv = 9,
@@ -38,13 +38,13 @@ enum CallConv {
X86FastcallCallConv = 65,
}
enum Visibility {
pub enum Visibility {
LLVMDefaultVisibility = 0,
HiddenVisibility = 1,
ProtectedVisibility = 2,
}
enum Linkage {
pub enum Linkage {
ExternalLinkage = 0,
AvailableExternallyLinkage = 1,
LinkOnceAnyLinkage = 2,
@@ -64,7 +64,7 @@ enum Linkage {
LinkerPrivateWeakLinkage = 16,
}
enum Attribute {
pub enum Attribute {
ZExtAttribute = 1,
SExtAttribute = 2,
NoReturnAttribute = 4,
@@ -97,7 +97,7 @@ enum Attribute {
}
// enum for the LLVM IntPredicate type
enum IntPredicate {
pub enum IntPredicate {
IntEQ = 32,
IntNE = 33,
IntUGT = 34,
@@ -111,7 +111,7 @@ enum IntPredicate {
}
// enum for the LLVM RealPredicate type
enum RealPredicate {
pub enum RealPredicate {
RealPredicateFalse = 0,
RealOEQ = 1,
RealOGT = 2,
@@ -132,7 +132,7 @@ enum RealPredicate {
// enum for the LLVM TypeKind type - must stay in sync with the def of
// LLVMTypeKind in llvm/include/llvm-c/Core.h
enum TypeKind {
pub enum TypeKind {
Void = 0,
Half = 1,
Float = 2,
@@ -151,7 +151,7 @@ enum TypeKind {
X86_MMX = 15
}
impl TypeKind : cmp::Eq {
pub impl TypeKind : cmp::Eq {
pure fn eq(&self, other: &TypeKind) -> bool {
match ((*self), (*other)) {
(Void, Void) => true,
@@ -191,7 +191,7 @@ impl TypeKind : cmp::Eq {
pure fn ne(&self, other: &TypeKind) -> bool { !(*self).eq(other) }
}
enum AtomicBinOp {
pub enum AtomicBinOp {
Xchg = 0,
Add = 1,
Sub = 2,
@@ -205,7 +205,7 @@ enum AtomicBinOp {
UMin = 10,
}
enum AtomicOrdering {
pub enum AtomicOrdering {
NotAtomic = 0,
Unordered = 1,
Monotonic = 2,
@@ -218,969 +218,1039 @@ enum AtomicOrdering {
// FIXME: Not used right now, but will be once #2334 is fixed
// Consts for the LLVMCodeGenFileType type (in include/llvm/c/TargetMachine.h)
enum FileType {
pub enum FileType {
AssemblyFile = 0,
ObjectFile = 1
}
// Opaque pointer types
enum Module_opaque {}
type ModuleRef = *Module_opaque;
enum Context_opaque {}
type ContextRef = *Context_opaque;
enum Type_opaque {}
type TypeRef = *Type_opaque;
enum Value_opaque {}
type ValueRef = *Value_opaque;
enum BasicBlock_opaque {}
type BasicBlockRef = *BasicBlock_opaque;
enum Builder_opaque {}
type BuilderRef = *Builder_opaque;
enum MemoryBuffer_opaque {}
type MemoryBufferRef = *MemoryBuffer_opaque;
enum PassManager_opaque {}
type PassManagerRef = *PassManager_opaque;
enum PassManagerBuilder_opaque {}
type PassManagerBuilderRef = *PassManagerBuilder_opaque;
enum Use_opaque {}
type UseRef = *Use_opaque;
enum TargetData_opaque {}
type TargetDataRef = *TargetData_opaque;
enum ObjectFile_opaque {}
type ObjectFileRef = *ObjectFile_opaque;
enum SectionIterator_opaque {}
type SectionIteratorRef = *SectionIterator_opaque;
pub enum Module_opaque {}
pub type ModuleRef = *Module_opaque;
pub enum Context_opaque {}
pub type ContextRef = *Context_opaque;
pub enum Type_opaque {}
pub type TypeRef = *Type_opaque;
pub enum Value_opaque {}
pub type ValueRef = *Value_opaque;
pub enum BasicBlock_opaque {}
pub type BasicBlockRef = *BasicBlock_opaque;
pub enum Builder_opaque {}
pub type BuilderRef = *Builder_opaque;
pub enum MemoryBuffer_opaque {}
pub type MemoryBufferRef = *MemoryBuffer_opaque;
pub enum PassManager_opaque {}
pub type PassManagerRef = *PassManager_opaque;
pub enum PassManagerBuilder_opaque {}
pub type PassManagerBuilderRef = *PassManagerBuilder_opaque;
pub enum Use_opaque {}
pub type UseRef = *Use_opaque;
pub enum TargetData_opaque {}
pub type TargetDataRef = *TargetData_opaque;
pub enum ObjectFile_opaque {}
pub type ObjectFileRef = *ObjectFile_opaque;
pub enum SectionIterator_opaque {}
pub type SectionIteratorRef = *SectionIterator_opaque;
#[link_args = "-Lrustllvm"]
#[link_name = "rustllvm"]
#[abi = "cdecl"]
extern mod llvm {
#[legacy_exports];
pub extern mod llvm {
/* Create and destroy contexts. */
unsafe fn LLVMContextCreate() -> ContextRef;
unsafe fn LLVMGetGlobalContext() -> ContextRef;
unsafe fn LLVMContextDispose(C: ContextRef);
unsafe fn LLVMGetMDKindIDInContext(C: ContextRef,
pub unsafe fn LLVMContextCreate() -> ContextRef;
pub unsafe fn LLVMGetGlobalContext() -> ContextRef;
pub unsafe fn LLVMContextDispose(C: ContextRef);
pub unsafe fn LLVMGetMDKindIDInContext(C: ContextRef,
Name: *c_char,
SLen: c_uint)
-> c_uint;
unsafe fn LLVMGetMDKindID(Name: *c_char, SLen: c_uint) -> c_uint;
pub unsafe fn LLVMGetMDKindID(Name: *c_char, SLen: c_uint) -> c_uint;
/* Create and destroy modules. */
unsafe fn LLVMModuleCreateWithNameInContext(ModuleID: *c_char,
pub unsafe fn LLVMModuleCreateWithNameInContext(ModuleID: *c_char,
C: ContextRef)
-> ModuleRef;
unsafe fn LLVMDisposeModule(M: ModuleRef);
pub unsafe fn LLVMDisposeModule(M: ModuleRef);
/** Data layout. See Module::getDataLayout. */
unsafe fn LLVMGetDataLayout(M: ModuleRef) -> *c_char;
unsafe fn LLVMSetDataLayout(M: ModuleRef, Triple: *c_char);
pub unsafe fn LLVMGetDataLayout(M: ModuleRef) -> *c_char;
pub unsafe fn LLVMSetDataLayout(M: ModuleRef, Triple: *c_char);
/** Target triple. See Module::getTargetTriple. */
unsafe fn LLVMGetTarget(M: ModuleRef) -> *c_char;
unsafe fn LLVMSetTarget(M: ModuleRef, Triple: *c_char);
pub unsafe fn LLVMGetTarget(M: ModuleRef) -> *c_char;
pub unsafe fn LLVMSetTarget(M: ModuleRef, Triple: *c_char);
/** See Module::dump. */
unsafe fn LLVMDumpModule(M: ModuleRef);
pub unsafe fn LLVMDumpModule(M: ModuleRef);
/** See Module::setModuleInlineAsm. */
unsafe fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *c_char);
pub unsafe fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *c_char);
/** See llvm::LLVMTypeKind::getTypeID. */
unsafe fn LLVMGetTypeKind(Ty: TypeRef) -> TypeKind;
pub unsafe fn LLVMGetTypeKind(Ty: TypeRef) -> TypeKind;
/** See llvm::LLVMType::getContext. */
unsafe fn LLVMGetTypeContext(Ty: TypeRef) -> ContextRef;
pub unsafe fn LLVMGetTypeContext(Ty: TypeRef) -> ContextRef;
/* Operations on integer types */
unsafe fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef;
unsafe fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef;
unsafe fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef;
unsafe fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef;
unsafe fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef;
unsafe fn LLVMIntTypeInContext(C: ContextRef, NumBits: c_uint) -> TypeRef;
pub unsafe fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef;
pub unsafe fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef;
pub unsafe fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef;
pub unsafe fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef;
pub unsafe fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef;
pub unsafe fn LLVMIntTypeInContext(C: ContextRef,
NumBits: c_uint) -> TypeRef;
unsafe fn LLVMInt1Type() -> TypeRef;
unsafe fn LLVMInt8Type() -> TypeRef;
unsafe fn LLVMInt16Type() -> TypeRef;
unsafe fn LLVMInt32Type() -> TypeRef;
unsafe fn LLVMInt64Type() -> TypeRef;
unsafe fn LLVMIntType(NumBits: c_uint) -> TypeRef;
unsafe fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> c_uint;
pub unsafe fn LLVMInt1Type() -> TypeRef;
pub unsafe fn LLVMInt8Type() -> TypeRef;
pub unsafe fn LLVMInt16Type() -> TypeRef;
pub unsafe fn LLVMInt32Type() -> TypeRef;
pub unsafe fn LLVMInt64Type() -> TypeRef;
pub unsafe fn LLVMIntType(NumBits: c_uint) -> TypeRef;
pub unsafe fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> c_uint;
/* Operations on real types */
unsafe fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef;
unsafe fn LLVMDoubleTypeInContext(C: ContextRef) -> TypeRef;
unsafe fn LLVMX86FP80TypeInContext(C: ContextRef) -> TypeRef;
unsafe fn LLVMFP128TypeInContext(C: ContextRef) -> TypeRef;
unsafe fn LLVMPPCFP128TypeInContext(C: ContextRef) -> TypeRef;
pub unsafe fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef;
pub unsafe fn LLVMDoubleTypeInContext(C: ContextRef) -> TypeRef;
pub unsafe fn LLVMX86FP80TypeInContext(C: ContextRef) -> TypeRef;
pub unsafe fn LLVMFP128TypeInContext(C: ContextRef) -> TypeRef;
pub unsafe fn LLVMPPCFP128TypeInContext(C: ContextRef) -> TypeRef;
unsafe fn LLVMFloatType() -> TypeRef;
unsafe fn LLVMDoubleType() -> TypeRef;
unsafe fn LLVMX86FP80Type() -> TypeRef;
unsafe fn LLVMFP128Type() -> TypeRef;
unsafe fn LLVMPPCFP128Type() -> TypeRef;
pub unsafe fn LLVMFloatType() -> TypeRef;
pub unsafe fn LLVMDoubleType() -> TypeRef;
pub unsafe fn LLVMX86FP80Type() -> TypeRef;
pub unsafe fn LLVMFP128Type() -> TypeRef;
pub unsafe fn LLVMPPCFP128Type() -> TypeRef;
/* Operations on function types */
unsafe fn LLVMFunctionType(ReturnType: TypeRef, ParamTypes: *TypeRef,
pub unsafe fn LLVMFunctionType(ReturnType: TypeRef, ParamTypes: *TypeRef,
ParamCount: c_uint, IsVarArg: Bool) -> TypeRef;
unsafe fn LLVMIsFunctionVarArg(FunctionTy: TypeRef) -> Bool;
unsafe fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
unsafe fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint;
unsafe fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *TypeRef);
pub unsafe fn LLVMIsFunctionVarArg(FunctionTy: TypeRef) -> Bool;
pub unsafe fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
pub unsafe fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint;
pub unsafe fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *TypeRef);
/* Operations on struct types */
unsafe fn LLVMStructTypeInContext(C: ContextRef, ElementTypes: *TypeRef,
ElementCount: c_uint,
Packed: Bool) -> TypeRef;
unsafe fn LLVMStructType(ElementTypes: *TypeRef, ElementCount: c_uint,
pub unsafe fn LLVMStructTypeInContext(C: ContextRef,
ElementTypes: *TypeRef,
ElementCount: c_uint,
Packed: Bool) -> TypeRef;
pub unsafe fn LLVMStructType(ElementTypes: *TypeRef, ElementCount: c_uint,
Packed: Bool) -> TypeRef;
unsafe fn LLVMCountStructElementTypes(StructTy: TypeRef) -> c_uint;
unsafe fn LLVMGetStructElementTypes(StructTy: TypeRef,
pub unsafe fn LLVMCountStructElementTypes(StructTy: TypeRef) -> c_uint;
pub unsafe fn LLVMGetStructElementTypes(StructTy: TypeRef,
Dest: *mut TypeRef);
unsafe fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
pub unsafe fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
/* Operations on array, pointer, and vector types (sequence types) */
unsafe fn LLVMArrayType(ElementType: TypeRef,
pub unsafe fn LLVMArrayType(ElementType: TypeRef,
ElementCount: c_uint) -> TypeRef;
unsafe fn LLVMPointerType(ElementType: TypeRef,
pub unsafe fn LLVMPointerType(ElementType: TypeRef,
AddressSpace: c_uint) -> TypeRef;
unsafe fn LLVMVectorType(ElementType: TypeRef,
pub unsafe fn LLVMVectorType(ElementType: TypeRef,
ElementCount: c_uint) -> TypeRef;
unsafe fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
unsafe fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint;
unsafe fn LLVMGetPointerAddressSpace(PointerTy: TypeRef) -> c_uint;
unsafe fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint;
pub unsafe fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
pub unsafe fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint;
pub unsafe fn LLVMGetPointerAddressSpace(PointerTy: TypeRef) -> c_uint;
pub unsafe fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint;
/* Operations on other types */
unsafe fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
unsafe fn LLVMLabelTypeInContext(C: ContextRef) -> TypeRef;
unsafe fn LLVMMetadataTypeInContext(C: ContextRef) -> TypeRef;
pub unsafe fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
pub unsafe fn LLVMLabelTypeInContext(C: ContextRef) -> TypeRef;
pub unsafe fn LLVMMetadataTypeInContext(C: ContextRef) -> TypeRef;
unsafe fn LLVMVoidType() -> TypeRef;
unsafe fn LLVMLabelType() -> TypeRef;
unsafe fn LLVMMetadataType() -> TypeRef;
pub unsafe fn LLVMVoidType() -> TypeRef;
pub unsafe fn LLVMLabelType() -> TypeRef;
pub unsafe fn LLVMMetadataType() -> TypeRef;
/* Operations on all values */
unsafe fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
unsafe fn LLVMGetValueName(Val: ValueRef) -> *c_char;
unsafe fn LLVMSetValueName(Val: ValueRef, Name: *c_char);
unsafe fn LLVMDumpValue(Val: ValueRef);
unsafe fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
unsafe fn LLVMHasMetadata(Val: ValueRef) -> c_int;
unsafe fn LLVMGetMetadata(Val: ValueRef, KindID: c_uint) -> ValueRef;
unsafe fn LLVMSetMetadata(Val: ValueRef, KindID: c_uint, Node: ValueRef);
pub unsafe fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
pub unsafe fn LLVMGetValueName(Val: ValueRef) -> *c_char;
pub unsafe fn LLVMSetValueName(Val: ValueRef, Name: *c_char);
pub unsafe fn LLVMDumpValue(Val: ValueRef);
pub unsafe fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
pub unsafe fn LLVMHasMetadata(Val: ValueRef) -> c_int;
pub unsafe fn LLVMGetMetadata(Val: ValueRef, KindID: c_uint) -> ValueRef;
pub unsafe fn LLVMSetMetadata(Val: ValueRef,
KindID: c_uint,
Node: ValueRef);
/* Operations on Uses */
unsafe fn LLVMGetFirstUse(Val: ValueRef) -> UseRef;
unsafe fn LLVMGetNextUse(U: UseRef) -> UseRef;
unsafe fn LLVMGetUser(U: UseRef) -> ValueRef;
unsafe fn LLVMGetUsedValue(U: UseRef) -> ValueRef;
pub unsafe fn LLVMGetFirstUse(Val: ValueRef) -> UseRef;
pub unsafe fn LLVMGetNextUse(U: UseRef) -> UseRef;
pub unsafe fn LLVMGetUser(U: UseRef) -> ValueRef;
pub unsafe fn LLVMGetUsedValue(U: UseRef) -> ValueRef;
/* Operations on Users */
unsafe fn LLVMGetOperand(Val: ValueRef, Index: c_uint) -> ValueRef;
unsafe fn LLVMSetOperand(Val: ValueRef, Index: c_uint, Op: ValueRef);
pub unsafe fn LLVMGetOperand(Val: ValueRef, Index: c_uint) -> ValueRef;
pub unsafe fn LLVMSetOperand(Val: ValueRef, Index: c_uint, Op: ValueRef);
/* Operations on constants of any type */
unsafe fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
pub unsafe fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
/* all zeroes */
unsafe fn LLVMConstAllOnes(Ty: TypeRef) -> ValueRef;
pub unsafe fn LLVMConstAllOnes(Ty: TypeRef) -> ValueRef;
/* only for int/vector */
unsafe fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
unsafe fn LLVMIsConstant(Val: ValueRef) -> Bool;
unsafe fn LLVMIsNull(Val: ValueRef) -> Bool;
unsafe fn LLVMIsUndef(Val: ValueRef) -> Bool;
unsafe fn LLVMConstPointerNull(Ty: TypeRef) -> ValueRef;
pub unsafe fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
pub unsafe fn LLVMIsConstant(Val: ValueRef) -> Bool;
pub unsafe fn LLVMIsNull(Val: ValueRef) -> Bool;
pub unsafe fn LLVMIsUndef(Val: ValueRef) -> Bool;
pub unsafe fn LLVMConstPointerNull(Ty: TypeRef) -> ValueRef;
/* Operations on metadata */
unsafe fn LLVMMDStringInContext(C: ContextRef,
pub unsafe fn LLVMMDStringInContext(C: ContextRef,
Str: *c_char,
SLen: c_uint)
-> ValueRef;
unsafe fn LLVMMDString(Str: *c_char, SLen: c_uint) -> ValueRef;
unsafe fn LLVMMDNodeInContext(C: ContextRef,
pub unsafe fn LLVMMDString(Str: *c_char, SLen: c_uint) -> ValueRef;
pub unsafe fn LLVMMDNodeInContext(C: ContextRef,
Vals: *ValueRef,
Count: c_uint)
-> ValueRef;
unsafe fn LLVMMDNode(Vals: *ValueRef, Count: c_uint) -> ValueRef;
unsafe fn LLVMAddNamedMetadataOperand(M: ModuleRef, Str: *c_char,
pub unsafe fn LLVMMDNode(Vals: *ValueRef, Count: c_uint) -> ValueRef;
pub unsafe fn LLVMAddNamedMetadataOperand(M: ModuleRef, Str: *c_char,
Val: ValueRef);
/* Operations on scalar constants */
unsafe fn LLVMConstInt(IntTy: TypeRef,
pub unsafe fn LLVMConstInt(IntTy: TypeRef,
N: c_ulonglong,
SignExtend: Bool)
-> ValueRef;
unsafe fn LLVMConstIntOfString(IntTy: TypeRef,
pub unsafe fn LLVMConstIntOfString(IntTy: TypeRef,
Text: *c_char,
Radix: u8)
-> ValueRef;
unsafe fn LLVMConstIntOfStringAndSize(IntTy: TypeRef, Text: *c_char,
pub unsafe fn LLVMConstIntOfStringAndSize(IntTy: TypeRef, Text: *c_char,
SLen: c_uint,
Radix: u8) -> ValueRef;
unsafe fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
unsafe fn LLVMConstRealOfString(RealTy: TypeRef,
pub unsafe fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
pub unsafe fn LLVMConstRealOfString(RealTy: TypeRef,
Text: *c_char)
-> ValueRef;
unsafe fn LLVMConstRealOfStringAndSize(RealTy: TypeRef, Text: *c_char,
pub unsafe fn LLVMConstRealOfStringAndSize(RealTy: TypeRef, Text: *c_char,
SLen: c_uint) -> ValueRef;
unsafe fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> c_ulonglong;
unsafe fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> c_longlong;
pub unsafe fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef)
-> c_ulonglong;
pub unsafe fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef)
-> c_longlong;
/* Operations on composite constants */
unsafe fn LLVMConstStringInContext(C: ContextRef,
pub unsafe fn LLVMConstStringInContext(C: ContextRef,
Str: *c_char,
Length: c_uint,
DontNullTerminate: Bool)
-> ValueRef;
unsafe fn LLVMConstStructInContext(C: ContextRef, ConstantVals: *ValueRef,
Count: c_uint, Packed: Bool) -> ValueRef;
pub unsafe fn LLVMConstStructInContext(C: ContextRef,
ConstantVals: *ValueRef,
Count: c_uint,
Packed: Bool) -> ValueRef;
unsafe fn LLVMConstString(Str: *c_char, Length: c_uint,
pub unsafe fn LLVMConstString(Str: *c_char, Length: c_uint,
DontNullTerminate: Bool) -> ValueRef;
unsafe fn LLVMConstArray(ElementTy: TypeRef, ConstantVals: *ValueRef,
pub unsafe fn LLVMConstArray(ElementTy: TypeRef, ConstantVals: *ValueRef,
Length: c_uint) -> ValueRef;
unsafe fn LLVMConstStruct(ConstantVals: *ValueRef,
pub unsafe fn LLVMConstStruct(ConstantVals: *ValueRef,
Count: c_uint, Packed: Bool) -> ValueRef;
unsafe fn LLVMConstVector(ScalarConstantVals: *ValueRef,
pub unsafe fn LLVMConstVector(ScalarConstantVals: *ValueRef,
Size: c_uint) -> ValueRef;
/* Constant expressions */
unsafe fn LLVMAlignOf(Ty: TypeRef) -> ValueRef;
unsafe fn LLVMSizeOf(Ty: TypeRef) -> ValueRef;
unsafe fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef;
unsafe fn LLVMConstNSWNeg(ConstantVal: ValueRef) -> ValueRef;
unsafe fn LLVMConstNUWNeg(ConstantVal: ValueRef) -> ValueRef;
unsafe fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef;
unsafe fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef;
unsafe fn LLVMConstAdd(LHSConstant: ValueRef,
pub unsafe fn LLVMAlignOf(Ty: TypeRef) -> ValueRef;
pub unsafe fn LLVMSizeOf(Ty: TypeRef) -> ValueRef;
pub unsafe fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef;
pub unsafe fn LLVMConstNSWNeg(ConstantVal: ValueRef) -> ValueRef;
pub unsafe fn LLVMConstNUWNeg(ConstantVal: ValueRef) -> ValueRef;
pub unsafe fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef;
pub unsafe fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef;
pub unsafe fn LLVMConstAdd(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstNSWAdd(LHSConstant: ValueRef,
pub unsafe fn LLVMConstNSWAdd(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstNUWAdd(LHSConstant: ValueRef,
pub unsafe fn LLVMConstNUWAdd(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstFAdd(LHSConstant: ValueRef,
pub unsafe fn LLVMConstFAdd(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstSub(LHSConstant: ValueRef,
pub unsafe fn LLVMConstSub(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstNSWSub(LHSConstant: ValueRef,
pub unsafe fn LLVMConstNSWSub(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstNUWSub(LHSConstant: ValueRef,
pub unsafe fn LLVMConstNUWSub(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstFSub(LHSConstant: ValueRef, RHSConstant: ValueRef) ->
ValueRef;
unsafe fn LLVMConstMul(LHSConstant: ValueRef,
pub unsafe fn LLVMConstFSub(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
pub unsafe fn LLVMConstMul(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstNSWMul(LHSConstant: ValueRef,
pub unsafe fn LLVMConstNSWMul(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstNUWMul(LHSConstant: ValueRef,
pub unsafe fn LLVMConstNUWMul(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstFMul(LHSConstant: ValueRef,
pub unsafe fn LLVMConstFMul(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstUDiv(LHSConstant: ValueRef,
pub unsafe fn LLVMConstUDiv(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstSDiv(LHSConstant: ValueRef,
pub unsafe fn LLVMConstSDiv(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstExactSDiv(LHSConstant: ValueRef,
pub unsafe fn LLVMConstExactSDiv(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstFDiv(LHSConstant: ValueRef,
pub unsafe fn LLVMConstFDiv(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstURem(LHSConstant: ValueRef,
pub unsafe fn LLVMConstURem(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstSRem(LHSConstant: ValueRef,
pub unsafe fn LLVMConstSRem(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstFRem(LHSConstant: ValueRef,
pub unsafe fn LLVMConstFRem(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstAnd(LHSConstant: ValueRef,
pub unsafe fn LLVMConstAnd(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstOr(LHSConstant: ValueRef,
pub unsafe fn LLVMConstOr(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstXor(LHSConstant: ValueRef,
pub unsafe fn LLVMConstXor(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstShl(LHSConstant: ValueRef,
pub unsafe fn LLVMConstShl(LHSConstant: ValueRef,
RHSConstant: ValueRef)
-> ValueRef;
unsafe fn LLVMConstLShr(LHSConstant: ValueRef, RHSConstant: ValueRef) ->
ValueRef;
unsafe fn LLVMConstAShr(LHSConstant: ValueRef, RHSConstant: ValueRef) ->
ValueRef;
unsafe fn LLVMConstGEP(ConstantVal: ValueRef,
pub unsafe fn LLVMConstLShr(LHSConstant: ValueRef,
RHSConstant: ValueRef) -> ValueRef;
pub unsafe fn LLVMConstAShr(LHSConstant: ValueRef,
RHSConstant: ValueRef) -> ValueRef;
pub unsafe fn LLVMConstGEP(ConstantVal: ValueRef,
ConstantIndices: *ValueRef,
NumIndices: c_uint) -> ValueRef;
unsafe fn LLVMConstInBoundsGEP(ConstantVal: ValueRef,
pub unsafe fn LLVMConstInBoundsGEP(ConstantVal: ValueRef,
ConstantIndices: *ValueRef,
NumIndices: c_uint)
-> ValueRef;
unsafe fn LLVMConstTrunc(ConstantVal: ValueRef,
pub unsafe fn LLVMConstTrunc(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
unsafe fn LLVMConstSExt(ConstantVal: ValueRef,
pub unsafe fn LLVMConstSExt(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
unsafe fn LLVMConstZExt(ConstantVal: ValueRef,
pub unsafe fn LLVMConstZExt(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
unsafe fn LLVMConstFPTrunc(ConstantVal: ValueRef,
pub unsafe fn LLVMConstFPTrunc(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
unsafe fn LLVMConstFPExt(ConstantVal: ValueRef,
pub unsafe fn LLVMConstFPExt(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
unsafe fn LLVMConstUIToFP(ConstantVal: ValueRef,
pub unsafe fn LLVMConstUIToFP(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
unsafe fn LLVMConstSIToFP(ConstantVal: ValueRef,
pub unsafe fn LLVMConstSIToFP(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
unsafe fn LLVMConstFPToUI(ConstantVal: ValueRef,
pub unsafe fn LLVMConstFPToUI(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
unsafe fn LLVMConstFPToSI(ConstantVal: ValueRef,
pub unsafe fn LLVMConstFPToSI(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
unsafe fn LLVMConstPtrToInt(ConstantVal: ValueRef,
pub unsafe fn LLVMConstPtrToInt(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
unsafe fn LLVMConstIntToPtr(ConstantVal: ValueRef,
pub unsafe fn LLVMConstIntToPtr(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
unsafe fn LLVMConstBitCast(ConstantVal: ValueRef,
pub unsafe fn LLVMConstBitCast(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
unsafe fn LLVMConstZExtOrBitCast(ConstantVal: ValueRef,
pub unsafe fn LLVMConstZExtOrBitCast(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
unsafe fn LLVMConstSExtOrBitCast(ConstantVal: ValueRef,
pub unsafe fn LLVMConstSExtOrBitCast(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
unsafe fn LLVMConstTruncOrBitCast(ConstantVal: ValueRef,
pub unsafe fn LLVMConstTruncOrBitCast(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
unsafe fn LLVMConstPointerCast(ConstantVal: ValueRef,
pub unsafe fn LLVMConstPointerCast(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
unsafe fn LLVMConstIntCast(ConstantVal: ValueRef, ToType: TypeRef,
pub unsafe fn LLVMConstIntCast(ConstantVal: ValueRef, ToType: TypeRef,
isSigned: Bool) -> ValueRef;
unsafe fn LLVMConstFPCast(ConstantVal: ValueRef,
pub unsafe fn LLVMConstFPCast(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
unsafe fn LLVMConstSelect(ConstantCondition: ValueRef,
pub unsafe fn LLVMConstSelect(ConstantCondition: ValueRef,
ConstantIfTrue: ValueRef,
ConstantIfFalse: ValueRef)
-> ValueRef;
unsafe fn LLVMConstExtractElement(VectorConstant: ValueRef,
pub unsafe fn LLVMConstExtractElement(VectorConstant: ValueRef,
IndexConstant: ValueRef) -> ValueRef;
unsafe fn LLVMConstInsertElement(VectorConstant: ValueRef,
pub unsafe fn LLVMConstInsertElement(VectorConstant: ValueRef,
ElementValueConstant: ValueRef,
IndexConstant: ValueRef) -> ValueRef;
unsafe fn LLVMConstShuffleVector(VectorAConstant: ValueRef,
pub unsafe fn LLVMConstShuffleVector(VectorAConstant: ValueRef,
VectorBConstant: ValueRef,
MaskConstant: ValueRef) -> ValueRef;
unsafe fn LLVMConstExtractValue(AggConstant: ValueRef, IdxList: *c_uint,
NumIdx: c_uint) -> ValueRef;
unsafe fn LLVMConstInsertValue(AggConstant: ValueRef,
pub unsafe fn LLVMConstExtractValue(AggConstant: ValueRef,
IdxList: *c_uint,
NumIdx: c_uint) -> ValueRef;
pub unsafe fn LLVMConstInsertValue(AggConstant: ValueRef,
ElementValueConstant: ValueRef, IdxList: *c_uint,
NumIdx: c_uint) -> ValueRef;
unsafe fn LLVMConstInlineAsm(Ty: TypeRef, AsmString: *c_char,
pub unsafe fn LLVMConstInlineAsm(Ty: TypeRef, AsmString: *c_char,
Constraints: *c_char, HasSideEffects: Bool,
IsAlignStack: Bool) -> ValueRef;
unsafe fn LLVMBlockAddress(F: ValueRef, BB: BasicBlockRef) -> ValueRef;
pub unsafe fn LLVMBlockAddress(F: ValueRef, BB: BasicBlockRef)
-> ValueRef;
/* Operations on global variables, functions, and aliases (globals) */
unsafe fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef;
unsafe fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
unsafe fn LLVMGetLinkage(Global: ValueRef) -> c_uint;
unsafe fn LLVMSetLinkage(Global: ValueRef, Link: c_uint);
unsafe fn LLVMGetSection(Global: ValueRef) -> *c_char;
unsafe fn LLVMSetSection(Global: ValueRef, Section: *c_char);
unsafe fn LLVMGetVisibility(Global: ValueRef) -> c_uint;
unsafe fn LLVMSetVisibility(Global: ValueRef, Viz: c_uint);
unsafe fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
unsafe fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint);
pub unsafe fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef;
pub unsafe fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
pub unsafe fn LLVMGetLinkage(Global: ValueRef) -> c_uint;
pub unsafe fn LLVMSetLinkage(Global: ValueRef, Link: c_uint);
pub unsafe fn LLVMGetSection(Global: ValueRef) -> *c_char;
pub unsafe fn LLVMSetSection(Global: ValueRef, Section: *c_char);
pub unsafe fn LLVMGetVisibility(Global: ValueRef) -> c_uint;
pub unsafe fn LLVMSetVisibility(Global: ValueRef, Viz: c_uint);
pub unsafe fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
pub unsafe fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint);
/* Operations on global variables */
unsafe fn LLVMAddGlobal(M: ModuleRef,
pub unsafe fn LLVMAddGlobal(M: ModuleRef,
Ty: TypeRef,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMAddGlobalInAddressSpace(M: ModuleRef,
pub unsafe fn LLVMAddGlobalInAddressSpace(M: ModuleRef,
Ty: TypeRef,
Name: *c_char,
AddressSpace: c_uint)
-> ValueRef;
unsafe fn LLVMGetNamedGlobal(M: ModuleRef, Name: *c_char) -> ValueRef;
unsafe fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
unsafe fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef;
unsafe fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
unsafe fn LLVMGetPreviousGlobal(GlobalVar: ValueRef) -> ValueRef;
unsafe fn LLVMDeleteGlobal(GlobalVar: ValueRef);
unsafe fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef;
unsafe fn LLVMSetInitializer(GlobalVar: ValueRef, ConstantVal: ValueRef);
unsafe fn LLVMIsThreadLocal(GlobalVar: ValueRef) -> Bool;
unsafe fn LLVMSetThreadLocal(GlobalVar: ValueRef, IsThreadLocal: Bool);
unsafe fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool;
unsafe fn LLVMSetGlobalConstant(GlobalVar: ValueRef, IsConstant: Bool);
pub unsafe fn LLVMGetNamedGlobal(M: ModuleRef, Name: *c_char) -> ValueRef;
pub unsafe fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
pub unsafe fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef;
pub unsafe fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
pub unsafe fn LLVMGetPreviousGlobal(GlobalVar: ValueRef) -> ValueRef;
pub unsafe fn LLVMDeleteGlobal(GlobalVar: ValueRef);
pub unsafe fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef;
pub unsafe fn LLVMSetInitializer(GlobalVar: ValueRef,
ConstantVal: ValueRef);
pub unsafe fn LLVMIsThreadLocal(GlobalVar: ValueRef) -> Bool;
pub unsafe fn LLVMSetThreadLocal(GlobalVar: ValueRef,
IsThreadLocal: Bool);
pub unsafe fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool;
pub unsafe fn LLVMSetGlobalConstant(GlobalVar: ValueRef,
IsConstant: Bool);
/* Operations on aliases */
unsafe fn LLVMAddAlias(M: ModuleRef, Ty: TypeRef, Aliasee: ValueRef,
pub unsafe fn LLVMAddAlias(M: ModuleRef, Ty: TypeRef, Aliasee: ValueRef,
Name: *c_char) -> ValueRef;
/* Operations on functions */
unsafe fn LLVMAddFunction(M: ModuleRef,
pub unsafe fn LLVMAddFunction(M: ModuleRef,
Name: *c_char,
FunctionTy: TypeRef)
-> ValueRef;
unsafe fn LLVMGetNamedFunction(M: ModuleRef, Name: *c_char) -> ValueRef;
unsafe fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
unsafe fn LLVMGetLastFunction(M: ModuleRef) -> ValueRef;
unsafe fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
unsafe fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef;
unsafe fn LLVMDeleteFunction(Fn: ValueRef);
unsafe fn LLVMGetOrInsertFunction(M: ModuleRef, Name: *c_char,
pub unsafe fn LLVMGetNamedFunction(M: ModuleRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
pub unsafe fn LLVMGetLastFunction(M: ModuleRef) -> ValueRef;
pub unsafe fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
pub unsafe fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef;
pub unsafe fn LLVMDeleteFunction(Fn: ValueRef);
pub unsafe fn LLVMGetOrInsertFunction(M: ModuleRef, Name: *c_char,
FunctionTy: TypeRef) -> ValueRef;
unsafe fn LLVMGetIntrinsicID(Fn: ValueRef) -> c_uint;
unsafe fn LLVMGetFunctionCallConv(Fn: ValueRef) -> c_uint;
unsafe fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
unsafe fn LLVMGetGC(Fn: ValueRef) -> *c_char;
unsafe fn LLVMSetGC(Fn: ValueRef, Name: *c_char);
unsafe fn LLVMAddFunctionAttr(Fn: ValueRef, PA: c_ulonglong, HighPA:
pub unsafe fn LLVMGetIntrinsicID(Fn: ValueRef) -> c_uint;
pub unsafe fn LLVMGetFunctionCallConv(Fn: ValueRef) -> c_uint;
pub unsafe fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
pub unsafe fn LLVMGetGC(Fn: ValueRef) -> *c_char;
pub unsafe fn LLVMSetGC(Fn: ValueRef, Name: *c_char);
pub unsafe fn LLVMAddFunctionAttr(Fn: ValueRef, PA: c_ulonglong, HighPA:
c_ulonglong);
unsafe fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong;
unsafe fn LLVMRemoveFunctionAttr(Fn: ValueRef, PA: c_ulonglong, HighPA:
c_ulonglong);
pub unsafe fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong;
pub unsafe fn LLVMRemoveFunctionAttr(Fn: ValueRef,
PA: c_ulonglong,
HighPA: c_ulonglong);
/* Operations on parameters */
unsafe fn LLVMCountParams(Fn: ValueRef) -> c_uint;
unsafe fn LLVMGetParams(Fn: ValueRef, Params: *ValueRef);
unsafe fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef;
unsafe fn LLVMGetParamParent(Inst: ValueRef) -> ValueRef;
unsafe fn LLVMGetFirstParam(Fn: ValueRef) -> ValueRef;
unsafe fn LLVMGetLastParam(Fn: ValueRef) -> ValueRef;
unsafe fn LLVMGetNextParam(Arg: ValueRef) -> ValueRef;
unsafe fn LLVMGetPreviousParam(Arg: ValueRef) -> ValueRef;
unsafe fn LLVMAddAttribute(Arg: ValueRef, PA: c_uint);
unsafe fn LLVMRemoveAttribute(Arg: ValueRef, PA: c_uint);
unsafe fn LLVMGetAttribute(Arg: ValueRef) -> c_uint;
unsafe fn LLVMSetParamAlignment(Arg: ValueRef, align: c_uint);
pub unsafe fn LLVMCountParams(Fn: ValueRef) -> c_uint;
pub unsafe fn LLVMGetParams(Fn: ValueRef, Params: *ValueRef);
pub unsafe fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef;
pub unsafe fn LLVMGetParamParent(Inst: ValueRef) -> ValueRef;
pub unsafe fn LLVMGetFirstParam(Fn: ValueRef) -> ValueRef;
pub unsafe fn LLVMGetLastParam(Fn: ValueRef) -> ValueRef;
pub unsafe fn LLVMGetNextParam(Arg: ValueRef) -> ValueRef;
pub unsafe fn LLVMGetPreviousParam(Arg: ValueRef) -> ValueRef;
pub unsafe fn LLVMAddAttribute(Arg: ValueRef, PA: c_uint);
pub unsafe fn LLVMRemoveAttribute(Arg: ValueRef, PA: c_uint);
pub unsafe fn LLVMGetAttribute(Arg: ValueRef) -> c_uint;
pub unsafe fn LLVMSetParamAlignment(Arg: ValueRef, align: c_uint);
/* Operations on basic blocks */
unsafe fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
unsafe fn LLVMValueIsBasicBlock(Val: ValueRef) -> Bool;
unsafe fn LLVMValueAsBasicBlock(Val: ValueRef) -> BasicBlockRef;
unsafe fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
unsafe fn LLVMCountBasicBlocks(Fn: ValueRef) -> c_uint;
unsafe fn LLVMGetBasicBlocks(Fn: ValueRef, BasicBlocks: *ValueRef);
unsafe fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
unsafe fn LLVMGetLastBasicBlock(Fn: ValueRef) -> BasicBlockRef;
unsafe fn LLVMGetNextBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
unsafe fn LLVMGetPreviousBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
unsafe fn LLVMGetEntryBasicBlock(Fn: ValueRef) -> BasicBlockRef;
pub unsafe fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
pub unsafe fn LLVMValueIsBasicBlock(Val: ValueRef) -> Bool;
pub unsafe fn LLVMValueAsBasicBlock(Val: ValueRef) -> BasicBlockRef;
pub unsafe fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
pub unsafe fn LLVMCountBasicBlocks(Fn: ValueRef) -> c_uint;
pub unsafe fn LLVMGetBasicBlocks(Fn: ValueRef, BasicBlocks: *ValueRef);
pub unsafe fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
pub unsafe fn LLVMGetLastBasicBlock(Fn: ValueRef) -> BasicBlockRef;
pub unsafe fn LLVMGetNextBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
pub unsafe fn LLVMGetPreviousBasicBlock(BB: BasicBlockRef)
-> BasicBlockRef;
pub unsafe fn LLVMGetEntryBasicBlock(Fn: ValueRef) -> BasicBlockRef;
unsafe fn LLVMAppendBasicBlockInContext(C: ContextRef, Fn: ValueRef,
Name: *c_char) -> BasicBlockRef;
unsafe fn LLVMInsertBasicBlockInContext(C: ContextRef, BB: BasicBlockRef,
pub unsafe fn LLVMAppendBasicBlockInContext(C: ContextRef, Fn: ValueRef,
Name: *c_char) -> BasicBlockRef;
pub unsafe fn LLVMInsertBasicBlockInContext(C: ContextRef,
BB: BasicBlockRef,
Name: *c_char)
-> BasicBlockRef;
unsafe fn LLVMAppendBasicBlock(Fn: ValueRef,
pub unsafe fn LLVMAppendBasicBlock(Fn: ValueRef,
Name: *c_char)
-> BasicBlockRef;
unsafe fn LLVMInsertBasicBlock(InsertBeforeBB: BasicBlockRef,
pub unsafe fn LLVMInsertBasicBlock(InsertBeforeBB: BasicBlockRef,
Name: *c_char)
-> BasicBlockRef;
unsafe fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
pub unsafe fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
/* Operations on instructions */
unsafe fn LLVMGetInstructionParent(Inst: ValueRef) -> BasicBlockRef;
unsafe fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef;
unsafe fn LLVMGetLastInstruction(BB: BasicBlockRef) -> ValueRef;
unsafe fn LLVMGetNextInstruction(Inst: ValueRef) -> ValueRef;
unsafe fn LLVMGetPreviousInstruction(Inst: ValueRef) -> ValueRef;
pub unsafe fn LLVMGetInstructionParent(Inst: ValueRef) -> BasicBlockRef;
pub unsafe fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef;
pub unsafe fn LLVMGetLastInstruction(BB: BasicBlockRef) -> ValueRef;
pub unsafe fn LLVMGetNextInstruction(Inst: ValueRef) -> ValueRef;
pub unsafe fn LLVMGetPreviousInstruction(Inst: ValueRef) -> ValueRef;
/* Operations on call sites */
unsafe fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint);
unsafe fn LLVMGetInstructionCallConv(Instr: ValueRef) -> c_uint;
unsafe fn LLVMAddInstrAttribute(Instr: ValueRef,
pub unsafe fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint);
pub unsafe fn LLVMGetInstructionCallConv(Instr: ValueRef) -> c_uint;
pub unsafe fn LLVMAddInstrAttribute(Instr: ValueRef,
index: c_uint,
IA: c_uint);
unsafe fn LLVMRemoveInstrAttribute(Instr: ValueRef, index: c_uint,
pub unsafe fn LLVMRemoveInstrAttribute(Instr: ValueRef, index: c_uint,
IA: c_uint);
unsafe fn LLVMSetInstrParamAlignment(Instr: ValueRef, index: c_uint,
pub unsafe fn LLVMSetInstrParamAlignment(Instr: ValueRef, index: c_uint,
align: c_uint);
/* Operations on call instructions (only) */
unsafe fn LLVMIsTailCall(CallInst: ValueRef) -> Bool;
unsafe fn LLVMSetTailCall(CallInst: ValueRef, IsTailCall: Bool);
pub unsafe fn LLVMIsTailCall(CallInst: ValueRef) -> Bool;
pub unsafe fn LLVMSetTailCall(CallInst: ValueRef, IsTailCall: Bool);
/* Operations on phi nodes */
unsafe fn LLVMAddIncoming(PhiNode: ValueRef, IncomingValues: *ValueRef,
IncomingBlocks: *BasicBlockRef, Count: c_uint);
unsafe fn LLVMCountIncoming(PhiNode: ValueRef) -> c_uint;
unsafe fn LLVMGetIncomingValue(PhiNode: ValueRef,
pub unsafe fn LLVMAddIncoming(PhiNode: ValueRef,
IncomingValues: *ValueRef,
IncomingBlocks: *BasicBlockRef,
Count: c_uint);
pub unsafe fn LLVMCountIncoming(PhiNode: ValueRef) -> c_uint;
pub unsafe fn LLVMGetIncomingValue(PhiNode: ValueRef,
Index: c_uint)
-> ValueRef;
unsafe fn LLVMGetIncomingBlock(PhiNode: ValueRef,
pub unsafe fn LLVMGetIncomingBlock(PhiNode: ValueRef,
Index: c_uint) -> BasicBlockRef;
/* Instruction builders */
unsafe fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
unsafe fn LLVMCreateBuilder() -> BuilderRef;
unsafe fn LLVMPositionBuilder(Builder: BuilderRef, Block: BasicBlockRef,
Instr: ValueRef);
unsafe fn LLVMPositionBuilderBefore(Builder: BuilderRef, Instr: ValueRef);
unsafe fn LLVMPositionBuilderAtEnd(Builder: BuilderRef,
Block: BasicBlockRef);
unsafe fn LLVMGetInsertBlock(Builder: BuilderRef) -> BasicBlockRef;
unsafe fn LLVMClearInsertionPosition(Builder: BuilderRef);
unsafe fn LLVMInsertIntoBuilder(Builder: BuilderRef, Instr: ValueRef);
unsafe fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef,
pub unsafe fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
pub unsafe fn LLVMCreateBuilder() -> BuilderRef;
pub unsafe fn LLVMPositionBuilder(Builder: BuilderRef,
Block: BasicBlockRef,
Instr: ValueRef);
pub unsafe fn LLVMPositionBuilderBefore(Builder: BuilderRef,
Instr: ValueRef);
pub unsafe fn LLVMPositionBuilderAtEnd(Builder: BuilderRef,
Block: BasicBlockRef);
pub unsafe fn LLVMGetInsertBlock(Builder: BuilderRef) -> BasicBlockRef;
pub unsafe fn LLVMClearInsertionPosition(Builder: BuilderRef);
pub unsafe fn LLVMInsertIntoBuilder(Builder: BuilderRef, Instr: ValueRef);
pub unsafe fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef,
Instr: ValueRef,
Name: *c_char);
unsafe fn LLVMDisposeBuilder(Builder: BuilderRef);
pub unsafe fn LLVMDisposeBuilder(Builder: BuilderRef);
/* Metadata */
unsafe fn LLVMSetCurrentDebugLocation(Builder: BuilderRef, L: ValueRef);
unsafe fn LLVMGetCurrentDebugLocation(Builder: BuilderRef) -> ValueRef;
unsafe fn LLVMSetInstDebugLocation(Builder: BuilderRef, Inst: ValueRef);
pub unsafe fn LLVMSetCurrentDebugLocation(Builder: BuilderRef,
L: ValueRef);
pub unsafe fn LLVMGetCurrentDebugLocation(Builder: BuilderRef)
-> ValueRef;
pub unsafe fn LLVMSetInstDebugLocation(Builder: BuilderRef,
Inst: ValueRef);
/* Terminators */
unsafe fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
unsafe fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
unsafe fn LLVMBuildAggregateRet(B: BuilderRef, RetVals: *ValueRef,
pub unsafe fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
pub unsafe fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
pub unsafe fn LLVMBuildAggregateRet(B: BuilderRef, RetVals: *ValueRef,
N: c_uint) -> ValueRef;
unsafe fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
unsafe fn LLVMBuildCondBr(B: BuilderRef,
pub unsafe fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
pub unsafe fn LLVMBuildCondBr(B: BuilderRef,
If: ValueRef,
Then: BasicBlockRef,
Else: BasicBlockRef)
-> ValueRef;
unsafe fn LLVMBuildSwitch(B: BuilderRef, V: ValueRef, Else: BasicBlockRef,
NumCases: c_uint) -> ValueRef;
unsafe fn LLVMBuildIndirectBr(B: BuilderRef, Addr: ValueRef,
pub unsafe fn LLVMBuildSwitch(B: BuilderRef, V: ValueRef,
Else: BasicBlockRef, NumCases: c_uint)
-> ValueRef;
pub unsafe fn LLVMBuildIndirectBr(B: BuilderRef, Addr: ValueRef,
NumDests: c_uint) -> ValueRef;
unsafe fn LLVMBuildInvoke(B: BuilderRef, Fn: ValueRef, Args: *ValueRef,
NumArgs: c_uint, Then: BasicBlockRef,
Catch: BasicBlockRef, Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildLandingPad(B: BuilderRef,
pub unsafe fn LLVMBuildInvoke(B: BuilderRef,
Fn: ValueRef,
Args: *ValueRef,
NumArgs: c_uint,
Then: BasicBlockRef,
Catch: BasicBlockRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildLandingPad(B: BuilderRef,
Ty: TypeRef,
PersFn: ValueRef,
NumClauses: c_uint,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
unsafe fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
pub unsafe fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
pub unsafe fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
/* Add a case to the switch instruction */
unsafe fn LLVMAddCase(Switch: ValueRef,
pub unsafe fn LLVMAddCase(Switch: ValueRef,
OnVal: ValueRef,
Dest: BasicBlockRef);
/* Add a destination to the indirectbr instruction */
unsafe fn LLVMAddDestination(IndirectBr: ValueRef, Dest: BasicBlockRef);
pub unsafe fn LLVMAddDestination(IndirectBr: ValueRef,
Dest: BasicBlockRef);
/* Add a clause to the landing pad instruction */
unsafe fn LLVMAddClause(LandingPad: ValueRef, ClauseVal: ValueRef);
pub unsafe fn LLVMAddClause(LandingPad: ValueRef, ClauseVal: ValueRef);
/* Set the cleanup on a landing pad instruction */
unsafe fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
pub unsafe fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
/* Arithmetic */
unsafe fn LLVMBuildAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildNSWAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildNSWAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildNUWAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildNUWAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildFAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildFAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildNSWSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildNSWSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildNUWSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildNUWSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildFSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildFSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildNSWMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildNSWMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildNUWMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildNUWMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildFMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildFMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildUDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildUDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildSDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildSDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildExactSDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildFDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildExactSDiv(B: BuilderRef, LHS: ValueRef,
RHS: ValueRef, Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildFDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildURem(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildURem(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildSRem(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildSRem(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildFRem(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildFRem(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildShl(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildShl(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildLShr(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildLShr(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildAShr(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildAShr(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildAnd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildAnd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildOr(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildOr(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildXor(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
pub unsafe fn LLVMBuildXor(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildBinOp(B: BuilderRef,
pub unsafe fn LLVMBuildBinOp(B: BuilderRef,
Op: Opcode,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildNeg(B: BuilderRef,
pub unsafe fn LLVMBuildNeg(B: BuilderRef,
V: ValueRef,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildNSWNeg(B: BuilderRef,
pub unsafe fn LLVMBuildNSWNeg(B: BuilderRef,
V: ValueRef,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildNUWNeg(B: BuilderRef,
pub unsafe fn LLVMBuildNUWNeg(B: BuilderRef,
V: ValueRef,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildFNeg(B: BuilderRef,
pub unsafe fn LLVMBuildFNeg(B: BuilderRef,
V: ValueRef,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildNot(B: BuilderRef,
pub unsafe fn LLVMBuildNot(B: BuilderRef,
V: ValueRef,
Name: *c_char)
-> ValueRef;
/* Memory */
unsafe fn LLVMBuildMalloc(B: BuilderRef,
pub unsafe fn LLVMBuildMalloc(B: BuilderRef,
Ty: TypeRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildArrayMalloc(B: BuilderRef,
Ty: TypeRef,
Val: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildAlloca(B: BuilderRef,
Ty: TypeRef,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildArrayMalloc(B: BuilderRef, Ty: TypeRef, Val: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildAlloca(B: BuilderRef,
Ty: TypeRef,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildArrayAlloca(B: BuilderRef, Ty: TypeRef, Val: ValueRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildFree(B: BuilderRef, PointerVal: ValueRef) -> ValueRef;
unsafe fn LLVMBuildLoad(B: BuilderRef,
pub unsafe fn LLVMBuildArrayAlloca(B: BuilderRef,
Ty: TypeRef,
Val: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildFree(B: BuilderRef,
PointerVal: ValueRef) -> ValueRef;
pub unsafe fn LLVMBuildLoad(B: BuilderRef,
PointerVal: ValueRef,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef) ->
ValueRef;
unsafe fn LLVMBuildGEP(B: BuilderRef,
pub unsafe fn LLVMBuildStore(B: BuilderRef,
Val: ValueRef,
Ptr: ValueRef) -> ValueRef;
pub unsafe fn LLVMBuildGEP(B: BuilderRef,
Pointer: ValueRef,
Indices: *ValueRef,
NumIndices: c_uint,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildInBoundsGEP(B: BuilderRef, Pointer: ValueRef,
pub unsafe fn LLVMBuildInBoundsGEP(B: BuilderRef, Pointer: ValueRef,
Indices: *ValueRef, NumIndices: c_uint,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildStructGEP(B: BuilderRef,
pub unsafe fn LLVMBuildStructGEP(B: BuilderRef,
Pointer: ValueRef,
Idx: c_uint,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildGlobalString(B: BuilderRef,
pub unsafe fn LLVMBuildGlobalString(B: BuilderRef,
Str: *c_char,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildGlobalStringPtr(B: BuilderRef,
pub unsafe fn LLVMBuildGlobalStringPtr(B: BuilderRef,
Str: *c_char,
Name: *c_char)
-> ValueRef;
/* Casts */
unsafe fn LLVMBuildTrunc(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildZExt(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
pub unsafe fn LLVMBuildTrunc(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildZExt(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildSExt(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
pub unsafe fn LLVMBuildSExt(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildFPToUI(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildFPToSI(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildUIToFP(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildSIToFP(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildFPTrunc(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildFPExt(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildPtrToInt(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildIntToPtr(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildBitCast(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildZExtOrBitCast(B: BuilderRef,
pub unsafe fn LLVMBuildFPToUI(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildFPToSI(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildUIToFP(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildSIToFP(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildFPTrunc(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildFPExt(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildPtrToInt(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildIntToPtr(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildBitCast(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildZExtOrBitCast(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildSExtOrBitCast(B: BuilderRef,
pub unsafe fn LLVMBuildSExtOrBitCast(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildTruncOrBitCast(B: BuilderRef,
pub unsafe fn LLVMBuildTruncOrBitCast(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildCast(B: BuilderRef, Op: Opcode, Val: ValueRef,
pub unsafe fn LLVMBuildCast(B: BuilderRef, Op: Opcode, Val: ValueRef,
DestTy: TypeRef, Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildPointerCast(B: BuilderRef,
pub unsafe fn LLVMBuildPointerCast(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildIntCast(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildFPCast(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildIntCast(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildFPCast(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char) -> ValueRef;
/* Comparisons */
unsafe fn LLVMBuildICmp(B: BuilderRef, Op: c_uint, LHS: ValueRef,
pub unsafe fn LLVMBuildICmp(B: BuilderRef, Op: c_uint, LHS: ValueRef,
RHS: ValueRef, Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildFCmp(B: BuilderRef, Op: c_uint, LHS: ValueRef,
pub unsafe fn LLVMBuildFCmp(B: BuilderRef, Op: c_uint, LHS: ValueRef,
RHS: ValueRef, Name: *c_char) -> ValueRef;
/* Miscellaneous instructions */
unsafe fn LLVMBuildPhi(B: BuilderRef,
pub unsafe fn LLVMBuildPhi(B: BuilderRef,
Ty: TypeRef,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildCall(B: BuilderRef, Fn: ValueRef, Args: *ValueRef,
pub unsafe fn LLVMBuildCall(B: BuilderRef, Fn: ValueRef, Args: *ValueRef,
NumArgs: c_uint, Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildSelect(B: BuilderRef, If: ValueRef, Then: ValueRef,
pub unsafe fn LLVMBuildSelect(B: BuilderRef, If: ValueRef, Then: ValueRef,
Else: ValueRef, Name: *c_char) -> ValueRef;
unsafe fn LLVMBuildVAArg(B: BuilderRef, list: ValueRef, Ty: TypeRef,
pub unsafe fn LLVMBuildVAArg(B: BuilderRef, list: ValueRef, Ty: TypeRef,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildExtractElement(B: BuilderRef,
pub unsafe fn LLVMBuildExtractElement(B: BuilderRef,
VecVal: ValueRef,
Index: ValueRef,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildInsertElement(B: BuilderRef,
pub unsafe fn LLVMBuildInsertElement(B: BuilderRef,
VecVal: ValueRef,
EltVal: ValueRef,
Index: ValueRef,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildShuffleVector(B: BuilderRef,
pub unsafe fn LLVMBuildShuffleVector(B: BuilderRef,
V1: ValueRef,
V2: ValueRef,
Mask: ValueRef,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildExtractValue(B: BuilderRef,
pub unsafe fn LLVMBuildExtractValue(B: BuilderRef,
AggVal: ValueRef,
Index: c_uint,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildInsertValue(B: BuilderRef,
pub unsafe fn LLVMBuildInsertValue(B: BuilderRef,
AggVal: ValueRef,
EltVal: ValueRef,
Index: c_uint,
Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *c_char)
pub unsafe fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: *c_char)
-> ValueRef;
unsafe fn LLVMBuildPtrDiff(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildIsNotNull(B: BuilderRef,
Val: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildPtrDiff(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char) -> ValueRef;
/* Atomic Operations */
unsafe fn LLVMBuildAtomicCmpXchg(B: BuilderRef, LHS: ValueRef,
pub unsafe fn LLVMBuildAtomicCmpXchg(B: BuilderRef, LHS: ValueRef,
CMP: ValueRef, RHS: ValueRef,
++Order: AtomicOrdering) -> ValueRef;
unsafe fn LLVMBuildAtomicRMW(B: BuilderRef, ++Op: AtomicBinOp,
pub unsafe fn LLVMBuildAtomicRMW(B: BuilderRef, ++Op: AtomicBinOp,
LHS: ValueRef, RHS: ValueRef,
++Order: AtomicOrdering) -> ValueRef;
/* Selected entries from the downcasts. */
unsafe fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
pub unsafe fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
/** Writes a module to the specified path. Returns 0 on success. */
unsafe fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: *c_char) -> c_int;
pub unsafe fn LLVMWriteBitcodeToFile(M: ModuleRef,
Path: *c_char) -> c_int;
/** Creates target data from a target layout string. */
unsafe fn LLVMCreateTargetData(StringRep: *c_char) -> TargetDataRef;
pub unsafe fn LLVMCreateTargetData(StringRep: *c_char) -> TargetDataRef;
/** Adds the target data to the given pass manager. The pass manager
references the target data only weakly. */
unsafe fn LLVMAddTargetData(TD: TargetDataRef, PM: PassManagerRef);
pub unsafe fn LLVMAddTargetData(TD: TargetDataRef, PM: PassManagerRef);
/** Number of bytes clobbered when doing a Store to *T. */
unsafe fn LLVMStoreSizeOfType(TD: TargetDataRef, Ty: TypeRef)
pub unsafe fn LLVMStoreSizeOfType(TD: TargetDataRef, Ty: TypeRef)
-> c_ulonglong;
/** Number of bytes clobbered when doing a Store to *T. */
unsafe fn LLVMSizeOfTypeInBits(TD: TargetDataRef, Ty: TypeRef)
pub unsafe fn LLVMSizeOfTypeInBits(TD: TargetDataRef, Ty: TypeRef)
-> c_ulonglong;
/** Distance between successive elements in an array of T.
Includes ABI padding. */
unsafe fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
pub unsafe fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
/** Returns the preferred alignment of a type. */
unsafe fn LLVMPreferredAlignmentOfType(TD: TargetDataRef,
pub unsafe fn LLVMPreferredAlignmentOfType(TD: TargetDataRef,
Ty: TypeRef) -> c_uint;
/** Returns the minimum alignment of a type. */
unsafe fn LLVMABIAlignmentOfType(TD: TargetDataRef,
pub unsafe fn LLVMABIAlignmentOfType(TD: TargetDataRef,
Ty: TypeRef) -> c_uint;
/** Returns the minimum alignment of a type when part of a call frame. */
unsafe fn LLVMCallFrameAlignmentOfType(TD: TargetDataRef,
pub unsafe fn LLVMCallFrameAlignmentOfType(TD: TargetDataRef,
Ty: TypeRef) -> c_uint;
/** Disposes target data. */
unsafe fn LLVMDisposeTargetData(TD: TargetDataRef);
pub unsafe fn LLVMDisposeTargetData(TD: TargetDataRef);
/** Creates a pass manager. */
unsafe fn LLVMCreatePassManager() -> PassManagerRef;
pub unsafe fn LLVMCreatePassManager() -> PassManagerRef;
/** Disposes a pass manager. */
unsafe fn LLVMDisposePassManager(PM: PassManagerRef);
pub unsafe fn LLVMDisposePassManager(PM: PassManagerRef);
/** Runs a pass manager on a module. */
unsafe fn LLVMRunPassManager(PM: PassManagerRef, M: ModuleRef) -> Bool;
pub unsafe fn LLVMRunPassManager(PM: PassManagerRef,
M: ModuleRef) -> Bool;
/** Adds a verification pass. */
unsafe fn LLVMAddVerifierPass(PM: PassManagerRef);
pub unsafe fn LLVMAddVerifierPass(PM: PassManagerRef);
unsafe fn LLVMAddGlobalOptimizerPass(PM: PassManagerRef);
unsafe fn LLVMAddIPSCCPPass(PM: PassManagerRef);
unsafe fn LLVMAddDeadArgEliminationPass(PM: PassManagerRef);
unsafe fn LLVMAddInstructionCombiningPass(PM: PassManagerRef);
unsafe fn LLVMAddCFGSimplificationPass(PM: PassManagerRef);
unsafe fn LLVMAddFunctionInliningPass(PM: PassManagerRef);
unsafe fn LLVMAddFunctionAttrsPass(PM: PassManagerRef);
unsafe fn LLVMAddScalarReplAggregatesPass(PM: PassManagerRef);
unsafe fn LLVMAddScalarReplAggregatesPassSSA(PM: PassManagerRef);
unsafe fn LLVMAddJumpThreadingPass(PM: PassManagerRef);
unsafe fn LLVMAddConstantPropagationPass(PM: PassManagerRef);
unsafe fn LLVMAddReassociatePass(PM: PassManagerRef);
unsafe fn LLVMAddLoopRotatePass(PM: PassManagerRef);
unsafe fn LLVMAddLICMPass(PM: PassManagerRef);
unsafe fn LLVMAddLoopUnswitchPass(PM: PassManagerRef);
unsafe fn LLVMAddLoopDeletionPass(PM: PassManagerRef);
unsafe fn LLVMAddLoopUnrollPass(PM: PassManagerRef);
unsafe fn LLVMAddGVNPass(PM: PassManagerRef);
unsafe fn LLVMAddMemCpyOptPass(PM: PassManagerRef);
unsafe fn LLVMAddSCCPPass(PM: PassManagerRef);
unsafe fn LLVMAddDeadStoreEliminationPass(PM: PassManagerRef);
unsafe fn LLVMAddStripDeadPrototypesPass(PM: PassManagerRef);
unsafe fn LLVMAddConstantMergePass(PM: PassManagerRef);
unsafe fn LLVMAddArgumentPromotionPass(PM: PassManagerRef);
unsafe fn LLVMAddTailCallEliminationPass(PM: PassManagerRef);
unsafe fn LLVMAddIndVarSimplifyPass(PM: PassManagerRef);
unsafe fn LLVMAddAggressiveDCEPass(PM: PassManagerRef);
unsafe fn LLVMAddGlobalDCEPass(PM: PassManagerRef);
unsafe fn LLVMAddCorrelatedValuePropagationPass(PM: PassManagerRef);
unsafe fn LLVMAddPruneEHPass(PM: PassManagerRef);
unsafe fn LLVMAddSimplifyLibCallsPass(PM: PassManagerRef);
unsafe fn LLVMAddLoopIdiomPass(PM: PassManagerRef);
unsafe fn LLVMAddEarlyCSEPass(PM: PassManagerRef);
unsafe fn LLVMAddTypeBasedAliasAnalysisPass(PM: PassManagerRef);
unsafe fn LLVMAddBasicAliasAnalysisPass(PM: PassManagerRef);
pub unsafe fn LLVMAddGlobalOptimizerPass(PM: PassManagerRef);
pub unsafe fn LLVMAddIPSCCPPass(PM: PassManagerRef);
pub unsafe fn LLVMAddDeadArgEliminationPass(PM: PassManagerRef);
pub unsafe fn LLVMAddInstructionCombiningPass(PM: PassManagerRef);
pub unsafe fn LLVMAddCFGSimplificationPass(PM: PassManagerRef);
pub unsafe fn LLVMAddFunctionInliningPass(PM: PassManagerRef);
pub unsafe fn LLVMAddFunctionAttrsPass(PM: PassManagerRef);
pub unsafe fn LLVMAddScalarReplAggregatesPass(PM: PassManagerRef);
pub unsafe fn LLVMAddScalarReplAggregatesPassSSA(PM: PassManagerRef);
pub unsafe fn LLVMAddJumpThreadingPass(PM: PassManagerRef);
pub unsafe fn LLVMAddConstantPropagationPass(PM: PassManagerRef);
pub unsafe fn LLVMAddReassociatePass(PM: PassManagerRef);
pub unsafe fn LLVMAddLoopRotatePass(PM: PassManagerRef);
pub unsafe fn LLVMAddLICMPass(PM: PassManagerRef);
pub unsafe fn LLVMAddLoopUnswitchPass(PM: PassManagerRef);
pub unsafe fn LLVMAddLoopDeletionPass(PM: PassManagerRef);
pub unsafe fn LLVMAddLoopUnrollPass(PM: PassManagerRef);
pub unsafe fn LLVMAddGVNPass(PM: PassManagerRef);
pub unsafe fn LLVMAddMemCpyOptPass(PM: PassManagerRef);
pub unsafe fn LLVMAddSCCPPass(PM: PassManagerRef);
pub unsafe fn LLVMAddDeadStoreEliminationPass(PM: PassManagerRef);
pub unsafe fn LLVMAddStripDeadPrototypesPass(PM: PassManagerRef);
pub unsafe fn LLVMAddConstantMergePass(PM: PassManagerRef);
pub unsafe fn LLVMAddArgumentPromotionPass(PM: PassManagerRef);
pub unsafe fn LLVMAddTailCallEliminationPass(PM: PassManagerRef);
pub unsafe fn LLVMAddIndVarSimplifyPass(PM: PassManagerRef);
pub unsafe fn LLVMAddAggressiveDCEPass(PM: PassManagerRef);
pub unsafe fn LLVMAddGlobalDCEPass(PM: PassManagerRef);
pub unsafe fn LLVMAddCorrelatedValuePropagationPass(PM: PassManagerRef);
pub unsafe fn LLVMAddPruneEHPass(PM: PassManagerRef);
pub unsafe fn LLVMAddSimplifyLibCallsPass(PM: PassManagerRef);
pub unsafe fn LLVMAddLoopIdiomPass(PM: PassManagerRef);
pub unsafe fn LLVMAddEarlyCSEPass(PM: PassManagerRef);
pub unsafe fn LLVMAddTypeBasedAliasAnalysisPass(PM: PassManagerRef);
pub unsafe fn LLVMAddBasicAliasAnalysisPass(PM: PassManagerRef);
unsafe fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
unsafe fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef);
unsafe fn LLVMPassManagerBuilderSetOptLevel(PMB: PassManagerBuilderRef,
OptimizationLevel: c_uint);
unsafe fn LLVMPassManagerBuilderSetSizeLevel(PMB: PassManagerBuilderRef,
Value: Bool);
unsafe fn LLVMPassManagerBuilderSetDisableUnitAtATime(
pub unsafe fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
pub unsafe fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef);
pub unsafe fn LLVMPassManagerBuilderSetOptLevel(
PMB: PassManagerBuilderRef, OptimizationLevel: c_uint);
pub unsafe fn LLVMPassManagerBuilderSetSizeLevel(
PMB: PassManagerBuilderRef, Value: Bool);
unsafe fn LLVMPassManagerBuilderSetDisableUnrollLoops(
pub unsafe fn LLVMPassManagerBuilderSetDisableUnitAtATime(
PMB: PassManagerBuilderRef, Value: Bool);
unsafe fn LLVMPassManagerBuilderSetDisableSimplifyLibCalls
pub unsafe fn LLVMPassManagerBuilderSetDisableUnrollLoops(
PMB: PassManagerBuilderRef, Value: Bool);
pub unsafe fn LLVMPassManagerBuilderSetDisableSimplifyLibCalls
(PMB: PassManagerBuilderRef, Value: Bool);
unsafe fn LLVMPassManagerBuilderUseInlinerWithThreshold
pub unsafe fn LLVMPassManagerBuilderUseInlinerWithThreshold
(PMB: PassManagerBuilderRef, threshold: c_uint);
unsafe fn LLVMPassManagerBuilderPopulateModulePassManager
pub unsafe fn LLVMPassManagerBuilderPopulateModulePassManager
(PMB: PassManagerBuilderRef, PM: PassManagerRef);
unsafe fn LLVMPassManagerBuilderPopulateFunctionPassManager
pub unsafe fn LLVMPassManagerBuilderPopulateFunctionPassManager
(PMB: PassManagerBuilderRef, PM: PassManagerRef);
/** Destroys a memory buffer. */
unsafe fn LLVMDisposeMemoryBuffer(MemBuf: MemoryBufferRef);
pub unsafe fn LLVMDisposeMemoryBuffer(MemBuf: MemoryBufferRef);
/* Stuff that's in rustllvm/ because it's not upstream yet. */
/** Opens an object file. */
unsafe fn LLVMCreateObjectFile(MemBuf: MemoryBufferRef) -> ObjectFileRef;
pub unsafe fn LLVMCreateObjectFile(MemBuf: MemoryBufferRef)
-> ObjectFileRef;
/** Closes an object file. */
unsafe fn LLVMDisposeObjectFile(ObjFile: ObjectFileRef);
pub unsafe fn LLVMDisposeObjectFile(ObjFile: ObjectFileRef);
/** Enumerates the sections in an object file. */
unsafe fn LLVMGetSections(ObjFile: ObjectFileRef) -> SectionIteratorRef;
pub unsafe fn LLVMGetSections(ObjFile: ObjectFileRef)
-> SectionIteratorRef;
/** Destroys a section iterator. */
unsafe fn LLVMDisposeSectionIterator(SI: SectionIteratorRef);
pub unsafe fn LLVMDisposeSectionIterator(SI: SectionIteratorRef);
/** Returns true if the section iterator is at the end of the section
list: */
unsafe fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef,
pub unsafe fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef,
SI: SectionIteratorRef) -> Bool;
/** Moves the section iterator to point to the next section. */
unsafe fn LLVMMoveToNextSection(SI: SectionIteratorRef);
pub unsafe fn LLVMMoveToNextSection(SI: SectionIteratorRef);
/** Returns the current section name. */
unsafe fn LLVMGetSectionName(SI: SectionIteratorRef) -> *c_char;
pub unsafe fn LLVMGetSectionName(SI: SectionIteratorRef) -> *c_char;
/** Returns the current section size. */
unsafe fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
pub unsafe fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
/** Returns the current section contents as a string buffer. */
unsafe fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *c_char;
pub unsafe fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *c_char;
/** Reads the given file and returns it as a memory buffer. Use
LLVMDisposeMemoryBuffer() to get rid of it. */
unsafe fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *c_char) ->
MemoryBufferRef;
pub unsafe fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *c_char)
-> MemoryBufferRef;
unsafe fn LLVMRustWriteOutputFile(PM: PassManagerRef, M: ModuleRef,
pub unsafe fn LLVMRustWriteOutputFile(PM: PassManagerRef, M: ModuleRef,
Triple: *c_char,
// FIXME: When #2334 is fixed, change
// c_uint to FileType
@@ -1190,60 +1260,61 @@ unsafe fn LLVMRustWriteOutputFile(PM: PassManagerRef, M: ModuleRef,
/** Returns a string describing the last error caused by an LLVMRust*
call. */
unsafe fn LLVMRustGetLastError() -> *c_char;
pub unsafe fn LLVMRustGetLastError() -> *c_char;
/** Prepare the JIT. Returns a memory manager that can load crates. */
unsafe fn LLVMRustPrepareJIT(__morestack: *()) -> *();
pub unsafe fn LLVMRustPrepareJIT(__morestack: *()) -> *();
/** Load a crate into the memory manager. */
unsafe fn LLVMRustLoadCrate(MM: *(),
pub unsafe fn LLVMRustLoadCrate(MM: *(),
Filename: *c_char) -> bool;
/** Execute the JIT engine. */
unsafe fn LLVMRustExecuteJIT(MM: *(),
pub unsafe fn LLVMRustExecuteJIT(MM: *(),
PM: PassManagerRef,
M: ModuleRef,
OptLevel: c_int,
EnableSegmentedStacks: bool) -> *();
/** Parses the bitcode in the given memory buffer. */
unsafe fn LLVMRustParseBitcode(MemBuf: MemoryBufferRef) -> ModuleRef;
pub unsafe fn LLVMRustParseBitcode(MemBuf: MemoryBufferRef) -> ModuleRef;
/** Parses LLVM asm in the given file */
unsafe fn LLVMRustParseAssemblyFile(Filename: *c_char) -> ModuleRef;
pub unsafe fn LLVMRustParseAssemblyFile(Filename: *c_char) -> ModuleRef;
unsafe fn LLVMRustAddPrintModulePass(PM: PassManagerRef, M: ModuleRef,
pub unsafe fn LLVMRustAddPrintModulePass(PM: PassManagerRef, M: ModuleRef,
Output: *c_char);
/** Turn on LLVM pass-timing. */
unsafe fn LLVMRustEnableTimePasses();
pub unsafe fn LLVMRustEnableTimePasses();
/** Print the pass timings since static dtors aren't picking them up. */
unsafe fn LLVMRustPrintPassTimings();
pub unsafe fn LLVMRustPrintPassTimings();
unsafe fn LLVMStructCreateNamed(C: ContextRef, Name: *c_char) -> TypeRef;
pub unsafe fn LLVMStructCreateNamed(C: ContextRef, Name: *c_char)
-> TypeRef;
unsafe fn LLVMStructSetBody(StructTy: TypeRef, ElementTypes: *TypeRef,
pub unsafe fn LLVMStructSetBody(StructTy: TypeRef, ElementTypes: *TypeRef,
ElementCount: c_uint, Packed: Bool);
unsafe fn LLVMConstNamedStruct(S: TypeRef, ConstantVals: *ValueRef,
pub unsafe fn LLVMConstNamedStruct(S: TypeRef, ConstantVals: *ValueRef,
Count: c_uint) -> ValueRef;
/** Enables LLVM debug output. */
unsafe fn LLVMSetDebug(Enabled: c_int);
pub unsafe fn LLVMSetDebug(Enabled: c_int);
}
fn SetInstructionCallConv(Instr: ValueRef, CC: CallConv) {
pub fn SetInstructionCallConv(Instr: ValueRef, CC: CallConv) {
unsafe {
llvm::LLVMSetInstructionCallConv(Instr, CC as c_uint);
}
}
fn SetFunctionCallConv(Fn: ValueRef, CC: CallConv) {
pub fn SetFunctionCallConv(Fn: ValueRef, CC: CallConv) {
unsafe {
llvm::LLVMSetFunctionCallConv(Fn, CC as c_uint);
}
}
fn SetLinkage(Global: ValueRef, Link: Linkage) {
pub fn SetLinkage(Global: ValueRef, Link: Linkage) {
unsafe {
llvm::LLVMSetLinkage(Global, Link as c_uint);
}
@@ -1251,33 +1322,33 @@ fn SetLinkage(Global: ValueRef, Link: Linkage) {
/* Memory-managed object interface to type handles. */
type type_names = @{type_names: HashMap<TypeRef, @str>,
pub type type_names = @{type_names: HashMap<TypeRef, @str>,
named_types: HashMap<@str, TypeRef>};
fn associate_type(tn: type_names, s: @str, t: TypeRef) {
pub fn associate_type(tn: type_names, s: @str, t: TypeRef) {
assert tn.type_names.insert(t, s);
assert tn.named_types.insert(s, t);
}
fn type_has_name(tn: type_names, t: TypeRef) -> Option<@str> {
pub fn type_has_name(tn: type_names, t: TypeRef) -> Option<@str> {
return tn.type_names.find(t);
}
fn name_has_type(tn: type_names, s: @str) -> Option<TypeRef> {
pub fn name_has_type(tn: type_names, s: @str) -> Option<TypeRef> {
return tn.named_types.find(s);
}
fn mk_type_names() -> type_names {
pub fn mk_type_names() -> type_names {
@{type_names: HashMap(),
named_types: HashMap()}
}
fn type_to_str(names: type_names, ty: TypeRef) -> @str {
pub fn type_to_str(names: type_names, ty: TypeRef) -> @str {
return type_to_str_inner(names, ~[], ty);
}
fn type_to_str_inner(names: type_names, +outer0: ~[TypeRef], ty: TypeRef) ->
@str {
pub fn type_to_str_inner(names: type_names, +outer0: ~[TypeRef], ty: TypeRef)
-> @str {
unsafe {
match type_has_name(names, ty) {
option::Some(n) => return n,
@@ -1374,7 +1445,7 @@ fn tys_str(names: type_names, outer: ~[TypeRef],
}
}
fn float_width(llt: TypeRef) -> uint {
pub fn float_width(llt: TypeRef) -> uint {
unsafe {
return match llvm::LLVMGetTypeKind(llt) as int {
1 => 32u,
@@ -1386,7 +1457,7 @@ fn float_width(llt: TypeRef) -> uint {
}
}
fn fn_ty_param_tys(fn_ty: TypeRef) -> ~[TypeRef] {
pub fn fn_ty_param_tys(fn_ty: TypeRef) -> ~[TypeRef] {
unsafe {
let args = vec::from_elem(llvm::LLVMCountParamTypes(fn_ty) as uint,
0 as TypeRef);
@@ -1395,7 +1466,7 @@ fn fn_ty_param_tys(fn_ty: TypeRef) -> ~[TypeRef] {
}
}
fn struct_element_types(struct_ty: TypeRef) -> ~[TypeRef] {
pub fn struct_element_types(struct_ty: TypeRef) -> ~[TypeRef] {
unsafe {
let count = llvm::LLVMCountStructElementTypes(struct_ty);
let mut buf: ~[TypeRef] =
@@ -1412,7 +1483,7 @@ fn struct_element_types(struct_ty: TypeRef) -> ~[TypeRef] {
/* Memory-managed interface to target data. */
struct target_data_res {
pub struct target_data_res {
TD: TargetDataRef,
drop {
unsafe {
@@ -1421,15 +1492,15 @@ struct target_data_res {
}
}
fn target_data_res(TD: TargetDataRef) -> target_data_res {
pub fn target_data_res(TD: TargetDataRef) -> target_data_res {
target_data_res {
TD: TD
}
}
type target_data = {lltd: TargetDataRef, dtor: @target_data_res};
pub type target_data = {lltd: TargetDataRef, dtor: @target_data_res};
fn mk_target_data(string_rep: ~str) -> target_data {
pub fn mk_target_data(string_rep: ~str) -> target_data {
let lltd =
str::as_c_str(string_rep, |buf| unsafe {
llvm::LLVMCreateTargetData(buf)
@@ -1439,7 +1510,7 @@ fn mk_target_data(string_rep: ~str) -> target_data {
/* Memory-managed interface to pass managers. */
struct pass_manager_res {
pub struct pass_manager_res {
PM: PassManagerRef,
drop {
unsafe {
@@ -1448,15 +1519,15 @@ struct pass_manager_res {
}
}
fn pass_manager_res(PM: PassManagerRef) -> pass_manager_res {
pub fn pass_manager_res(PM: PassManagerRef) -> pass_manager_res {
pass_manager_res {
PM: PM
}
}
type pass_manager = {llpm: PassManagerRef, dtor: @pass_manager_res};
pub type pass_manager = {llpm: PassManagerRef, dtor: @pass_manager_res};
fn mk_pass_manager() -> pass_manager {
pub fn mk_pass_manager() -> pass_manager {
unsafe {
let llpm = llvm::LLVMCreatePassManager();
return {llpm: llpm, dtor: @pass_manager_res(llpm)};
@@ -1465,7 +1536,7 @@ fn mk_pass_manager() -> pass_manager {
/* Memory-managed interface to object files. */
struct object_file_res {
pub struct object_file_res {
ObjectFile: ObjectFileRef,
drop {
unsafe {
@@ -1474,15 +1545,15 @@ struct object_file_res {
}
}
fn object_file_res(ObjFile: ObjectFileRef) -> object_file_res {
pub fn object_file_res(ObjFile: ObjectFileRef) -> object_file_res {
object_file_res {
ObjectFile: ObjFile
}
}
type object_file = {llof: ObjectFileRef, dtor: @object_file_res};
pub type object_file = {llof: ObjectFileRef, dtor: @object_file_res};
fn mk_object_file(llmb: MemoryBufferRef) -> Option<object_file> {
pub fn mk_object_file(llmb: MemoryBufferRef) -> Option<object_file> {
unsafe {
let llof = llvm::LLVMCreateObjectFile(llmb);
if llof as int == 0 { return option::None::<object_file>; }
@@ -1492,7 +1563,7 @@ fn mk_object_file(llmb: MemoryBufferRef) -> Option<object_file> {
/* Memory-managed interface to section iterators. */
struct section_iter_res {
pub struct section_iter_res {
SI: SectionIteratorRef,
drop {
unsafe {
@@ -1501,15 +1572,15 @@ struct section_iter_res {
}
}
fn section_iter_res(SI: SectionIteratorRef) -> section_iter_res {
pub fn section_iter_res(SI: SectionIteratorRef) -> section_iter_res {
section_iter_res {
SI: SI
}
}
type section_iter = {llsi: SectionIteratorRef, dtor: @section_iter_res};
pub type section_iter = {llsi: SectionIteratorRef, dtor: @section_iter_res};
fn mk_section_iter(llof: ObjectFileRef) -> section_iter {
pub fn mk_section_iter(llof: ObjectFileRef) -> section_iter {
unsafe {
let llsi = llvm::LLVMGetSections(llof);
return {llsi: llsi, dtor: @section_iter_res(llsi)};
-15
View File
@@ -144,32 +144,20 @@ pub mod middle {
}
pub mod front {
#[legacy_exports]
pub mod config;
#[legacy_exports]
pub mod test;
#[legacy_exports]
pub mod core_inject;
#[legacy_exports]
pub mod intrinsic_inject;
}
pub mod back {
#[legacy_exports]
pub mod link;
#[legacy_exports]
pub mod abi;
#[legacy_exports]
pub mod upcall;
#[legacy_exports]
pub mod arm;
#[legacy_exports]
pub mod x86;
#[legacy_exports]
pub mod x86_64;
#[legacy_exports]
pub mod rpath;
#[legacy_exports]
pub mod target_strs;
}
@@ -180,14 +168,11 @@ pub mod metadata;
pub mod driver;
pub mod util {
#[legacy_exports]
pub mod common;
#[legacy_exports]
pub mod ppaux;
}
pub mod lib {
#[legacy_exports]
pub mod llvm;
}
+12 -12
View File
@@ -21,7 +21,7 @@
use core::vec;
use std::map::HashMap;
fn indent<R>(op: fn() -> R) -> R {
pub fn indent<R>(op: fn() -> R) -> R {
// Use in conjunction with the log post-processor like `src/etc/indenter`
// to make debug output more readable.
debug!(">>");
@@ -30,33 +30,33 @@ fn indent<R>(op: fn() -> R) -> R {
move r
}
struct _indenter {
pub struct _indenter {
_i: (),
drop { debug!("<<"); }
}
fn _indenter(_i: ()) -> _indenter {
pub fn _indenter(_i: ()) -> _indenter {
_indenter {
_i: ()
}
}
fn indenter() -> _indenter {
pub fn indenter() -> _indenter {
debug!(">>");
_indenter(())
}
type flag = HashMap<~str, ()>;
pub type flag = HashMap<~str, ()>;
fn field_expr(f: ast::field) -> @ast::expr { return f.node.expr; }
pub fn field_expr(f: ast::field) -> @ast::expr { return f.node.expr; }
fn field_exprs(fields: ~[ast::field]) -> ~[@ast::expr] {
pub fn field_exprs(fields: ~[ast::field]) -> ~[@ast::expr] {
fields.map(|f| f.node.expr)
}
// Takes a predicate p, returns true iff p is true for any subexpressions
// of b -- skipping any inner loops (loop, while, loop_body)
fn loop_query(b: ast::blk, p: fn@(ast::expr_) -> bool) -> bool {
pub fn loop_query(b: ast::blk, p: fn@(ast::expr_) -> bool) -> bool {
let rs = @mut false;
let visit_expr: @fn(@ast::expr,
&&flag: @mut bool,
@@ -79,7 +79,7 @@ fn loop_query(b: ast::blk, p: fn@(ast::expr_) -> bool) -> bool {
// Takes a predicate p, returns true iff p is true for any subexpressions
// of b -- skipping any inner loops (loop, while, loop_body)
fn block_query(b: ast::blk, p: fn@(@ast::expr) -> bool) -> bool {
pub fn block_query(b: ast::blk, p: fn@(@ast::expr) -> bool) -> bool {
let rs = @mut false;
let visit_expr: @fn(@ast::expr,
&&flag: @mut bool,
@@ -94,20 +94,20 @@ fn block_query(b: ast::blk, p: fn@(@ast::expr) -> bool) -> bool {
return *rs;
}
fn local_rhs_span(l: @ast::local, def: span) -> span {
pub fn local_rhs_span(l: @ast::local, def: span) -> span {
match l.node.init {
Some(i) => return i.span,
_ => return def
}
}
fn pluralize(n: uint, +s: ~str) -> ~str {
pub fn pluralize(n: uint, +s: ~str) -> ~str {
if n == 1 { s }
else { str::concat([s, ~"s"]) }
}
// A set of node IDs (used to keep track of which node IDs are for statements)
type stmt_set = HashMap<ast::node_id, ()>;
pub type stmt_set = HashMap<ast::node_id, ()>;
//
// Local Variables:
+30 -31
View File
@@ -38,10 +38,10 @@
use core::vec;
use std::map::HashMap;
fn note_and_explain_region(cx: ctxt,
prefix: ~str,
region: ty::Region,
suffix: ~str) {
pub fn note_and_explain_region(cx: ctxt,
prefix: ~str,
region: ty::Region,
suffix: ~str) {
match explain_region_and_span(cx, region) {
(ref str, Some(span)) => {
cx.sess.span_note(
@@ -57,15 +57,14 @@ fn note_and_explain_region(cx: ctxt,
/// Returns a string like "the block at 27:31" that attempts to explain a
/// lifetime in a way it might plausibly be understood.
fn explain_region(cx: ctxt, region: ty::Region) -> ~str {
pub fn explain_region(cx: ctxt, region: ty::Region) -> ~str {
let (res, _) = explain_region_and_span(cx, region);
return res;
}
fn explain_region_and_span(cx: ctxt, region: ty::Region)
-> (~str, Option<span>)
{
pub fn explain_region_and_span(cx: ctxt, region: ty::Region)
-> (~str, Option<span>) {
return match region {
re_scope(node_id) => {
match cx.items.find(node_id) {
@@ -136,12 +135,12 @@ fn explain_span(cx: ctxt, heading: &str, span: span)
}
}
fn bound_region_to_str(cx: ctxt, br: bound_region) -> ~str {
pub fn bound_region_to_str(cx: ctxt, br: bound_region) -> ~str {
bound_region_to_str_adorned(cx, "&", br, "")
}
fn bound_region_to_str_adorned(cx: ctxt, prefix: &str,
br: bound_region, sep: &str) -> ~str {
pub fn bound_region_to_str_adorned(cx: ctxt, prefix: &str,
br: bound_region, sep: &str) -> ~str {
if cx.sess.verbose() { return fmt!("%s%?%s", prefix, br, sep); }
match br {
@@ -154,7 +153,7 @@ fn bound_region_to_str_adorned(cx: ctxt, prefix: &str,
}
}
fn re_scope_id_to_str(cx: ctxt, node_id: ast::node_id) -> ~str {
pub fn re_scope_id_to_str(cx: ctxt, node_id: ast::node_id) -> ~str {
match cx.items.find(node_id) {
Some(ast_map::node_block(ref blk)) => {
fmt!("<block at %s>",
@@ -197,12 +196,12 @@ fn re_scope_id_to_str(cx: ctxt, node_id: ast::node_id) -> ~str {
// In general, if you are giving a region error message,
// you should use `explain_region()` or, better yet,
// `note_and_explain_region()`
fn region_to_str(cx: ctxt, region: Region) -> ~str {
pub fn region_to_str(cx: ctxt, region: Region) -> ~str {
region_to_str_adorned(cx, "&", region, "")
}
fn region_to_str_adorned(cx: ctxt, prefix: &str,
region: Region, sep: &str) -> ~str {
pub fn region_to_str_adorned(cx: ctxt, prefix: &str,
region: Region, sep: &str) -> ~str {
if cx.sess.verbose() {
return fmt!("%s%?%s", prefix, region, sep);
}
@@ -223,7 +222,7 @@ fn region_to_str_adorned(cx: ctxt, prefix: &str,
}
}
fn mt_to_str(cx: ctxt, m: mt) -> ~str {
pub fn mt_to_str(cx: ctxt, m: mt) -> ~str {
let mstr = match m.mutbl {
ast::m_mutbl => "mut ",
ast::m_imm => "",
@@ -232,7 +231,7 @@ fn mt_to_str(cx: ctxt, m: mt) -> ~str {
return fmt!("%s%s", mstr, ty_to_str(cx, m.ty));
}
fn vstore_to_str(cx: ctxt, vs: ty::vstore) -> ~str {
pub fn vstore_to_str(cx: ctxt, vs: ty::vstore) -> ~str {
match vs {
ty::vstore_fixed(n) => fmt!("%u", n),
ty::vstore_uniq => ~"~",
@@ -241,7 +240,7 @@ fn vstore_to_str(cx: ctxt, vs: ty::vstore) -> ~str {
}
}
fn vstore_ty_to_str(cx: ctxt, ty: ~str, vs: ty::vstore) -> ~str {
pub fn vstore_ty_to_str(cx: ctxt, ty: ~str, vs: ty::vstore) -> ~str {
match vs {
ty::vstore_fixed(_) => {
fmt!("%s/%s", ty, vstore_to_str(cx, vs))
@@ -253,8 +252,8 @@ fn vstore_ty_to_str(cx: ctxt, ty: ~str, vs: ty::vstore) -> ~str {
}
}
fn proto_ty_to_str(_cx: ctxt, proto: ast::Proto,
followed_by_word: bool) -> &static/str {
pub fn proto_ty_to_str(_cx: ctxt, proto: ast::Proto,
followed_by_word: bool) -> &static/str {
match proto {
ast::ProtoBare if followed_by_word => "extern ",
ast::ProtoBare => "extern",
@@ -264,34 +263,34 @@ fn proto_ty_to_str(_cx: ctxt, proto: ast::Proto,
}
}
fn expr_repr(cx: ctxt, expr: @ast::expr) -> ~str {
pub fn expr_repr(cx: ctxt, expr: @ast::expr) -> ~str {
fmt!("expr(%d: %s)",
expr.id,
pprust::expr_to_str(expr, cx.sess.intr()))
}
fn pat_repr(cx: ctxt, pat: @ast::pat) -> ~str {
pub fn pat_repr(cx: ctxt, pat: @ast::pat) -> ~str {
fmt!("pat(%d: %s)",
pat.id,
pprust::pat_to_str(pat, cx.sess.intr()))
}
fn tys_to_str(cx: ctxt, ts: &[t]) -> ~str {
pub fn tys_to_str(cx: ctxt, ts: &[t]) -> ~str {
let tstrs = ts.map(|t| ty_to_str(cx, *t));
fmt!("(%s)", str::connect(tstrs, ", "))
}
fn bound_to_str(cx: ctxt, b: param_bound) -> ~str {
pub fn bound_to_str(cx: ctxt, b: param_bound) -> ~str {
ty::param_bound_to_str(cx, &b)
}
fn fn_sig_to_str(cx: ctxt, typ: &ty::FnSig) -> ~str {
pub fn fn_sig_to_str(cx: ctxt, typ: &ty::FnSig) -> ~str {
fmt!("fn%s -> %s",
tys_to_str(cx, typ.inputs.map(|a| a.ty)),
ty_to_str(cx, typ.output))
}
fn ty_to_str(cx: ctxt, typ: t) -> ~str {
pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
fn fn_input_to_str(cx: ctxt, input: ty::arg) -> ~str {
let ty::arg {mode: mode, ty: ty} = input;
let modestr = match canon_mode(cx, mode) {
@@ -449,10 +448,10 @@ fn field_to_str(cx: ctxt, f: field) -> ~str {
}
}
fn parameterized(cx: ctxt,
base: &str,
self_r: Option<ty::Region>,
tps: &[ty::t]) -> ~str {
pub fn parameterized(cx: ctxt,
base: &str,
self_r: Option<ty::Region>,
tps: &[ty::t]) -> ~str {
let r_str = match self_r {
None => ~"",
@@ -469,7 +468,7 @@ fn parameterized(cx: ctxt,
}
}
fn ty_to_short_str(cx: ctxt, typ: t) -> ~str {
pub fn ty_to_short_str(cx: ctxt, typ: t) -> ~str {
let mut s = encoder::encoded_ty(cx, typ);
if str::len(s) >= 32u { s = str::slice(s, 0u, 32u); }
return s;