diff options
Diffstat (limited to 'src/librustc_codegen_llvm/llvm/ffi.rs')
| -rw-r--r-- | src/librustc_codegen_llvm/llvm/ffi.rs | 84 | 
1 files changed, 69 insertions, 15 deletions
| diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs index f56647044e0..aeb34e5c9c9 100644 --- a/src/librustc_codegen_llvm/llvm/ffi.rs +++ b/src/librustc_codegen_llvm/llvm/ffi.rs @@ -73,6 +73,14 @@ pub enum Visibility { Protected = 2, } +/// LLVMUnnamedAddr +#[repr(C)] +pub enum UnnamedAddr { + No, + Local, + Global, +} + /// LLVMDLLStorageClass #[derive(Copy, Clone)] #[repr(C)] @@ -381,10 +389,10 @@ pub enum AsmDialect { } impl AsmDialect { - pub fn from_generic(asm: rustc_ast::ast::AsmDialect) -> Self { + pub fn from_generic(asm: rustc_ast::ast::LlvmAsmDialect) -> Self { match asm { - rustc_ast::ast::AsmDialect::Att => AsmDialect::Att, - rustc_ast::ast::AsmDialect::Intel => AsmDialect::Intel, + rustc_ast::ast::LlvmAsmDialect::Att => AsmDialect::Att, + rustc_ast::ast::LlvmAsmDialect::Intel => AsmDialect::Intel, } } } @@ -538,6 +546,15 @@ pub enum ThreadLocalMode { LocalExec, } +/// LLVMRustChecksumKind +#[derive(Copy, Clone)] +#[repr(C)] +pub enum ChecksumKind { + None, + MD5, + SHA1, +} + extern "C" { type Opaque; } @@ -694,8 +711,8 @@ pub mod debuginfo { } impl DebugEmissionKind { - pub fn from_generic(kind: rustc::session::config::DebugInfo) -> Self { - use rustc::session::config::DebugInfo; + pub fn from_generic(kind: rustc_session::config::DebugInfo) -> Self { + use rustc_session::config::DebugInfo; match kind { DebugInfo::None => DebugEmissionKind::NoDebug, DebugInfo::Limited => DebugEmissionKind::LineTablesOnly, @@ -727,12 +744,12 @@ extern "C" { pub fn LLVMCloneModule(M: &Module) -> &Module; /// Data layout. See Module::getDataLayout. - pub fn LLVMGetDataLayout(M: &Module) -> *const c_char; + pub fn LLVMGetDataLayoutStr(M: &Module) -> *const c_char; pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char); /// See Module::setModuleInlineAsm. - pub fn LLVMSetModuleInlineAsm(M: &Module, Asm: *const c_char); - pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char); + pub fn LLVMSetModuleInlineAsm2(M: &Module, Asm: *const c_char, AsmLen: size_t); + pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char, AsmLen: size_t); /// See llvm::LLVMTypeKind::getTypeID. pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind; @@ -879,13 +896,18 @@ extern "C" { pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode); pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool; pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool); - pub fn LLVMRustGetNamedValue(M: &Module, Name: *const c_char) -> Option<&Value>; + pub fn LLVMRustGetNamedValue( + M: &Module, + Name: *const c_char, + NameLen: size_t, + ) -> Option<&Value>; pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool); // Operations on functions pub fn LLVMRustGetOrInsertFunction( M: &'a Module, Name: *const c_char, + NameLen: size_t, FunctionTy: &'a Type, ) -> &'a Value; pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint); @@ -1332,7 +1354,6 @@ extern "C" { Args: *const &'a Value, NumArgs: c_uint, Bundle: Option<&OperandBundleDef<'a>>, - Name: *const c_char, ) -> &'a Value; pub fn LLVMRustBuildMemCpy( B: &Builder<'a>, @@ -1581,12 +1602,18 @@ extern "C" { pub fn LLVMRustInlineAsm( Ty: &Type, AsmString: *const c_char, + AsmStringLen: size_t, Constraints: *const c_char, + ConstraintsLen: size_t, SideEffects: Bool, AlignStack: Bool, Dialect: AsmDialect, ) -> &Value; - pub fn LLVMRustInlineAsmVerify(Ty: &Type, Constraints: *const c_char) -> bool; + pub fn LLVMRustInlineAsmVerify( + Ty: &Type, + Constraints: *const c_char, + ConstraintsLen: size_t, + ) -> bool; pub fn LLVMRustDebugMetadataVersion() -> u32; pub fn LLVMRustVersionMajor() -> u32; @@ -1607,17 +1634,24 @@ extern "C" { Lang: c_uint, File: &'a DIFile, Producer: *const c_char, + ProducerLen: size_t, isOptimized: bool, Flags: *const c_char, RuntimeVer: c_uint, SplitName: *const c_char, + SplitNameLen: size_t, kind: DebugEmissionKind, ) -> &'a DIDescriptor; pub fn LLVMRustDIBuilderCreateFile( Builder: &DIBuilder<'a>, Filename: *const c_char, + FilenameLen: size_t, Directory: *const c_char, + DirectoryLen: size_t, + CSKind: ChecksumKind, + Checksum: *const c_char, + ChecksumLen: size_t, ) -> &'a DIFile; pub fn LLVMRustDIBuilderCreateSubroutineType( @@ -1630,7 +1664,9 @@ extern "C" { Builder: &DIBuilder<'a>, Scope: &'a DIDescriptor, Name: *const c_char, + NameLen: size_t, LinkageName: *const c_char, + LinkageNameLen: size_t, File: &'a DIFile, LineNo: c_uint, Ty: &'a DIType, @@ -1645,6 +1681,7 @@ extern "C" { pub fn LLVMRustDIBuilderCreateBasicType( Builder: &DIBuilder<'a>, Name: *const c_char, + NameLen: size_t, SizeInBits: u64, AlignInBits: u32, Encoding: c_uint, @@ -1655,13 +1692,16 @@ extern "C" { PointeeTy: &'a DIType, SizeInBits: u64, AlignInBits: u32, + AddressSpace: c_uint, Name: *const c_char, + NameLen: size_t, ) -> &'a DIDerivedType; pub fn LLVMRustDIBuilderCreateStructType( Builder: &DIBuilder<'a>, Scope: Option<&'a DIDescriptor>, Name: *const c_char, + NameLen: size_t, File: &'a DIFile, LineNumber: c_uint, SizeInBits: u64, @@ -1672,12 +1712,14 @@ extern "C" { RunTimeLang: c_uint, VTableHolder: Option<&'a DIType>, UniqueId: *const c_char, + UniqueIdLen: size_t, ) -> &'a DICompositeType; pub fn LLVMRustDIBuilderCreateMemberType( Builder: &DIBuilder<'a>, Scope: &'a DIDescriptor, Name: *const c_char, + NameLen: size_t, File: &'a DIFile, LineNo: c_uint, SizeInBits: u64, @@ -1691,6 +1733,7 @@ extern "C" { Builder: &DIBuilder<'a>, Scope: &'a DIScope, Name: *const c_char, + NameLen: size_t, File: &'a DIFile, LineNumber: c_uint, SizeInBits: u64, @@ -1719,7 +1762,9 @@ extern "C" { Builder: &DIBuilder<'a>, Context: Option<&'a DIScope>, Name: *const c_char, + NameLen: size_t, LinkageName: *const c_char, + LinkageNameLen: size_t, File: &'a DIFile, LineNo: c_uint, Ty: &'a DIType, @@ -1734,6 +1779,7 @@ extern "C" { Tag: c_uint, Scope: &'a DIDescriptor, Name: *const c_char, + NameLen: size_t, File: &'a DIFile, LineNo: c_uint, Ty: &'a DIType, @@ -1776,13 +1822,16 @@ extern "C" { pub fn LLVMRustDIBuilderCreateEnumerator( Builder: &DIBuilder<'a>, Name: *const c_char, - Val: u64, + NameLen: size_t, + Value: i64, + IsUnsigned: bool, ) -> &'a DIEnumerator; pub fn LLVMRustDIBuilderCreateEnumerationType( Builder: &DIBuilder<'a>, Scope: &'a DIScope, Name: *const c_char, + NameLen: size_t, File: &'a DIFile, LineNumber: c_uint, SizeInBits: u64, @@ -1796,6 +1845,7 @@ extern "C" { Builder: &DIBuilder<'a>, Scope: &'a DIScope, Name: *const c_char, + NameLen: size_t, File: &'a DIFile, LineNumber: c_uint, SizeInBits: u64, @@ -1804,12 +1854,14 @@ extern "C" { Elements: Option<&'a DIArray>, RunTimeLang: c_uint, UniqueId: *const c_char, + UniqueIdLen: size_t, ) -> &'a DIType; pub fn LLVMRustDIBuilderCreateVariantPart( Builder: &DIBuilder<'a>, Scope: &'a DIScope, Name: *const c_char, + NameLen: size_t, File: &'a DIFile, LineNo: c_uint, SizeInBits: u64, @@ -1818,14 +1870,16 @@ extern "C" { Discriminator: Option<&'a DIDerivedType>, Elements: &'a DIArray, UniqueId: *const c_char, + UniqueIdLen: size_t, ) -> &'a DIDerivedType; - pub fn LLVMSetUnnamedAddr(GlobalVar: &Value, UnnamedAddr: Bool); + pub fn LLVMSetUnnamedAddress(Global: &Value, UnnamedAddr: UnnamedAddr); pub fn LLVMRustDIBuilderCreateTemplateTypeParameter( Builder: &DIBuilder<'a>, Scope: Option<&'a DIScope>, Name: *const c_char, + NameLen: size_t, Ty: &'a DIType, File: &'a DIFile, LineNo: c_uint, @@ -1836,8 +1890,8 @@ extern "C" { Builder: &DIBuilder<'a>, Scope: Option<&'a DIScope>, Name: *const c_char, - File: &'a DIFile, - LineNo: c_uint, + NameLen: size_t, + ExportSymbols: bool, ) -> &'a DINameSpace; pub fn LLVMRustDICompositeTypeReplaceArrays( | 
