Use ctypes in native function declarations
This commit is contained in:
parent
f03eb96f39
commit
dde41869ce
|
@ -1,4 +1,4 @@
|
||||||
|
import core::ctypes::{c_int, c_uint};
|
||||||
import driver::session;
|
import driver::session;
|
||||||
import session::session;
|
import session::session;
|
||||||
import lib::llvm::llvm;
|
import lib::llvm::llvm;
|
||||||
|
@ -170,24 +170,25 @@ mod write {
|
||||||
llvm::LLVMAddTargetData(td.lltd, fpm.llpm);
|
llvm::LLVMAddTargetData(td.lltd, fpm.llpm);
|
||||||
|
|
||||||
let FPMB = llvm::LLVMPassManagerBuilderCreate();
|
let FPMB = llvm::LLVMPassManagerBuilderCreate();
|
||||||
llvm::LLVMPassManagerBuilderSetOptLevel(FPMB, 2u);
|
llvm::LLVMPassManagerBuilderSetOptLevel(FPMB, 2u32);
|
||||||
llvm::LLVMPassManagerBuilderPopulateFunctionPassManager(FPMB,
|
llvm::LLVMPassManagerBuilderPopulateFunctionPassManager(FPMB,
|
||||||
fpm.llpm);
|
fpm.llpm);
|
||||||
llvm::LLVMPassManagerBuilderDispose(FPMB);
|
llvm::LLVMPassManagerBuilderDispose(FPMB);
|
||||||
|
|
||||||
llvm::LLVMRunPassManager(fpm.llpm, llmod);
|
llvm::LLVMRunPassManager(fpm.llpm, llmod);
|
||||||
let threshold: uint = 225u;
|
let threshold = 225u as c_uint;
|
||||||
if opts.optimize == 3u { threshold = 275u; }
|
if opts.optimize == 3u { threshold = 275u as c_uint; }
|
||||||
|
|
||||||
let MPMB = llvm::LLVMPassManagerBuilderCreate();
|
let MPMB = llvm::LLVMPassManagerBuilderCreate();
|
||||||
llvm::LLVMPassManagerBuilderSetOptLevel(MPMB, opts.optimize);
|
llvm::LLVMPassManagerBuilderSetOptLevel(MPMB,
|
||||||
|
opts.optimize as u32);
|
||||||
llvm::LLVMPassManagerBuilderSetSizeLevel(MPMB, 0);
|
llvm::LLVMPassManagerBuilderSetSizeLevel(MPMB, 0);
|
||||||
llvm::LLVMPassManagerBuilderSetDisableUnitAtATime(MPMB, False);
|
llvm::LLVMPassManagerBuilderSetDisableUnitAtATime(MPMB, False);
|
||||||
llvm::LLVMPassManagerBuilderSetDisableUnrollLoops(MPMB, False);
|
llvm::LLVMPassManagerBuilderSetDisableUnrollLoops(MPMB, False);
|
||||||
llvm::LLVMPassManagerBuilderSetDisableSimplifyLibCalls(MPMB,
|
llvm::LLVMPassManagerBuilderSetDisableSimplifyLibCalls(MPMB,
|
||||||
False);
|
False);
|
||||||
|
|
||||||
if threshold != 0u {
|
if threshold != 0u32 {
|
||||||
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold
|
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold
|
||||||
(MPMB, threshold);
|
(MPMB, threshold);
|
||||||
}
|
}
|
||||||
|
@ -198,12 +199,12 @@ mod write {
|
||||||
}
|
}
|
||||||
if opts.verify { llvm::LLVMAddVerifierPass(pm.llpm); }
|
if opts.verify { llvm::LLVMAddVerifierPass(pm.llpm); }
|
||||||
if is_object_or_assembly_or_exe(opts.output_type) {
|
if is_object_or_assembly_or_exe(opts.output_type) {
|
||||||
let LLVMAssemblyFile: int = 0;
|
let LLVMAssemblyFile = 0 as c_int;
|
||||||
let LLVMObjectFile: int = 1;
|
let LLVMObjectFile = 1 as c_int;
|
||||||
let LLVMOptNone: int = 0; // -O0
|
let LLVMOptNone = 0 as c_int; // -O0
|
||||||
let LLVMOptLess: int = 1; // -O1
|
let LLVMOptLess = 1 as c_int; // -O1
|
||||||
let LLVMOptDefault: int = 2; // -O2, -Os
|
let LLVMOptDefault = 2 as c_int; // -O2, -Os
|
||||||
let LLVMOptAggressive: int = 3; // -O3
|
let LLVMOptAggressive = 3 as c_int; // -O3
|
||||||
|
|
||||||
let CodeGenOptLevel;
|
let CodeGenOptLevel;
|
||||||
alt opts.optimize {
|
alt opts.optimize {
|
||||||
|
|
|
@ -4,9 +4,8 @@ import str::sbuf;
|
||||||
import llvm::{TypeRef, MemoryBufferRef,
|
import llvm::{TypeRef, MemoryBufferRef,
|
||||||
PassManagerRef, TargetDataRef,
|
PassManagerRef, TargetDataRef,
|
||||||
ObjectFileRef, SectionIteratorRef};
|
ObjectFileRef, SectionIteratorRef};
|
||||||
|
import ctypes::{c_int, c_uint, unsigned, longlong, ulonglong};
|
||||||
|
|
||||||
type ULongLong = u64;
|
|
||||||
type LongLong = i64;
|
|
||||||
type Long = i32;
|
type Long = i32;
|
||||||
type Bool = int;
|
type Bool = int;
|
||||||
|
|
||||||
|
@ -141,9 +140,9 @@ native mod llvm {
|
||||||
fn LLVMContextCreate() -> ContextRef;
|
fn LLVMContextCreate() -> ContextRef;
|
||||||
fn LLVMGetGlobalContext() -> ContextRef;
|
fn LLVMGetGlobalContext() -> ContextRef;
|
||||||
fn LLVMContextDispose(C: ContextRef);
|
fn LLVMContextDispose(C: ContextRef);
|
||||||
fn LLVMGetMDKindIDInContext(C: ContextRef, Name: sbuf, SLen: uint) ->
|
fn LLVMGetMDKindIDInContext(C: ContextRef, Name: sbuf, SLen: unsigned) ->
|
||||||
uint;
|
unsigned;
|
||||||
fn LLVMGetMDKindID(Name: sbuf, SLen: uint) -> uint;
|
fn LLVMGetMDKindID(Name: sbuf, SLen: unsigned) -> unsigned;
|
||||||
|
|
||||||
/* Create and destroy modules. */
|
/* Create and destroy modules. */
|
||||||
fn LLVMModuleCreateWithNameInContext(ModuleID: sbuf, C: ContextRef) ->
|
fn LLVMModuleCreateWithNameInContext(ModuleID: sbuf, C: ContextRef) ->
|
||||||
|
@ -170,7 +169,7 @@ native mod llvm {
|
||||||
// we directly inspect the values, and casting from
|
// we directly inspect the values, and casting from
|
||||||
// a native doesn't work yet (only *to* a native).
|
// a native doesn't work yet (only *to* a native).
|
||||||
|
|
||||||
fn LLVMGetTypeKind(Ty: TypeRef) -> int;
|
fn LLVMGetTypeKind(Ty: TypeRef) -> c_int;
|
||||||
|
|
||||||
/** See llvm::LLVMType::getContext. */
|
/** See llvm::LLVMType::getContext. */
|
||||||
fn LLVMGetTypeContext(Ty: TypeRef) -> ContextRef;
|
fn LLVMGetTypeContext(Ty: TypeRef) -> ContextRef;
|
||||||
|
@ -181,15 +180,15 @@ native mod llvm {
|
||||||
fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef;
|
fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef;
|
||||||
fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef;
|
fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef;
|
||||||
fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef;
|
fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef;
|
||||||
fn LLVMIntTypeInContext(C: ContextRef, NumBits: uint) -> TypeRef;
|
fn LLVMIntTypeInContext(C: ContextRef, NumBits: unsigned) -> TypeRef;
|
||||||
|
|
||||||
fn LLVMInt1Type() -> TypeRef;
|
fn LLVMInt1Type() -> TypeRef;
|
||||||
fn LLVMInt8Type() -> TypeRef;
|
fn LLVMInt8Type() -> TypeRef;
|
||||||
fn LLVMInt16Type() -> TypeRef;
|
fn LLVMInt16Type() -> TypeRef;
|
||||||
fn LLVMInt32Type() -> TypeRef;
|
fn LLVMInt32Type() -> TypeRef;
|
||||||
fn LLVMInt64Type() -> TypeRef;
|
fn LLVMInt64Type() -> TypeRef;
|
||||||
fn LLVMIntType(NumBits: uint) -> TypeRef;
|
fn LLVMIntType(NumBits: unsigned) -> TypeRef;
|
||||||
fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> uint;
|
fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> unsigned;
|
||||||
|
|
||||||
/* Operations on real types */
|
/* Operations on real types */
|
||||||
fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef;
|
fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef;
|
||||||
|
@ -206,30 +205,34 @@ native mod llvm {
|
||||||
|
|
||||||
/* Operations on function types */
|
/* Operations on function types */
|
||||||
fn LLVMFunctionType(ReturnType: TypeRef, ParamTypes: *TypeRef,
|
fn LLVMFunctionType(ReturnType: TypeRef, ParamTypes: *TypeRef,
|
||||||
ParamCount: uint, IsVarArg: Bool) -> TypeRef;
|
ParamCount: unsigned, IsVarArg: Bool) -> TypeRef;
|
||||||
fn LLVMIsFunctionVarArg(FunctionTy: TypeRef) -> Bool;
|
fn LLVMIsFunctionVarArg(FunctionTy: TypeRef) -> Bool;
|
||||||
fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
|
fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
|
||||||
fn LLVMCountParamTypes(FunctionTy: TypeRef) -> uint;
|
fn LLVMCountParamTypes(FunctionTy: TypeRef) -> unsigned;
|
||||||
fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *TypeRef);
|
fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *TypeRef);
|
||||||
|
|
||||||
/* Operations on struct types */
|
/* Operations on struct types */
|
||||||
fn LLVMStructTypeInContext(C: ContextRef, ElementTypes: *TypeRef,
|
fn LLVMStructTypeInContext(C: ContextRef, ElementTypes: *TypeRef,
|
||||||
ElementCount: uint, Packed: Bool) -> TypeRef;
|
ElementCount: unsigned,
|
||||||
fn LLVMStructType(ElementTypes: *TypeRef, ElementCount: uint,
|
Packed: Bool) -> TypeRef;
|
||||||
|
fn LLVMStructType(ElementTypes: *TypeRef, ElementCount: unsigned,
|
||||||
Packed: Bool) -> TypeRef;
|
Packed: Bool) -> TypeRef;
|
||||||
fn LLVMCountStructElementTypes(StructTy: TypeRef) -> uint;
|
fn LLVMCountStructElementTypes(StructTy: TypeRef) -> unsigned;
|
||||||
fn LLVMGetStructElementTypes(StructTy: TypeRef, Dest: *TypeRef);
|
fn LLVMGetStructElementTypes(StructTy: TypeRef, Dest: *TypeRef);
|
||||||
fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
|
fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
|
||||||
|
|
||||||
/* Operations on array, pointer, and vector types (sequence types) */
|
/* Operations on array, pointer, and vector types (sequence types) */
|
||||||
fn LLVMArrayType(ElementType: TypeRef, ElementCount: uint) -> TypeRef;
|
fn LLVMArrayType(ElementType: TypeRef,
|
||||||
fn LLVMPointerType(ElementType: TypeRef, AddressSpace: uint) -> TypeRef;
|
ElementCount: unsigned) -> TypeRef;
|
||||||
fn LLVMVectorType(ElementType: TypeRef, ElementCount: uint) -> TypeRef;
|
fn LLVMPointerType(ElementType: TypeRef,
|
||||||
|
AddressSpace: unsigned) -> TypeRef;
|
||||||
|
fn LLVMVectorType(ElementType: TypeRef,
|
||||||
|
ElementCount: unsigned) -> TypeRef;
|
||||||
|
|
||||||
fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
|
fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
|
||||||
fn LLVMGetArrayLength(ArrayTy: TypeRef) -> uint;
|
fn LLVMGetArrayLength(ArrayTy: TypeRef) -> unsigned;
|
||||||
fn LLVMGetPointerAddressSpace(PointerTy: TypeRef) -> uint;
|
fn LLVMGetPointerAddressSpace(PointerTy: TypeRef) -> unsigned;
|
||||||
fn LLVMGetVectorSize(VectorTy: TypeRef) -> uint;
|
fn LLVMGetVectorSize(VectorTy: TypeRef) -> unsigned;
|
||||||
|
|
||||||
/* Operations on other types */
|
/* Operations on other types */
|
||||||
fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
|
fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
|
||||||
|
@ -246,9 +249,9 @@ native mod llvm {
|
||||||
fn LLVMSetValueName(Val: ValueRef, Name: sbuf);
|
fn LLVMSetValueName(Val: ValueRef, Name: sbuf);
|
||||||
fn LLVMDumpValue(Val: ValueRef);
|
fn LLVMDumpValue(Val: ValueRef);
|
||||||
fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
|
fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
|
||||||
fn LLVMHasMetadata(Val: ValueRef) -> int;
|
fn LLVMHasMetadata(Val: ValueRef) -> c_int;
|
||||||
fn LLVMGetMetadata(Val: ValueRef, KindID: uint) -> ValueRef;
|
fn LLVMGetMetadata(Val: ValueRef, KindID: unsigned) -> ValueRef;
|
||||||
fn LLVMSetMetadata(Val: ValueRef, KindID: uint, Node: ValueRef);
|
fn LLVMSetMetadata(Val: ValueRef, KindID: unsigned, Node: ValueRef);
|
||||||
|
|
||||||
/* Operations on Uses */
|
/* Operations on Uses */
|
||||||
fn LLVMGetFirstUse(Val: ValueRef) -> UseRef;
|
fn LLVMGetFirstUse(Val: ValueRef) -> UseRef;
|
||||||
|
@ -257,8 +260,8 @@ native mod llvm {
|
||||||
fn LLVMGetUsedValue(U: UseRef) -> ValueRef;
|
fn LLVMGetUsedValue(U: UseRef) -> ValueRef;
|
||||||
|
|
||||||
/* Operations on Users */
|
/* Operations on Users */
|
||||||
fn LLVMGetOperand(Val: ValueRef, Index: uint) -> ValueRef;
|
fn LLVMGetOperand(Val: ValueRef, Index: unsigned) -> ValueRef;
|
||||||
fn LLVMSetOperand(Val: ValueRef, Index: uint, Op: ValueRef);
|
fn LLVMSetOperand(Val: ValueRef, Index: unsigned, Op: ValueRef);
|
||||||
|
|
||||||
/* Operations on constants of any type */
|
/* Operations on constants of any type */
|
||||||
fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
|
fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
|
||||||
|
@ -272,45 +275,46 @@ native mod llvm {
|
||||||
fn LLVMConstPointerNull(Ty: TypeRef) -> ValueRef;
|
fn LLVMConstPointerNull(Ty: TypeRef) -> ValueRef;
|
||||||
|
|
||||||
/* Operations on metadata */
|
/* Operations on metadata */
|
||||||
fn LLVMMDStringInContext(C: ContextRef, Str: sbuf, SLen: uint) ->
|
fn LLVMMDStringInContext(C: ContextRef, Str: sbuf, SLen: unsigned) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
fn LLVMMDString(Str: sbuf, SLen: uint) -> ValueRef;
|
fn LLVMMDString(Str: sbuf, SLen: unsigned) -> ValueRef;
|
||||||
fn LLVMMDNodeInContext(C: ContextRef, Vals: *ValueRef, Count: uint) ->
|
fn LLVMMDNodeInContext(C: ContextRef, Vals: *ValueRef, Count: unsigned) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
fn LLVMMDNode(Vals: *ValueRef, Count: uint) -> ValueRef;
|
fn LLVMMDNode(Vals: *ValueRef, Count: unsigned) -> ValueRef;
|
||||||
fn LLVMAddNamedMetadataOperand(M: ModuleRef, Str: sbuf,
|
fn LLVMAddNamedMetadataOperand(M: ModuleRef, Str: sbuf,
|
||||||
Val: ValueRef);
|
Val: ValueRef);
|
||||||
|
|
||||||
/* Operations on scalar constants */
|
/* Operations on scalar constants */
|
||||||
fn LLVMConstInt(IntTy: TypeRef, N: ULongLong, SignExtend: Bool) ->
|
fn LLVMConstInt(IntTy: TypeRef, N: ulonglong, SignExtend: Bool) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
// FIXME: radix is actually u8, but our native layer can't handle this
|
// FIXME: radix is actually u8, but our native layer can't handle this
|
||||||
// yet. lucky for us we're little-endian. Small miracles.
|
// yet. lucky for us we're little-endian. Small miracles.
|
||||||
fn LLVMConstIntOfString(IntTy: TypeRef, Text: sbuf, Radix: int) ->
|
fn LLVMConstIntOfString(IntTy: TypeRef, Text: sbuf, Radix: c_int) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
fn LLVMConstIntOfStringAndSize(IntTy: TypeRef, Text: sbuf, SLen: uint,
|
fn LLVMConstIntOfStringAndSize(IntTy: TypeRef, Text: sbuf, SLen: unsigned,
|
||||||
Radix: u8) -> ValueRef;
|
Radix: u8) -> ValueRef;
|
||||||
fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
|
fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
|
||||||
fn LLVMConstRealOfString(RealTy: TypeRef, Text: sbuf) -> ValueRef;
|
fn LLVMConstRealOfString(RealTy: TypeRef, Text: sbuf) -> ValueRef;
|
||||||
fn LLVMConstRealOfStringAndSize(RealTy: TypeRef, Text: sbuf, SLen: uint)
|
fn LLVMConstRealOfStringAndSize(RealTy: TypeRef, Text: sbuf,
|
||||||
-> ValueRef;
|
SLen: unsigned) -> ValueRef;
|
||||||
fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> ULongLong;
|
fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> ulonglong;
|
||||||
fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> LongLong;
|
fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> longlong;
|
||||||
|
|
||||||
|
|
||||||
/* Operations on composite constants */
|
/* Operations on composite constants */
|
||||||
fn LLVMConstStringInContext(C: ContextRef, Str: sbuf, Length: uint,
|
fn LLVMConstStringInContext(C: ContextRef, Str: sbuf, Length: unsigned,
|
||||||
DontNullTerminate: Bool) -> ValueRef;
|
DontNullTerminate: Bool) -> ValueRef;
|
||||||
fn LLVMConstStructInContext(C: ContextRef, ConstantVals: *ValueRef,
|
fn LLVMConstStructInContext(C: ContextRef, ConstantVals: *ValueRef,
|
||||||
Count: uint, Packed: Bool) -> ValueRef;
|
Count: unsigned, Packed: Bool) -> ValueRef;
|
||||||
|
|
||||||
fn LLVMConstString(Str: sbuf, Length: uint, DontNullTerminate: Bool) ->
|
fn LLVMConstString(Str: sbuf, Length: unsigned,
|
||||||
ValueRef;
|
DontNullTerminate: Bool) -> ValueRef;
|
||||||
fn LLVMConstArray(ElementTy: TypeRef, ConstantVals: *ValueRef,
|
fn LLVMConstArray(ElementTy: TypeRef, ConstantVals: *ValueRef,
|
||||||
Length: uint) -> ValueRef;
|
Length: unsigned) -> ValueRef;
|
||||||
fn LLVMConstStruct(ConstantVals: *ValueRef, Count: uint, Packed: Bool) ->
|
fn LLVMConstStruct(ConstantVals: *ValueRef,
|
||||||
ValueRef;
|
Count: unsigned, Packed: Bool) -> ValueRef;
|
||||||
fn LLVMConstVector(ScalarConstantVals: *ValueRef, Size: uint) -> ValueRef;
|
fn LLVMConstVector(ScalarConstantVals: *ValueRef,
|
||||||
|
Size: unsigned) -> ValueRef;
|
||||||
|
|
||||||
/* Constant expressions */
|
/* Constant expressions */
|
||||||
fn LLVMAlignOf(Ty: TypeRef) -> ValueRef;
|
fn LLVMAlignOf(Ty: TypeRef) -> ValueRef;
|
||||||
|
@ -364,9 +368,9 @@ native mod llvm {
|
||||||
fn LLVMConstAShr(LHSConstant: ValueRef, RHSConstant: ValueRef) ->
|
fn LLVMConstAShr(LHSConstant: ValueRef, RHSConstant: ValueRef) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
fn LLVMConstGEP(ConstantVal: ValueRef, ConstantIndices: *uint,
|
fn LLVMConstGEP(ConstantVal: ValueRef, ConstantIndices: *uint,
|
||||||
NumIndices: uint) -> ValueRef;
|
NumIndices: unsigned) -> ValueRef;
|
||||||
fn LLVMConstInBoundsGEP(ConstantVal: ValueRef, ConstantIndices: *uint,
|
fn LLVMConstInBoundsGEP(ConstantVal: ValueRef, ConstantIndices: *uint,
|
||||||
NumIndices: uint) -> ValueRef;
|
NumIndices: unsigned) -> ValueRef;
|
||||||
fn LLVMConstTrunc(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
|
fn LLVMConstTrunc(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
|
||||||
fn LLVMConstSExt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
|
fn LLVMConstSExt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
|
||||||
fn LLVMConstZExt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
|
fn LLVMConstZExt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
|
||||||
|
@ -401,10 +405,10 @@ native mod llvm {
|
||||||
VectorBConstant: ValueRef,
|
VectorBConstant: ValueRef,
|
||||||
MaskConstant: ValueRef) -> ValueRef;
|
MaskConstant: ValueRef) -> ValueRef;
|
||||||
fn LLVMConstExtractValue(AggConstant: ValueRef, IdxList: *uint,
|
fn LLVMConstExtractValue(AggConstant: ValueRef, IdxList: *uint,
|
||||||
NumIdx: uint) -> ValueRef;
|
NumIdx: unsigned) -> ValueRef;
|
||||||
fn LLVMConstInsertValue(AggConstant: ValueRef,
|
fn LLVMConstInsertValue(AggConstant: ValueRef,
|
||||||
ElementValueConstant: ValueRef, IdxList: *uint,
|
ElementValueConstant: ValueRef, IdxList: *uint,
|
||||||
NumIdx: uint) -> ValueRef;
|
NumIdx: unsigned) -> ValueRef;
|
||||||
fn LLVMConstInlineAsm(Ty: TypeRef, AsmString: sbuf, Constraints: sbuf,
|
fn LLVMConstInlineAsm(Ty: TypeRef, AsmString: sbuf, Constraints: sbuf,
|
||||||
HasSideEffects: Bool, IsAlignStack: Bool) ->
|
HasSideEffects: Bool, IsAlignStack: Bool) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
|
@ -421,14 +425,14 @@ native mod llvm {
|
||||||
fn LLVMSetSection(Global: ValueRef, Section: sbuf);
|
fn LLVMSetSection(Global: ValueRef, Section: sbuf);
|
||||||
fn LLVMGetVisibility(Global: ValueRef) -> Visibility;
|
fn LLVMGetVisibility(Global: ValueRef) -> Visibility;
|
||||||
fn LLVMSetVisibility(Global: ValueRef, Viz: Visibility);
|
fn LLVMSetVisibility(Global: ValueRef, Viz: Visibility);
|
||||||
fn LLVMGetAlignment(Global: ValueRef) -> uint;
|
fn LLVMGetAlignment(Global: ValueRef) -> unsigned;
|
||||||
fn LLVMSetAlignment(Global: ValueRef, Bytes: uint);
|
fn LLVMSetAlignment(Global: ValueRef, Bytes: unsigned);
|
||||||
|
|
||||||
|
|
||||||
/* Operations on global variables */
|
/* Operations on global variables */
|
||||||
fn LLVMAddGlobal(M: ModuleRef, Ty: TypeRef, Name: sbuf) -> ValueRef;
|
fn LLVMAddGlobal(M: ModuleRef, Ty: TypeRef, Name: sbuf) -> ValueRef;
|
||||||
fn LLVMAddGlobalInAddressSpace(M: ModuleRef, Ty: TypeRef, Name: sbuf,
|
fn LLVMAddGlobalInAddressSpace(M: ModuleRef, Ty: TypeRef, Name: sbuf,
|
||||||
AddressSpace: uint) -> ValueRef;
|
AddressSpace: unsigned) -> ValueRef;
|
||||||
fn LLVMGetNamedGlobal(M: ModuleRef, Name: sbuf) -> ValueRef;
|
fn LLVMGetNamedGlobal(M: ModuleRef, Name: sbuf) -> ValueRef;
|
||||||
fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
|
fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
|
||||||
fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef;
|
fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef;
|
||||||
|
@ -457,19 +461,19 @@ native mod llvm {
|
||||||
fn LLVMDeleteFunction(Fn: ValueRef);
|
fn LLVMDeleteFunction(Fn: ValueRef);
|
||||||
fn LLVMGetOrInsertFunction(M: ModuleRef, Name: sbuf, FunctionTy: TypeRef)
|
fn LLVMGetOrInsertFunction(M: ModuleRef, Name: sbuf, FunctionTy: TypeRef)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMGetIntrinsicID(Fn: ValueRef) -> uint;
|
fn LLVMGetIntrinsicID(Fn: ValueRef) -> unsigned;
|
||||||
fn LLVMGetFunctionCallConv(Fn: ValueRef) -> uint;
|
fn LLVMGetFunctionCallConv(Fn: ValueRef) -> unsigned;
|
||||||
fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: uint);
|
fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: unsigned);
|
||||||
fn LLVMGetGC(Fn: ValueRef) -> sbuf;
|
fn LLVMGetGC(Fn: ValueRef) -> sbuf;
|
||||||
fn LLVMSetGC(Fn: ValueRef, Name: sbuf);
|
fn LLVMSetGC(Fn: ValueRef, Name: sbuf);
|
||||||
fn LLVMAddFunctionAttr(Fn: ValueRef, PA: Attribute, HighPA: uint);
|
fn LLVMAddFunctionAttr(Fn: ValueRef, PA: Attribute, HighPA: unsigned);
|
||||||
fn LLVMGetFunctionAttr(Fn: ValueRef) -> Attribute;
|
fn LLVMGetFunctionAttr(Fn: ValueRef) -> Attribute;
|
||||||
fn LLVMRemoveFunctionAttr(Fn: ValueRef, PA: Attribute, HighPA: uint);
|
fn LLVMRemoveFunctionAttr(Fn: ValueRef, PA: Attribute, HighPA: unsigned);
|
||||||
|
|
||||||
/* Operations on parameters */
|
/* Operations on parameters */
|
||||||
fn LLVMCountParams(Fn: ValueRef) -> uint;
|
fn LLVMCountParams(Fn: ValueRef) -> unsigned;
|
||||||
fn LLVMGetParams(Fn: ValueRef, Params: *ValueRef);
|
fn LLVMGetParams(Fn: ValueRef, Params: *ValueRef);
|
||||||
fn LLVMGetParam(Fn: ValueRef, Index: uint) -> ValueRef;
|
fn LLVMGetParam(Fn: ValueRef, Index: unsigned) -> ValueRef;
|
||||||
fn LLVMGetParamParent(Inst: ValueRef) -> ValueRef;
|
fn LLVMGetParamParent(Inst: ValueRef) -> ValueRef;
|
||||||
fn LLVMGetFirstParam(Fn: ValueRef) -> ValueRef;
|
fn LLVMGetFirstParam(Fn: ValueRef) -> ValueRef;
|
||||||
fn LLVMGetLastParam(Fn: ValueRef) -> ValueRef;
|
fn LLVMGetLastParam(Fn: ValueRef) -> ValueRef;
|
||||||
|
@ -478,14 +482,14 @@ native mod llvm {
|
||||||
fn LLVMAddAttribute(Arg: ValueRef, PA: Attribute);
|
fn LLVMAddAttribute(Arg: ValueRef, PA: Attribute);
|
||||||
fn LLVMRemoveAttribute(Arg: ValueRef, PA: Attribute);
|
fn LLVMRemoveAttribute(Arg: ValueRef, PA: Attribute);
|
||||||
fn LLVMGetAttribute(Arg: ValueRef) -> Attribute;
|
fn LLVMGetAttribute(Arg: ValueRef) -> Attribute;
|
||||||
fn LLVMSetParamAlignment(Arg: ValueRef, align: uint);
|
fn LLVMSetParamAlignment(Arg: ValueRef, align: unsigned);
|
||||||
|
|
||||||
/* Operations on basic blocks */
|
/* Operations on basic blocks */
|
||||||
fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
|
fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
|
||||||
fn LLVMValueIsBasicBlock(Val: ValueRef) -> Bool;
|
fn LLVMValueIsBasicBlock(Val: ValueRef) -> Bool;
|
||||||
fn LLVMValueAsBasicBlock(Val: ValueRef) -> BasicBlockRef;
|
fn LLVMValueAsBasicBlock(Val: ValueRef) -> BasicBlockRef;
|
||||||
fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
|
fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
|
||||||
fn LLVMCountBasicBlocks(Fn: ValueRef) -> uint;
|
fn LLVMCountBasicBlocks(Fn: ValueRef) -> unsigned;
|
||||||
fn LLVMGetBasicBlocks(Fn: ValueRef, BasicBlocks: *ValueRef);
|
fn LLVMGetBasicBlocks(Fn: ValueRef, BasicBlocks: *ValueRef);
|
||||||
fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
|
fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
|
||||||
fn LLVMGetLastBasicBlock(Fn: ValueRef) -> BasicBlockRef;
|
fn LLVMGetLastBasicBlock(Fn: ValueRef) -> BasicBlockRef;
|
||||||
|
@ -511,11 +515,13 @@ native mod llvm {
|
||||||
fn LLVMGetPreviousInstruction(Inst: ValueRef) -> ValueRef;
|
fn LLVMGetPreviousInstruction(Inst: ValueRef) -> ValueRef;
|
||||||
|
|
||||||
/* Operations on call sites */
|
/* Operations on call sites */
|
||||||
fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: uint);
|
fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: unsigned);
|
||||||
fn LLVMGetInstructionCallConv(Instr: ValueRef) -> uint;
|
fn LLVMGetInstructionCallConv(Instr: ValueRef) -> unsigned;
|
||||||
fn LLVMAddInstrAttribute(Instr: ValueRef, index: uint, IA: Attribute);
|
fn LLVMAddInstrAttribute(Instr: ValueRef, index: unsigned, IA: Attribute);
|
||||||
fn LLVMRemoveInstrAttribute(Instr: ValueRef, index: uint, IA: Attribute);
|
fn LLVMRemoveInstrAttribute(Instr: ValueRef, index: unsigned,
|
||||||
fn LLVMSetInstrParamAlignment(Instr: ValueRef, index: uint, align: uint);
|
IA: Attribute);
|
||||||
|
fn LLVMSetInstrParamAlignment(Instr: ValueRef, index: unsigned,
|
||||||
|
align: unsigned);
|
||||||
|
|
||||||
/* Operations on call instructions (only) */
|
/* Operations on call instructions (only) */
|
||||||
fn LLVMIsTailCall(CallInst: ValueRef) -> Bool;
|
fn LLVMIsTailCall(CallInst: ValueRef) -> Bool;
|
||||||
|
@ -523,10 +529,11 @@ native mod llvm {
|
||||||
|
|
||||||
/* Operations on phi nodes */
|
/* Operations on phi nodes */
|
||||||
fn LLVMAddIncoming(PhiNode: ValueRef, IncomingValues: *ValueRef,
|
fn LLVMAddIncoming(PhiNode: ValueRef, IncomingValues: *ValueRef,
|
||||||
IncomingBlocks: *BasicBlockRef, Count: uint);
|
IncomingBlocks: *BasicBlockRef, Count: unsigned);
|
||||||
fn LLVMCountIncoming(PhiNode: ValueRef) -> uint;
|
fn LLVMCountIncoming(PhiNode: ValueRef) -> unsigned;
|
||||||
fn LLVMGetIncomingValue(PhiNode: ValueRef, Index: uint) -> ValueRef;
|
fn LLVMGetIncomingValue(PhiNode: ValueRef, Index: unsigned) -> ValueRef;
|
||||||
fn LLVMGetIncomingBlock(PhiNode: ValueRef, Index: uint) -> BasicBlockRef;
|
fn LLVMGetIncomingBlock(PhiNode: ValueRef,
|
||||||
|
Index: unsigned) -> BasicBlockRef;
|
||||||
|
|
||||||
/* Instruction builders */
|
/* Instruction builders */
|
||||||
fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
|
fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
|
||||||
|
@ -550,20 +557,20 @@ native mod llvm {
|
||||||
/* Terminators */
|
/* Terminators */
|
||||||
fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
|
fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
|
||||||
fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
|
fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
|
||||||
fn LLVMBuildAggregateRet(B: BuilderRef, RetVals: *ValueRef, N: uint) ->
|
fn LLVMBuildAggregateRet(B: BuilderRef, RetVals: *ValueRef,
|
||||||
ValueRef;
|
N: unsigned) -> ValueRef;
|
||||||
fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
|
fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
|
||||||
fn LLVMBuildCondBr(B: BuilderRef, If: ValueRef, Then: BasicBlockRef,
|
fn LLVMBuildCondBr(B: BuilderRef, If: ValueRef, Then: BasicBlockRef,
|
||||||
Else: BasicBlockRef) -> ValueRef;
|
Else: BasicBlockRef) -> ValueRef;
|
||||||
fn LLVMBuildSwitch(B: BuilderRef, V: ValueRef, Else: BasicBlockRef,
|
fn LLVMBuildSwitch(B: BuilderRef, V: ValueRef, Else: BasicBlockRef,
|
||||||
NumCases: uint) -> ValueRef;
|
NumCases: unsigned) -> ValueRef;
|
||||||
fn LLVMBuildIndirectBr(B: BuilderRef, Addr: ValueRef, NumDests: uint) ->
|
fn LLVMBuildIndirectBr(B: BuilderRef, Addr: ValueRef,
|
||||||
ValueRef;
|
NumDests: unsigned) -> ValueRef;
|
||||||
fn LLVMBuildInvoke(B: BuilderRef, Fn: ValueRef, Args: *ValueRef,
|
fn LLVMBuildInvoke(B: BuilderRef, Fn: ValueRef, Args: *ValueRef,
|
||||||
NumArgs: uint, Then: BasicBlockRef,
|
NumArgs: unsigned, Then: BasicBlockRef,
|
||||||
Catch: BasicBlockRef, Name: sbuf) -> ValueRef;
|
Catch: BasicBlockRef, Name: sbuf) -> ValueRef;
|
||||||
fn LLVMBuildLandingPad(B: BuilderRef, Ty: TypeRef, PersFn: ValueRef,
|
fn LLVMBuildLandingPad(B: BuilderRef, Ty: TypeRef, PersFn: ValueRef,
|
||||||
NumClauses: uint, Name: sbuf) -> ValueRef;
|
NumClauses: unsigned, Name: sbuf) -> ValueRef;
|
||||||
fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
|
fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
|
||||||
fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
|
fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
|
||||||
|
|
||||||
|
@ -651,11 +658,12 @@ native mod llvm {
|
||||||
fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef) ->
|
fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
fn LLVMBuildGEP(B: BuilderRef, Pointer: ValueRef, Indices: *ValueRef,
|
fn LLVMBuildGEP(B: BuilderRef, Pointer: ValueRef, Indices: *ValueRef,
|
||||||
NumIndices: uint, Name: sbuf) -> ValueRef;
|
NumIndices: unsigned, Name: sbuf) -> ValueRef;
|
||||||
fn LLVMBuildInBoundsGEP(B: BuilderRef, Pointer: ValueRef,
|
fn LLVMBuildInBoundsGEP(B: BuilderRef, Pointer: ValueRef,
|
||||||
Indices: *ValueRef, NumIndices: uint, Name: sbuf)
|
Indices: *ValueRef, NumIndices: unsigned,
|
||||||
|
Name: sbuf)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildStructGEP(B: BuilderRef, Pointer: ValueRef, Idx: uint,
|
fn LLVMBuildStructGEP(B: BuilderRef, Pointer: ValueRef, Idx: unsigned,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: sbuf) -> ValueRef;
|
||||||
fn LLVMBuildGlobalString(B: BuilderRef, Str: sbuf, Name: sbuf) ->
|
fn LLVMBuildGlobalString(B: BuilderRef, Str: sbuf, Name: sbuf) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
|
@ -703,15 +711,15 @@ native mod llvm {
|
||||||
Name: sbuf) -> ValueRef;
|
Name: sbuf) -> ValueRef;
|
||||||
|
|
||||||
/* Comparisons */
|
/* Comparisons */
|
||||||
fn LLVMBuildICmp(B: BuilderRef, Op: uint, LHS: ValueRef, RHS: ValueRef,
|
fn LLVMBuildICmp(B: BuilderRef, Op: unsigned, LHS: ValueRef,
|
||||||
Name: sbuf) -> ValueRef;
|
RHS: ValueRef, Name: sbuf) -> ValueRef;
|
||||||
fn LLVMBuildFCmp(B: BuilderRef, Op: uint, LHS: ValueRef, RHS: ValueRef,
|
fn LLVMBuildFCmp(B: BuilderRef, Op: unsigned, LHS: ValueRef,
|
||||||
Name: sbuf) -> ValueRef;
|
RHS: ValueRef, Name: sbuf) -> ValueRef;
|
||||||
|
|
||||||
/* Miscellaneous instructions */
|
/* Miscellaneous instructions */
|
||||||
fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: sbuf) -> ValueRef;
|
fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: sbuf) -> ValueRef;
|
||||||
fn LLVMBuildCall(B: BuilderRef, Fn: ValueRef, Args: *ValueRef,
|
fn LLVMBuildCall(B: BuilderRef, Fn: ValueRef, Args: *ValueRef,
|
||||||
NumArgs: uint, Name: sbuf) -> ValueRef;
|
NumArgs: unsigned, Name: sbuf) -> ValueRef;
|
||||||
fn LLVMBuildSelect(B: BuilderRef, If: ValueRef, Then: ValueRef,
|
fn LLVMBuildSelect(B: BuilderRef, If: ValueRef, Then: ValueRef,
|
||||||
Else: ValueRef, Name: sbuf) -> ValueRef;
|
Else: ValueRef, Name: sbuf) -> ValueRef;
|
||||||
fn LLVMBuildVAArg(B: BuilderRef, list: ValueRef, Ty: TypeRef, Name: sbuf)
|
fn LLVMBuildVAArg(B: BuilderRef, list: ValueRef, Ty: TypeRef, Name: sbuf)
|
||||||
|
@ -723,10 +731,10 @@ native mod llvm {
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildShuffleVector(B: BuilderRef, V1: ValueRef, V2: ValueRef,
|
fn LLVMBuildShuffleVector(B: BuilderRef, V1: ValueRef, V2: ValueRef,
|
||||||
Mask: ValueRef, Name: sbuf) -> ValueRef;
|
Mask: ValueRef, Name: sbuf) -> ValueRef;
|
||||||
fn LLVMBuildExtractValue(B: BuilderRef, AggVal: ValueRef, Index: uint,
|
fn LLVMBuildExtractValue(B: BuilderRef, AggVal: ValueRef, Index: unsigned,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: sbuf) -> ValueRef;
|
||||||
fn LLVMBuildInsertValue(B: BuilderRef, AggVal: ValueRef, EltVal: ValueRef,
|
fn LLVMBuildInsertValue(B: BuilderRef, AggVal: ValueRef, EltVal: ValueRef,
|
||||||
Index: uint, Name: sbuf) -> ValueRef;
|
Index: unsigned, Name: sbuf) -> ValueRef;
|
||||||
|
|
||||||
fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: sbuf) -> ValueRef;
|
fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: sbuf) -> ValueRef;
|
||||||
fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: sbuf) ->
|
fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: sbuf) ->
|
||||||
|
@ -738,7 +746,7 @@ native mod llvm {
|
||||||
fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
|
fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
|
||||||
|
|
||||||
/** Writes a module to the specified path. Returns 0 on success. */
|
/** Writes a module to the specified path. Returns 0 on success. */
|
||||||
fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: sbuf) -> int;
|
fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: sbuf) -> c_int;
|
||||||
|
|
||||||
/** Creates target data from a target layout string. */
|
/** Creates target data from a target layout string. */
|
||||||
fn LLVMCreateTargetData(StringRep: sbuf) -> TargetDataRef;
|
fn LLVMCreateTargetData(StringRep: sbuf) -> TargetDataRef;
|
||||||
|
@ -746,9 +754,10 @@ native mod llvm {
|
||||||
references the target data only weakly. */
|
references the target data only weakly. */
|
||||||
fn LLVMAddTargetData(TD: TargetDataRef, PM: PassManagerRef);
|
fn LLVMAddTargetData(TD: TargetDataRef, PM: PassManagerRef);
|
||||||
/** Returns the size of a type. FIXME: rv is actually a ULongLong! */
|
/** Returns the size of a type. FIXME: rv is actually a ULongLong! */
|
||||||
fn LLVMStoreSizeOfType(TD: TargetDataRef, Ty: TypeRef) -> uint;
|
fn LLVMStoreSizeOfType(TD: TargetDataRef, Ty: TypeRef) -> unsigned;
|
||||||
/** Returns the alignment of a type. */
|
/** Returns the alignment of a type. */
|
||||||
fn LLVMPreferredAlignmentOfType(TD: TargetDataRef, Ty: TypeRef) -> uint;
|
fn LLVMPreferredAlignmentOfType(TD: TargetDataRef,
|
||||||
|
Ty: TypeRef) -> unsigned;
|
||||||
/** Disposes target data. */
|
/** Disposes target data. */
|
||||||
fn LLVMDisposeTargetData(TD: TargetDataRef);
|
fn LLVMDisposeTargetData(TD: TargetDataRef);
|
||||||
|
|
||||||
|
@ -801,7 +810,7 @@ native mod llvm {
|
||||||
fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
|
fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
|
||||||
fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef);
|
fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef);
|
||||||
fn LLVMPassManagerBuilderSetOptLevel(PMB: PassManagerBuilderRef,
|
fn LLVMPassManagerBuilderSetOptLevel(PMB: PassManagerBuilderRef,
|
||||||
OptimizationLevel: uint);
|
OptimizationLevel: unsigned);
|
||||||
fn LLVMPassManagerBuilderSetSizeLevel(PMB: PassManagerBuilderRef,
|
fn LLVMPassManagerBuilderSetSizeLevel(PMB: PassManagerBuilderRef,
|
||||||
Value: Bool);
|
Value: Bool);
|
||||||
fn LLVMPassManagerBuilderSetDisableUnitAtATime(PMB: PassManagerBuilderRef,
|
fn LLVMPassManagerBuilderSetDisableUnitAtATime(PMB: PassManagerBuilderRef,
|
||||||
|
@ -811,7 +820,7 @@ native mod llvm {
|
||||||
fn LLVMPassManagerBuilderSetDisableSimplifyLibCalls
|
fn LLVMPassManagerBuilderSetDisableSimplifyLibCalls
|
||||||
(PMB: PassManagerBuilderRef, Value: Bool);
|
(PMB: PassManagerBuilderRef, Value: Bool);
|
||||||
fn LLVMPassManagerBuilderUseInlinerWithThreshold
|
fn LLVMPassManagerBuilderUseInlinerWithThreshold
|
||||||
(PMB: PassManagerBuilderRef, threshold: uint);
|
(PMB: PassManagerBuilderRef, threshold: unsigned);
|
||||||
fn LLVMPassManagerBuilderPopulateModulePassManager
|
fn LLVMPassManagerBuilderPopulateModulePassManager
|
||||||
(PMB: PassManagerBuilderRef, PM: PassManagerRef);
|
(PMB: PassManagerBuilderRef, PM: PassManagerRef);
|
||||||
|
|
||||||
|
@ -844,9 +853,8 @@ native mod llvm {
|
||||||
fn LLVMMoveToNextSection(SI: SectionIteratorRef);
|
fn LLVMMoveToNextSection(SI: SectionIteratorRef);
|
||||||
/** Returns the current section name. */
|
/** Returns the current section name. */
|
||||||
fn LLVMGetSectionName(SI: SectionIteratorRef) -> sbuf;
|
fn LLVMGetSectionName(SI: SectionIteratorRef) -> sbuf;
|
||||||
/** Returns the current section size.
|
/** Returns the current section size. */
|
||||||
FIXME: The return value is actually a uint64_t! */
|
fn LLVMGetSectionSize(SI: SectionIteratorRef) -> ulonglong;
|
||||||
fn LLVMGetSectionSize(SI: SectionIteratorRef) -> uint;
|
|
||||||
/** Returns the current section contents as a string buffer. */
|
/** Returns the current section contents as a string buffer. */
|
||||||
fn LLVMGetSectionContents(SI: SectionIteratorRef) -> sbuf;
|
fn LLVMGetSectionContents(SI: SectionIteratorRef) -> sbuf;
|
||||||
|
|
||||||
|
@ -857,7 +865,7 @@ native mod llvm {
|
||||||
|
|
||||||
/* FIXME: The FileType is an enum.*/
|
/* FIXME: The FileType is an enum.*/
|
||||||
fn LLVMRustWriteOutputFile(PM: PassManagerRef, M: ModuleRef, Triple: sbuf,
|
fn LLVMRustWriteOutputFile(PM: PassManagerRef, M: ModuleRef, Triple: sbuf,
|
||||||
Output: sbuf, FileType: int, OptLevel: int,
|
Output: sbuf, FileType: c_int, OptLevel: c_int,
|
||||||
EnableSegmentedStacks: bool);
|
EnableSegmentedStacks: bool);
|
||||||
|
|
||||||
/** Returns a string describing the last error caused by an LLVMRust*
|
/** Returns a string describing the last error caused by an LLVMRust*
|
||||||
|
@ -871,7 +879,7 @@ native mod llvm {
|
||||||
fn LLVMRustParseAssemblyFile(Filename: sbuf) -> ModuleRef;
|
fn LLVMRustParseAssemblyFile(Filename: sbuf) -> ModuleRef;
|
||||||
|
|
||||||
/** FiXME: Hacky adaptor for lack of ULongLong in FFI: */
|
/** FiXME: Hacky adaptor for lack of ULongLong in FFI: */
|
||||||
fn LLVMRustConstInt(IntTy: TypeRef, N_hi: uint, N_lo: uint,
|
fn LLVMRustConstInt(IntTy: TypeRef, N_hi: unsigned, N_lo: unsigned,
|
||||||
SignExtend: Bool) -> ValueRef;
|
SignExtend: Bool) -> ValueRef;
|
||||||
|
|
||||||
fn LLVMRustAddPrintModulePass(PM: PassManagerRef, M: ModuleRef,
|
fn LLVMRustAddPrintModulePass(PM: PassManagerRef, M: ModuleRef,
|
||||||
|
@ -886,10 +894,10 @@ native mod llvm {
|
||||||
fn LLVMStructCreateNamed(C: ContextRef, Name: sbuf) -> TypeRef;
|
fn LLVMStructCreateNamed(C: ContextRef, Name: sbuf) -> TypeRef;
|
||||||
|
|
||||||
fn LLVMStructSetBody(StructTy: TypeRef, ElementTypes: *TypeRef,
|
fn LLVMStructSetBody(StructTy: TypeRef, ElementTypes: *TypeRef,
|
||||||
ElementCount: uint, Packed: Bool);
|
ElementCount: unsigned, Packed: Bool);
|
||||||
|
|
||||||
fn LLVMConstNamedStruct(S: TypeRef, ConstantVals: *ValueRef, Count: uint)
|
fn LLVMConstNamedStruct(S: TypeRef, ConstantVals: *ValueRef,
|
||||||
-> ValueRef;
|
Count: unsigned) -> ValueRef;
|
||||||
|
|
||||||
/** Links LLVM modules together. `Src` is destroyed by this call and
|
/** Links LLVM modules together. `Src` is destroyed by this call and
|
||||||
must never be referenced again. */
|
must never be referenced again. */
|
||||||
|
@ -934,7 +942,7 @@ fn type_to_str_inner(names: type_names, outer0: [TypeRef], ty: TypeRef) ->
|
||||||
|
|
||||||
let outer = outer0 + [ty];
|
let outer = outer0 + [ty];
|
||||||
|
|
||||||
let kind: int = llvm::LLVMGetTypeKind(ty);
|
let kind: int = llvm::LLVMGetTypeKind(ty) as int;
|
||||||
|
|
||||||
fn tys_str(names: type_names, outer: [TypeRef], tys: [TypeRef]) -> str {
|
fn tys_str(names: type_names, outer: [TypeRef], tys: [TypeRef]) -> str {
|
||||||
let s: str = "";
|
let s: str = "";
|
||||||
|
@ -963,7 +971,7 @@ fn type_to_str_inner(names: type_names, outer0: [TypeRef], ty: TypeRef) ->
|
||||||
9 {
|
9 {
|
||||||
let s = "fn(";
|
let s = "fn(";
|
||||||
let out_ty: TypeRef = llvm::LLVMGetReturnType(ty);
|
let out_ty: TypeRef = llvm::LLVMGetReturnType(ty);
|
||||||
let n_args: uint = llvm::LLVMCountParamTypes(ty);
|
let n_args = llvm::LLVMCountParamTypes(ty) as uint;
|
||||||
let args: [TypeRef] = vec::init_elt::<TypeRef>(0 as TypeRef, n_args);
|
let args: [TypeRef] = vec::init_elt::<TypeRef>(0 as TypeRef, n_args);
|
||||||
unsafe {
|
unsafe {
|
||||||
llvm::LLVMGetParamTypes(ty, vec::to_ptr(args));
|
llvm::LLVMGetParamTypes(ty, vec::to_ptr(args));
|
||||||
|
@ -975,7 +983,7 @@ fn type_to_str_inner(names: type_names, outer0: [TypeRef], ty: TypeRef) ->
|
||||||
}
|
}
|
||||||
10 {
|
10 {
|
||||||
let s: str = "{";
|
let s: str = "{";
|
||||||
let n_elts: uint = llvm::LLVMCountStructElementTypes(ty);
|
let n_elts = llvm::LLVMCountStructElementTypes(ty) as uint;
|
||||||
let elts: [TypeRef] = vec::init_elt::<TypeRef>(0 as TypeRef, n_elts);
|
let elts: [TypeRef] = vec::init_elt::<TypeRef>(0 as TypeRef, n_elts);
|
||||||
unsafe {
|
unsafe {
|
||||||
llvm::LLVMGetStructElementTypes(ty, vec::to_ptr(elts));
|
llvm::LLVMGetStructElementTypes(ty, vec::to_ptr(elts));
|
||||||
|
@ -987,7 +995,7 @@ fn type_to_str_inner(names: type_names, outer0: [TypeRef], ty: TypeRef) ->
|
||||||
11 {
|
11 {
|
||||||
let el_ty = llvm::LLVMGetElementType(ty);
|
let el_ty = llvm::LLVMGetElementType(ty);
|
||||||
ret "[" + type_to_str_inner(names, outer, el_ty) + " x " +
|
ret "[" + type_to_str_inner(names, outer, el_ty) + " x " +
|
||||||
uint::str(llvm::LLVMGetArrayLength(ty)) + "]";
|
uint::str(llvm::LLVMGetArrayLength(ty) as uint) + "]";
|
||||||
}
|
}
|
||||||
12 {
|
12 {
|
||||||
let i: uint = 0u;
|
let i: uint = 0u;
|
||||||
|
@ -1009,7 +1017,7 @@ fn type_to_str_inner(names: type_names, outer0: [TypeRef], ty: TypeRef) ->
|
||||||
}
|
}
|
||||||
|
|
||||||
fn float_width(llt: TypeRef) -> uint {
|
fn float_width(llt: TypeRef) -> uint {
|
||||||
ret alt llvm::LLVMGetTypeKind(llt) {
|
ret alt llvm::LLVMGetTypeKind(llt) as int {
|
||||||
1 { 32u }
|
1 { 32u }
|
||||||
2 { 64u }
|
2 { 64u }
|
||||||
3 { 80u }
|
3 { 80u }
|
||||||
|
@ -1019,7 +1027,8 @@ fn float_width(llt: TypeRef) -> uint {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fn_ty_param_tys(fn_ty: TypeRef) -> [TypeRef] unsafe {
|
fn fn_ty_param_tys(fn_ty: TypeRef) -> [TypeRef] unsafe {
|
||||||
let args = vec::init_elt(0 as TypeRef, llvm::LLVMCountParamTypes(fn_ty));
|
let args = vec::init_elt(0 as TypeRef,
|
||||||
|
llvm::LLVMCountParamTypes(fn_ty) as uint);
|
||||||
llvm::LLVMGetParamTypes(fn_ty, vec::to_ptr(args));
|
llvm::LLVMGetParamTypes(fn_ty, vec::to_ptr(args));
|
||||||
ret args;
|
ret args;
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,7 +221,7 @@ fn get_metadata_section(sess: session::session,
|
||||||
let name = unsafe { str::from_cstr(name_buf) };
|
let name = unsafe { str::from_cstr(name_buf) };
|
||||||
if str::eq(name, sess.targ_cfg.target_strs.meta_sect_name) {
|
if str::eq(name, sess.targ_cfg.target_strs.meta_sect_name) {
|
||||||
let cbuf = llvm::LLVMGetSectionContents(si.llsi);
|
let cbuf = llvm::LLVMGetSectionContents(si.llsi);
|
||||||
let csz = llvm::LLVMGetSectionSize(si.llsi);
|
let csz = llvm::LLVMGetSectionSize(si.llsi) as uint;
|
||||||
unsafe {
|
unsafe {
|
||||||
let cvbuf: *u8 = unsafe::reinterpret_cast(cbuf);
|
let cvbuf: *u8 = unsafe::reinterpret_cast(cbuf);
|
||||||
ret option::some::<@[u8]>(@vec::unsafe::from_buf(cvbuf, csz));
|
ret option::some::<@[u8]>(@vec::unsafe::from_buf(cvbuf, csz));
|
||||||
|
|
|
@ -46,7 +46,7 @@ const DW_ATE_unsigned_char: int = 0x08;
|
||||||
|
|
||||||
fn llstr(s: str) -> ValueRef {
|
fn llstr(s: str) -> ValueRef {
|
||||||
str::as_buf(s, {|sbuf|
|
str::as_buf(s, {|sbuf|
|
||||||
llvm::LLVMMDString(sbuf, str::byte_len(s))
|
llvm::LLVMMDString(sbuf, str::byte_len(s) as u32)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
fn lltag(lltag: int) -> ValueRef {
|
fn lltag(lltag: int) -> ValueRef {
|
||||||
|
@ -63,7 +63,7 @@ fn lli1(bval: bool) -> ValueRef {
|
||||||
}
|
}
|
||||||
fn llmdnode(elems: [ValueRef]) -> ValueRef unsafe {
|
fn llmdnode(elems: [ValueRef]) -> ValueRef unsafe {
|
||||||
llvm::LLVMMDNode(vec::unsafe::to_ptr(elems),
|
llvm::LLVMMDNode(vec::unsafe::to_ptr(elems),
|
||||||
vec::len(elems))
|
vec::len(elems) as u32)
|
||||||
}
|
}
|
||||||
fn llunused() -> ValueRef {
|
fn llunused() -> ValueRef {
|
||||||
lli32(0x0)
|
lli32(0x0)
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
// but many TypeRefs correspond to one ty::t; for instance, tup(int, int,
|
// but many TypeRefs correspond to one ty::t; for instance, tup(int, int,
|
||||||
// int) and rec(x=int, y=int, z=int) will have the same TypeRef.
|
// int) and rec(x=int, y=int, z=int) will have the same TypeRef.
|
||||||
|
|
||||||
|
import core::ctypes::c_uint;
|
||||||
import std::{map, time};
|
import std::{map, time};
|
||||||
import std::map::hashmap;
|
import std::map::hashmap;
|
||||||
import std::map::{new_int_hash, new_str_hash};
|
import std::map::{new_int_hash, new_str_hash};
|
||||||
|
@ -292,11 +293,12 @@ fn log_fn_time(ccx: @crate_ctxt, name: str, start: time::timeval,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn decl_fn(llmod: ModuleRef, name: str, cc: uint, llty: TypeRef) -> ValueRef {
|
fn decl_fn(llmod: ModuleRef, name: str, cc: uint, llty: TypeRef) ->
|
||||||
|
ValueRef {
|
||||||
let llfn: ValueRef =
|
let llfn: ValueRef =
|
||||||
str::as_buf(name, {|buf|
|
str::as_buf(name, {|buf|
|
||||||
llvm::LLVMGetOrInsertFunction(llmod, buf, llty) });
|
llvm::LLVMGetOrInsertFunction(llmod, buf, llty) });
|
||||||
llvm::LLVMSetFunctionCallConv(llfn, cc);
|
llvm::LLVMSetFunctionCallConv(llfn, cc as c_uint);
|
||||||
ret llfn;
|
ret llfn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +341,8 @@ fn get_simple_extern_fn(cx: @block_ctxt,
|
||||||
let inputs = vec::init_elt::<TypeRef>(ccx.int_type, n_args as uint);
|
let inputs = vec::init_elt::<TypeRef>(ccx.int_type, n_args as uint);
|
||||||
let output = ccx.int_type;
|
let output = ccx.int_type;
|
||||||
let t = T_fn(inputs, output);
|
let t = T_fn(inputs, output);
|
||||||
ret get_extern_fn(externs, llmod, name, lib::llvm::LLVMCCallConv, t);
|
ret get_extern_fn(externs, llmod, name,
|
||||||
|
lib::llvm::LLVMCCallConv, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn trans_native_call(cx: @block_ctxt, externs: hashmap<str, ValueRef>,
|
fn trans_native_call(cx: @block_ctxt, externs: hashmap<str, ValueRef>,
|
||||||
|
@ -390,12 +393,12 @@ fn align_to(cx: @block_ctxt, off: ValueRef, align: ValueRef) -> ValueRef {
|
||||||
|
|
||||||
// Returns the real size of the given type for the current target.
|
// Returns the real size of the given type for the current target.
|
||||||
fn llsize_of_real(cx: @crate_ctxt, t: TypeRef) -> uint {
|
fn llsize_of_real(cx: @crate_ctxt, t: TypeRef) -> uint {
|
||||||
ret llvm::LLVMStoreSizeOfType(cx.td.lltd, t);
|
ret llvm::LLVMStoreSizeOfType(cx.td.lltd, t) as uint;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the real alignment of the given type for the current target.
|
// Returns the real alignment of the given type for the current target.
|
||||||
fn llalign_of_real(cx: @crate_ctxt, t: TypeRef) -> uint {
|
fn llalign_of_real(cx: @crate_ctxt, t: TypeRef) -> uint {
|
||||||
ret llvm::LLVMPreferredAlignmentOfType(cx.td.lltd, t);
|
ret llvm::LLVMPreferredAlignmentOfType(cx.td.lltd, t) as uint;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn llsize_of(cx: @crate_ctxt, t: TypeRef) -> ValueRef {
|
fn llsize_of(cx: @crate_ctxt, t: TypeRef) -> ValueRef {
|
||||||
|
@ -1070,7 +1073,7 @@ fn set_no_inline(f: ValueRef) {
|
||||||
llvm::LLVMAddFunctionAttr(f,
|
llvm::LLVMAddFunctionAttr(f,
|
||||||
lib::llvm::LLVMNoInlineAttribute as
|
lib::llvm::LLVMNoInlineAttribute as
|
||||||
lib::llvm::llvm::Attribute,
|
lib::llvm::llvm::Attribute,
|
||||||
0u);
|
0u32);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tell LLVM to emit the information necessary to unwind the stack for the
|
// Tell LLVM to emit the information necessary to unwind the stack for the
|
||||||
|
@ -1079,19 +1082,19 @@ fn set_uwtable(f: ValueRef) {
|
||||||
llvm::LLVMAddFunctionAttr(f,
|
llvm::LLVMAddFunctionAttr(f,
|
||||||
lib::llvm::LLVMUWTableAttribute as
|
lib::llvm::LLVMUWTableAttribute as
|
||||||
lib::llvm::llvm::Attribute,
|
lib::llvm::llvm::Attribute,
|
||||||
0u);
|
0u32);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_always_inline(f: ValueRef) {
|
fn set_always_inline(f: ValueRef) {
|
||||||
llvm::LLVMAddFunctionAttr(f,
|
llvm::LLVMAddFunctionAttr(f,
|
||||||
lib::llvm::LLVMAlwaysInlineAttribute as
|
lib::llvm::LLVMAlwaysInlineAttribute as
|
||||||
lib::llvm::llvm::Attribute,
|
lib::llvm::llvm::Attribute,
|
||||||
0u);
|
0u32);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_custom_stack_growth_fn(f: ValueRef) {
|
fn set_custom_stack_growth_fn(f: ValueRef) {
|
||||||
// TODO: Remove this hack to work around the lack of u64 in the FFI.
|
// TODO: Remove this hack to work around the lack of u64 in the FFI.
|
||||||
llvm::LLVMAddFunctionAttr(f, 0 as lib::llvm::llvm::Attribute, 1u);
|
llvm::LLVMAddFunctionAttr(f, 0 as lib::llvm::llvm::Attribute, 1u32);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_glue_inlining(cx: @local_ctxt, f: ValueRef, t: ty::t) {
|
fn set_glue_inlining(cx: @local_ctxt, f: ValueRef, t: ty::t) {
|
||||||
|
@ -1178,7 +1181,7 @@ fn make_generic_glue_inner(cx: @local_ctxt, sp: span, t: ty::t,
|
||||||
} else { T_ptr(T_i8()) };
|
} else { T_ptr(T_i8()) };
|
||||||
|
|
||||||
let ty_param_count = vec::len::<uint>(ty_params);
|
let ty_param_count = vec::len::<uint>(ty_params);
|
||||||
let lltyparams = llvm::LLVMGetParam(llfn, 2u);
|
let lltyparams = llvm::LLVMGetParam(llfn, 2u32);
|
||||||
let load_env_bcx = new_raw_block_ctxt(fcx, fcx.llloadenv);
|
let load_env_bcx = new_raw_block_ctxt(fcx, fcx.llloadenv);
|
||||||
let lltydescs = [mutable];
|
let lltydescs = [mutable];
|
||||||
let p = 0u;
|
let p = 0u;
|
||||||
|
@ -1193,7 +1196,7 @@ fn make_generic_glue_inner(cx: @local_ctxt, sp: span, t: ty::t,
|
||||||
|
|
||||||
let bcx = new_top_block_ctxt(fcx);
|
let bcx = new_top_block_ctxt(fcx);
|
||||||
let lltop = bcx.llbb;
|
let lltop = bcx.llbb;
|
||||||
let llrawptr0 = llvm::LLVMGetParam(llfn, 3u);
|
let llrawptr0 = llvm::LLVMGetParam(llfn, 3u32);
|
||||||
let llval0 = BitCast(bcx, llrawptr0, llty);
|
let llval0 = BitCast(bcx, llrawptr0, llty);
|
||||||
helper(bcx, llval0, t);
|
helper(bcx, llval0, t);
|
||||||
finish_fn(fcx, lltop);
|
finish_fn(fcx, lltop);
|
||||||
|
@ -4300,8 +4303,8 @@ fn new_fn_ctxt_w_id(cx: @local_ctxt, sp: span, llfndecl: ValueRef,
|
||||||
-> @fn_ctxt {
|
-> @fn_ctxt {
|
||||||
let llbbs = mk_standard_basic_blocks(llfndecl);
|
let llbbs = mk_standard_basic_blocks(llfndecl);
|
||||||
ret @{llfn: llfndecl,
|
ret @{llfn: llfndecl,
|
||||||
llenv: llvm::LLVMGetParam(llfndecl, 1u),
|
llenv: llvm::LLVMGetParam(llfndecl, 1u32),
|
||||||
llretptr: llvm::LLVMGetParam(llfndecl, 0u),
|
llretptr: llvm::LLVMGetParam(llfndecl, 0u32),
|
||||||
mutable llstaticallocas: llbbs.sa,
|
mutable llstaticallocas: llbbs.sa,
|
||||||
mutable llloadenv: llbbs.ca,
|
mutable llloadenv: llbbs.ca,
|
||||||
mutable llderivedtydescs_first: llbbs.dt,
|
mutable llderivedtydescs_first: llbbs.dt,
|
||||||
|
@ -4344,7 +4347,7 @@ fn create_llargs_for_fn_args(cx: @fn_ctxt, ty_self: self_arg,
|
||||||
// Skip the implicit arguments 0, and 1. TODO: Pull out 2u and define
|
// Skip the implicit arguments 0, and 1. TODO: Pull out 2u and define
|
||||||
// it as a constant, since we're using it in several places in trans this
|
// it as a constant, since we're using it in several places in trans this
|
||||||
// way.
|
// way.
|
||||||
let arg_n = 2u;
|
let arg_n = 2u32;
|
||||||
alt ty_self {
|
alt ty_self {
|
||||||
impl_self(tt) {
|
impl_self(tt) {
|
||||||
cx.llself = some({v: cx.llenv, t: tt});
|
cx.llself = some({v: cx.llenv, t: tt});
|
||||||
|
@ -4353,12 +4356,12 @@ fn create_llargs_for_fn_args(cx: @fn_ctxt, ty_self: self_arg,
|
||||||
}
|
}
|
||||||
for tp in ty_params {
|
for tp in ty_params {
|
||||||
let lltydesc = llvm::LLVMGetParam(cx.llfn, arg_n), dicts = none;
|
let lltydesc = llvm::LLVMGetParam(cx.llfn, arg_n), dicts = none;
|
||||||
arg_n += 1u;
|
arg_n += 1u32;
|
||||||
for bound in *fcx_tcx(cx).ty_param_bounds.get(tp.id) {
|
for bound in *fcx_tcx(cx).ty_param_bounds.get(tp.id) {
|
||||||
alt bound {
|
alt bound {
|
||||||
ty::bound_iface(_) {
|
ty::bound_iface(_) {
|
||||||
let dict = llvm::LLVMGetParam(cx.llfn, arg_n);
|
let dict = llvm::LLVMGetParam(cx.llfn, arg_n);
|
||||||
arg_n += 1u;
|
arg_n += 1u32;
|
||||||
dicts = some(alt dicts {
|
dicts = some(alt dicts {
|
||||||
none. { [dict] }
|
none. { [dict] }
|
||||||
some(ds) { ds + [dict] }
|
some(ds) { ds + [dict] }
|
||||||
|
@ -4379,7 +4382,7 @@ fn create_llargs_for_fn_args(cx: @fn_ctxt, ty_self: self_arg,
|
||||||
// copy_args_to_allocas will overwrite the table entry with local_imm
|
// copy_args_to_allocas will overwrite the table entry with local_imm
|
||||||
// before it's actually used.
|
// before it's actually used.
|
||||||
cx.llargs.insert(arg.id, local_mem(llarg));
|
cx.llargs.insert(arg.id, local_mem(llarg));
|
||||||
arg_n += 1u;
|
arg_n += 1u32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4798,7 +4801,7 @@ fn trans_native_mod(lcx: @local_ctxt, native_mod: ast::native_mod,
|
||||||
let fcx = new_fn_ctxt(lcx, span, llshimfn);
|
let fcx = new_fn_ctxt(lcx, span, llshimfn);
|
||||||
let bcx = new_top_block_ctxt(fcx);
|
let bcx = new_top_block_ctxt(fcx);
|
||||||
let lltop = bcx.llbb;
|
let lltop = bcx.llbb;
|
||||||
let llargbundle = llvm::LLVMGetParam(llshimfn, 0u);
|
let llargbundle = llvm::LLVMGetParam(llshimfn, 0u32);
|
||||||
let i = 0u, n = vec::len(tys.arg_tys);
|
let i = 0u, n = vec::len(tys.arg_tys);
|
||||||
let llargvals = [];
|
let llargvals = [];
|
||||||
while i < n {
|
while i < n {
|
||||||
|
@ -4808,7 +4811,8 @@ fn trans_native_mod(lcx: @local_ctxt, native_mod: ast::native_mod,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the call itself and store the return value:
|
// Create the call itself and store the return value:
|
||||||
let llretval = CallWithConv(bcx, llbasefn, llargvals, cc); // r
|
let llretval = CallWithConv(bcx, llbasefn,
|
||||||
|
llargvals, cc as c_uint); // r
|
||||||
if tys.ret_def {
|
if tys.ret_def {
|
||||||
// R** llretptr = &args->r;
|
// R** llretptr = &args->r;
|
||||||
let llretptr = GEPi(bcx, llargbundle, [0, n as int]);
|
let llretptr = GEPi(bcx, llargbundle, [0, n as int]);
|
||||||
|
@ -4842,11 +4846,12 @@ fn trans_native_mod(lcx: @local_ctxt, native_mod: ast::native_mod,
|
||||||
let i = 0u, n = vec::len(tys.arg_tys);
|
let i = 0u, n = vec::len(tys.arg_tys);
|
||||||
let implicit_args = 2u + num_tps; // ret + env
|
let implicit_args = 2u + num_tps; // ret + env
|
||||||
while i < n {
|
while i < n {
|
||||||
let llargval = llvm::LLVMGetParam(llwrapfn, i + implicit_args);
|
let llargval = llvm::LLVMGetParam(llwrapfn,
|
||||||
|
(i + implicit_args) as c_uint);
|
||||||
store_inbounds(bcx, llargval, llargbundle, [0, i as int]);
|
store_inbounds(bcx, llargval, llargbundle, [0, i as int]);
|
||||||
i += 1u;
|
i += 1u;
|
||||||
}
|
}
|
||||||
let llretptr = llvm::LLVMGetParam(llwrapfn, 0u);
|
let llretptr = llvm::LLVMGetParam(llwrapfn, 0u32);
|
||||||
store_inbounds(bcx, llretptr, llargbundle, [0, n as int]);
|
store_inbounds(bcx, llretptr, llargbundle, [0, n as int]);
|
||||||
|
|
||||||
// Create call itself.
|
// Create call itself.
|
||||||
|
@ -4859,7 +4864,7 @@ fn trans_native_mod(lcx: @local_ctxt, native_mod: ast::native_mod,
|
||||||
}
|
}
|
||||||
|
|
||||||
let ccx = lcx_ccx(lcx);
|
let ccx = lcx_ccx(lcx);
|
||||||
let cc: uint = lib::llvm::LLVMCCallConv;
|
let cc = lib::llvm::LLVMCCallConv;
|
||||||
alt abi {
|
alt abi {
|
||||||
ast::native_abi_rust_intrinsic. { ret; }
|
ast::native_abi_rust_intrinsic. { ret; }
|
||||||
ast::native_abi_cdecl. { cc = lib::llvm::LLVMCCallConv; }
|
ast::native_abi_cdecl. { cc = lib::llvm::LLVMCCallConv; }
|
||||||
|
@ -5031,10 +5036,10 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef,
|
||||||
let bcx = new_top_block_ctxt(fcx);
|
let bcx = new_top_block_ctxt(fcx);
|
||||||
let lltop = bcx.llbb;
|
let lltop = bcx.llbb;
|
||||||
|
|
||||||
let lloutputarg = llvm::LLVMGetParam(llfdecl, 0u);
|
let lloutputarg = llvm::LLVMGetParam(llfdecl, 0u32);
|
||||||
let llenvarg = llvm::LLVMGetParam(llfdecl, 1u);
|
let llenvarg = llvm::LLVMGetParam(llfdecl, 1u32);
|
||||||
let args = [lloutputarg, llenvarg];
|
let args = [lloutputarg, llenvarg];
|
||||||
if takes_argv { args += [llvm::LLVMGetParam(llfdecl, 2u)]; }
|
if takes_argv { args += [llvm::LLVMGetParam(llfdecl, 2u32)]; }
|
||||||
Call(bcx, main_llfn, args);
|
Call(bcx, main_llfn, args);
|
||||||
build_return(bcx);
|
build_return(bcx);
|
||||||
|
|
||||||
|
@ -5065,11 +5070,11 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef,
|
||||||
let start = str::as_buf("rust_start", {|buf|
|
let start = str::as_buf("rust_start", {|buf|
|
||||||
llvm::LLVMAddGlobal(ccx.llmod, start_ty, buf)
|
llvm::LLVMAddGlobal(ccx.llmod, start_ty, buf)
|
||||||
});
|
});
|
||||||
let args = [rust_main, llvm::LLVMGetParam(llfn, 0u),
|
let args = [rust_main, llvm::LLVMGetParam(llfn, 0u32),
|
||||||
llvm::LLVMGetParam(llfn, 1u), crate_map];
|
llvm::LLVMGetParam(llfn, 1u32), crate_map];
|
||||||
let result = unsafe {
|
let result = unsafe {
|
||||||
llvm::LLVMBuildCall(bld, start, vec::to_ptr(args),
|
llvm::LLVMBuildCall(bld, start, vec::to_ptr(args),
|
||||||
vec::len(args), noname())
|
vec::len(args) as c_uint, noname())
|
||||||
};
|
};
|
||||||
llvm::LLVMBuildRet(bld, result);
|
llvm::LLVMBuildRet(bld, result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import core::{vec, str};
|
import core::{vec, str};
|
||||||
|
import core::ctypes::c_uint;
|
||||||
import str::sbuf;
|
import str::sbuf;
|
||||||
import lib::llvm::llvm;
|
import lib::llvm::llvm;
|
||||||
import syntax::codemap;
|
import syntax::codemap;
|
||||||
|
@ -42,7 +43,7 @@ fn AggregateRet(cx: @block_ctxt, RetVals: [ValueRef]) {
|
||||||
cx.terminated = true;
|
cx.terminated = true;
|
||||||
unsafe {
|
unsafe {
|
||||||
llvm::LLVMBuildAggregateRet(B(cx), vec::to_ptr(RetVals),
|
llvm::LLVMBuildAggregateRet(B(cx), vec::to_ptr(RetVals),
|
||||||
vec::len(RetVals));
|
vec::len(RetVals) as c_uint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +67,7 @@ fn Switch(cx: @block_ctxt, V: ValueRef, Else: BasicBlockRef, NumCases: uint)
|
||||||
if cx.unreachable { ret _Undef(V); }
|
if cx.unreachable { ret _Undef(V); }
|
||||||
assert !cx.terminated;
|
assert !cx.terminated;
|
||||||
cx.terminated = true;
|
cx.terminated = true;
|
||||||
ret llvm::LLVMBuildSwitch(B(cx), V, Else, NumCases);
|
ret llvm::LLVMBuildSwitch(B(cx), V, Else, NumCases as c_uint);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn AddCase(S: ValueRef, OnVal: ValueRef, Dest: BasicBlockRef) {
|
fn AddCase(S: ValueRef, OnVal: ValueRef, Dest: BasicBlockRef) {
|
||||||
|
@ -78,7 +79,7 @@ fn IndirectBr(cx: @block_ctxt, Addr: ValueRef, NumDests: uint) {
|
||||||
if cx.unreachable { ret; }
|
if cx.unreachable { ret; }
|
||||||
assert (!cx.terminated);
|
assert (!cx.terminated);
|
||||||
cx.terminated = true;
|
cx.terminated = true;
|
||||||
llvm::LLVMBuildIndirectBr(B(cx), Addr, NumDests);
|
llvm::LLVMBuildIndirectBr(B(cx), Addr, NumDests as c_uint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a really awful way to get a zero-length c-string, but better (and a
|
// This is a really awful way to get a zero-length c-string, but better (and a
|
||||||
|
@ -95,7 +96,7 @@ fn Invoke(cx: @block_ctxt, Fn: ValueRef, Args: [ValueRef],
|
||||||
cx.terminated = true;
|
cx.terminated = true;
|
||||||
unsafe {
|
unsafe {
|
||||||
llvm::LLVMBuildInvoke(B(cx), Fn, vec::to_ptr(Args),
|
llvm::LLVMBuildInvoke(B(cx), Fn, vec::to_ptr(Args),
|
||||||
vec::len(Args), Then, Catch,
|
vec::len(Args) as c_uint, Then, Catch,
|
||||||
noname());
|
noname());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,8 +108,10 @@ fn FastInvoke(cx: @block_ctxt, Fn: ValueRef, Args: [ValueRef],
|
||||||
cx.terminated = true;
|
cx.terminated = true;
|
||||||
unsafe {
|
unsafe {
|
||||||
let v = llvm::LLVMBuildInvoke(B(cx), Fn, vec::to_ptr(Args),
|
let v = llvm::LLVMBuildInvoke(B(cx), Fn, vec::to_ptr(Args),
|
||||||
vec::len(Args), Then, Catch, noname());
|
vec::len(Args) as c_uint,
|
||||||
llvm::LLVMSetInstructionCallConv(v, lib::llvm::LLVMFastCallConv);
|
Then, Catch, noname());
|
||||||
|
llvm::LLVMSetInstructionCallConv(
|
||||||
|
v, lib::llvm::LLVMFastCallConv as c_uint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +311,7 @@ fn Load(cx: @block_ctxt, PointerVal: ValueRef) -> ValueRef {
|
||||||
let ccx = cx.fcx.lcx.ccx;
|
let ccx = cx.fcx.lcx.ccx;
|
||||||
if cx.unreachable {
|
if cx.unreachable {
|
||||||
let ty = val_ty(PointerVal);
|
let ty = val_ty(PointerVal);
|
||||||
let eltty = if llvm::LLVMGetTypeKind(ty) == 11 {
|
let eltty = if llvm::LLVMGetTypeKind(ty) == 11i32 {
|
||||||
llvm::LLVMGetElementType(ty) } else { ccx.int_type };
|
llvm::LLVMGetElementType(ty) } else { ccx.int_type };
|
||||||
ret llvm::LLVMGetUndef(eltty);
|
ret llvm::LLVMGetUndef(eltty);
|
||||||
}
|
}
|
||||||
|
@ -324,7 +327,7 @@ fn GEP(cx: @block_ctxt, Pointer: ValueRef, Indices: [ValueRef]) -> ValueRef {
|
||||||
if cx.unreachable { ret llvm::LLVMGetUndef(T_ptr(T_nil())); }
|
if cx.unreachable { ret llvm::LLVMGetUndef(T_ptr(T_nil())); }
|
||||||
unsafe {
|
unsafe {
|
||||||
ret llvm::LLVMBuildGEP(B(cx), Pointer, vec::to_ptr(Indices),
|
ret llvm::LLVMBuildGEP(B(cx), Pointer, vec::to_ptr(Indices),
|
||||||
vec::len(Indices), noname());
|
vec::len(Indices) as c_uint, noname());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,13 +345,14 @@ fn InBoundsGEP(cx: @block_ctxt, Pointer: ValueRef, Indices: [ValueRef]) ->
|
||||||
unsafe {
|
unsafe {
|
||||||
ret llvm::LLVMBuildInBoundsGEP(B(cx), Pointer,
|
ret llvm::LLVMBuildInBoundsGEP(B(cx), Pointer,
|
||||||
vec::to_ptr(Indices),
|
vec::to_ptr(Indices),
|
||||||
vec::len(Indices), noname());
|
vec::len(Indices) as c_uint,
|
||||||
|
noname());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn StructGEP(cx: @block_ctxt, Pointer: ValueRef, Idx: uint) -> ValueRef {
|
fn StructGEP(cx: @block_ctxt, Pointer: ValueRef, Idx: uint) -> ValueRef {
|
||||||
if cx.unreachable { ret llvm::LLVMGetUndef(T_ptr(T_nil())); }
|
if cx.unreachable { ret llvm::LLVMGetUndef(T_ptr(T_nil())); }
|
||||||
ret llvm::LLVMBuildStructGEP(B(cx), Pointer, Idx, noname());
|
ret llvm::LLVMBuildStructGEP(B(cx), Pointer, Idx as c_uint, noname());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GlobalString(cx: @block_ctxt, _Str: sbuf) -> ValueRef {
|
fn GlobalString(cx: @block_ctxt, _Str: sbuf) -> ValueRef {
|
||||||
|
@ -465,12 +469,12 @@ fn FPCast(cx: @block_ctxt, Val: ValueRef, DestTy: TypeRef) -> ValueRef {
|
||||||
/* Comparisons */
|
/* Comparisons */
|
||||||
fn ICmp(cx: @block_ctxt, Op: uint, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
|
fn ICmp(cx: @block_ctxt, Op: uint, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
|
||||||
if cx.unreachable { ret llvm::LLVMGetUndef(T_i1()); }
|
if cx.unreachable { ret llvm::LLVMGetUndef(T_i1()); }
|
||||||
ret llvm::LLVMBuildICmp(B(cx), Op, LHS, RHS, noname());
|
ret llvm::LLVMBuildICmp(B(cx), Op as c_uint, LHS, RHS, noname());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn FCmp(cx: @block_ctxt, Op: uint, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
|
fn FCmp(cx: @block_ctxt, Op: uint, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
|
||||||
if cx.unreachable { ret llvm::LLVMGetUndef(T_i1()); }
|
if cx.unreachable { ret llvm::LLVMGetUndef(T_i1()); }
|
||||||
ret llvm::LLVMBuildFCmp(B(cx), Op, LHS, RHS, noname());
|
ret llvm::LLVMBuildFCmp(B(cx), Op as c_uint, LHS, RHS, noname());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Miscellaneous instructions */
|
/* Miscellaneous instructions */
|
||||||
|
@ -486,7 +490,7 @@ fn Phi(cx: @block_ctxt, Ty: TypeRef, vals: [ValueRef], bbs: [BasicBlockRef])
|
||||||
let phi = EmptyPhi(cx, Ty);
|
let phi = EmptyPhi(cx, Ty);
|
||||||
unsafe {
|
unsafe {
|
||||||
llvm::LLVMAddIncoming(phi, vec::to_ptr(vals), vec::to_ptr(bbs),
|
llvm::LLVMAddIncoming(phi, vec::to_ptr(vals), vec::to_ptr(bbs),
|
||||||
vec::len(vals));
|
vec::len(vals) as c_uint);
|
||||||
ret phi;
|
ret phi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -496,14 +500,14 @@ fn AddIncomingToPhi(phi: ValueRef, val: ValueRef, bb: BasicBlockRef) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let valptr = unsafe::reinterpret_cast(ptr::addr_of(val));
|
let valptr = unsafe::reinterpret_cast(ptr::addr_of(val));
|
||||||
let bbptr = unsafe::reinterpret_cast(ptr::addr_of(bb));
|
let bbptr = unsafe::reinterpret_cast(ptr::addr_of(bb));
|
||||||
llvm::LLVMAddIncoming(phi, valptr, bbptr, 1u);
|
llvm::LLVMAddIncoming(phi, valptr, bbptr, 1u32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn _UndefReturn(cx: @block_ctxt, Fn: ValueRef) -> ValueRef {
|
fn _UndefReturn(cx: @block_ctxt, Fn: ValueRef) -> ValueRef {
|
||||||
let ccx = cx.fcx.lcx.ccx;
|
let ccx = cx.fcx.lcx.ccx;
|
||||||
let ty = val_ty(Fn);
|
let ty = val_ty(Fn);
|
||||||
let retty = if llvm::LLVMGetTypeKind(ty) == 8 {
|
let retty = if llvm::LLVMGetTypeKind(ty) == 8i32 {
|
||||||
llvm::LLVMGetReturnType(ty) } else { ccx.int_type };
|
llvm::LLVMGetReturnType(ty) } else { ccx.int_type };
|
||||||
ret llvm::LLVMGetUndef(retty);
|
ret llvm::LLVMGetUndef(retty);
|
||||||
}
|
}
|
||||||
|
@ -535,7 +539,7 @@ fn Call(cx: @block_ctxt, Fn: ValueRef, Args: [ValueRef]) -> ValueRef {
|
||||||
if cx.unreachable { ret _UndefReturn(cx, Fn); }
|
if cx.unreachable { ret _UndefReturn(cx, Fn); }
|
||||||
unsafe {
|
unsafe {
|
||||||
ret llvm::LLVMBuildCall(B(cx), Fn, vec::to_ptr(Args),
|
ret llvm::LLVMBuildCall(B(cx), Fn, vec::to_ptr(Args),
|
||||||
vec::len(Args), noname());
|
vec::len(Args) as c_uint, noname());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,18 +547,19 @@ fn FastCall(cx: @block_ctxt, Fn: ValueRef, Args: [ValueRef]) -> ValueRef {
|
||||||
if cx.unreachable { ret _UndefReturn(cx, Fn); }
|
if cx.unreachable { ret _UndefReturn(cx, Fn); }
|
||||||
unsafe {
|
unsafe {
|
||||||
let v = llvm::LLVMBuildCall(B(cx), Fn, vec::to_ptr(Args),
|
let v = llvm::LLVMBuildCall(B(cx), Fn, vec::to_ptr(Args),
|
||||||
vec::len(Args), noname());
|
vec::len(Args) as c_uint, noname());
|
||||||
llvm::LLVMSetInstructionCallConv(v, lib::llvm::LLVMFastCallConv);
|
llvm::LLVMSetInstructionCallConv(
|
||||||
|
v, lib::llvm::LLVMFastCallConv as c_uint);
|
||||||
ret v;
|
ret v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn CallWithConv(cx: @block_ctxt, Fn: ValueRef, Args: [ValueRef], Conv: uint)
|
fn CallWithConv(cx: @block_ctxt, Fn: ValueRef, Args: [ValueRef],
|
||||||
-> ValueRef {
|
Conv: c_uint) -> ValueRef {
|
||||||
if cx.unreachable { ret _UndefReturn(cx, Fn); }
|
if cx.unreachable { ret _UndefReturn(cx, Fn); }
|
||||||
unsafe {
|
unsafe {
|
||||||
let v = llvm::LLVMBuildCall(B(cx), Fn, vec::to_ptr(Args),
|
let v = llvm::LLVMBuildCall(B(cx), Fn, vec::to_ptr(Args),
|
||||||
vec::len(Args), noname());
|
vec::len(Args) as c_uint, noname());
|
||||||
llvm::LLVMSetInstructionCallConv(v, Conv);
|
llvm::LLVMSetInstructionCallConv(v, Conv);
|
||||||
ret v;
|
ret v;
|
||||||
}
|
}
|
||||||
|
@ -591,13 +596,14 @@ fn ShuffleVector(cx: @block_ctxt, V1: ValueRef, V2: ValueRef,
|
||||||
|
|
||||||
fn ExtractValue(cx: @block_ctxt, AggVal: ValueRef, Index: uint) -> ValueRef {
|
fn ExtractValue(cx: @block_ctxt, AggVal: ValueRef, Index: uint) -> ValueRef {
|
||||||
if cx.unreachable { ret llvm::LLVMGetUndef(T_nil()); }
|
if cx.unreachable { ret llvm::LLVMGetUndef(T_nil()); }
|
||||||
ret llvm::LLVMBuildExtractValue(B(cx), AggVal, Index, noname());
|
ret llvm::LLVMBuildExtractValue(B(cx), AggVal, Index as c_uint, noname());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn InsertValue(cx: @block_ctxt, AggVal: ValueRef, EltVal: ValueRef,
|
fn InsertValue(cx: @block_ctxt, AggVal: ValueRef, EltVal: ValueRef,
|
||||||
Index: uint) {
|
Index: uint) {
|
||||||
if cx.unreachable { ret; }
|
if cx.unreachable { ret; }
|
||||||
llvm::LLVMBuildInsertValue(B(cx), AggVal, EltVal, Index, noname());
|
llvm::LLVMBuildInsertValue(B(cx), AggVal, EltVal, Index as c_uint,
|
||||||
|
noname());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn IsNull(cx: @block_ctxt, Val: ValueRef) -> ValueRef {
|
fn IsNull(cx: @block_ctxt, Val: ValueRef) -> ValueRef {
|
||||||
|
@ -628,15 +634,16 @@ fn Trap(cx: @block_ctxt) {
|
||||||
assert (T as int != 0);
|
assert (T as int != 0);
|
||||||
let Args: [ValueRef] = [];
|
let Args: [ValueRef] = [];
|
||||||
unsafe {
|
unsafe {
|
||||||
llvm::LLVMBuildCall(b, T, vec::to_ptr(Args), vec::len(Args),
|
llvm::LLVMBuildCall(b, T, vec::to_ptr(Args),
|
||||||
noname());
|
vec::len(Args) as c_uint, noname());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn LandingPad(cx: @block_ctxt, Ty: TypeRef, PersFn: ValueRef,
|
fn LandingPad(cx: @block_ctxt, Ty: TypeRef, PersFn: ValueRef,
|
||||||
NumClauses: uint) -> ValueRef {
|
NumClauses: uint) -> ValueRef {
|
||||||
assert !cx.terminated && !cx.unreachable;
|
assert !cx.terminated && !cx.unreachable;
|
||||||
ret llvm::LLVMBuildLandingPad(B(cx), Ty, PersFn, NumClauses, noname());
|
ret llvm::LLVMBuildLandingPad(B(cx), Ty, PersFn,
|
||||||
|
NumClauses as c_uint, noname());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn SetCleanup(_cx: @block_ctxt, LandingPad: ValueRef) {
|
fn SetCleanup(_cx: @block_ctxt, LandingPad: ValueRef) {
|
||||||
|
|
|
@ -918,7 +918,7 @@ fn trans_bind_thunk(cx: @local_ctxt,
|
||||||
fcx.lltyparams += [{desc: dsc, dicts: dicts}];
|
fcx.lltyparams += [{desc: dsc, dicts: dicts}];
|
||||||
}
|
}
|
||||||
|
|
||||||
let a: uint = 2u; // retptr, env come first
|
let a: u32 = 2u32; // retptr, env come first
|
||||||
let b: int = starting_idx;
|
let b: int = starting_idx;
|
||||||
let outgoing_arg_index: uint = 0u;
|
let outgoing_arg_index: uint = 0u;
|
||||||
let llout_arg_tys: [TypeRef] =
|
let llout_arg_tys: [TypeRef] =
|
||||||
|
@ -960,7 +960,7 @@ fn trans_bind_thunk(cx: @local_ctxt,
|
||||||
arg = PointerCast(bcx, arg, llout_arg_ty);
|
arg = PointerCast(bcx, arg, llout_arg_ty);
|
||||||
}
|
}
|
||||||
llargs += [arg];
|
llargs += [arg];
|
||||||
a += 1u;
|
a += 1u32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outgoing_arg_index += 1u;
|
outgoing_arg_index += 1u;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import core::{int, vec, str, uint, option, unsafe};
|
import core::{int, vec, str, uint, option, unsafe};
|
||||||
|
import core::ctypes::unsigned;
|
||||||
import vec::to_ptr;
|
import vec::to_ptr;
|
||||||
import std::map::hashmap;
|
import std::map::hashmap;
|
||||||
import option::some;
|
import option::some;
|
||||||
|
@ -410,7 +411,7 @@ fn val_str(tn: type_names, v: ValueRef) -> str { ret ty_str(tn, val_ty(v)); }
|
||||||
|
|
||||||
// Returns the nth element of the given LLVM structure type.
|
// Returns the nth element of the given LLVM structure type.
|
||||||
fn struct_elt(llstructty: TypeRef, n: uint) -> TypeRef unsafe {
|
fn struct_elt(llstructty: TypeRef, n: uint) -> TypeRef unsafe {
|
||||||
let elt_count = llvm::LLVMCountStructElementTypes(llstructty);
|
let elt_count = llvm::LLVMCountStructElementTypes(llstructty) as uint;
|
||||||
assert (n < elt_count);
|
assert (n < elt_count);
|
||||||
let elt_tys = vec::init_elt(T_nil(), elt_count);
|
let elt_tys = vec::init_elt(T_nil(), elt_count);
|
||||||
llvm::LLVMGetStructElementTypes(llstructty, to_ptr(elt_tys));
|
llvm::LLVMGetStructElementTypes(llstructty, to_ptr(elt_tys));
|
||||||
|
@ -533,17 +534,20 @@ fn T_size_t(targ_cfg: @session::config) -> TypeRef {
|
||||||
|
|
||||||
fn T_fn(inputs: [TypeRef], output: TypeRef) -> TypeRef unsafe {
|
fn T_fn(inputs: [TypeRef], output: TypeRef) -> TypeRef unsafe {
|
||||||
ret llvm::LLVMFunctionType(output, to_ptr(inputs),
|
ret llvm::LLVMFunctionType(output, to_ptr(inputs),
|
||||||
vec::len::<TypeRef>(inputs), False);
|
vec::len::<TypeRef>(inputs) as unsigned,
|
||||||
|
False);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn T_fn_pair(cx: @crate_ctxt, tfn: TypeRef) -> TypeRef {
|
fn T_fn_pair(cx: @crate_ctxt, tfn: TypeRef) -> TypeRef {
|
||||||
ret T_struct([T_ptr(tfn), T_opaque_cbox_ptr(cx)]);
|
ret T_struct([T_ptr(tfn), T_opaque_cbox_ptr(cx)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn T_ptr(t: TypeRef) -> TypeRef { ret llvm::LLVMPointerType(t, 0u); }
|
fn T_ptr(t: TypeRef) -> TypeRef {
|
||||||
|
ret llvm::LLVMPointerType(t, 0u as unsigned);
|
||||||
|
}
|
||||||
|
|
||||||
fn T_struct(elts: [TypeRef]) -> TypeRef unsafe {
|
fn T_struct(elts: [TypeRef]) -> TypeRef unsafe {
|
||||||
ret llvm::LLVMStructType(to_ptr(elts), vec::len(elts), False);
|
ret llvm::LLVMStructType(to_ptr(elts), vec::len(elts) as unsigned, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn T_named_struct(name: str) -> TypeRef {
|
fn T_named_struct(name: str) -> TypeRef {
|
||||||
|
@ -552,7 +556,8 @@ fn T_named_struct(name: str) -> TypeRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_struct_body(t: TypeRef, elts: [TypeRef]) unsafe {
|
fn set_struct_body(t: TypeRef, elts: [TypeRef]) unsafe {
|
||||||
llvm::LLVMStructSetBody(t, to_ptr(elts), vec::len(elts), False);
|
llvm::LLVMStructSetBody(t, to_ptr(elts),
|
||||||
|
vec::len(elts) as unsigned, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn T_empty_struct() -> TypeRef { ret T_struct([]); }
|
fn T_empty_struct() -> TypeRef { ret T_struct([]); }
|
||||||
|
@ -634,7 +639,9 @@ fn T_tydesc(targ_cfg: @session::config) -> TypeRef {
|
||||||
ret tydesc;
|
ret tydesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn T_array(t: TypeRef, n: uint) -> TypeRef { ret llvm::LLVMArrayType(t, n); }
|
fn T_array(t: TypeRef, n: uint) -> TypeRef {
|
||||||
|
ret llvm::LLVMArrayType(t, n as unsigned);
|
||||||
|
}
|
||||||
|
|
||||||
// Interior vector.
|
// Interior vector.
|
||||||
//
|
//
|
||||||
|
@ -739,8 +746,8 @@ fn T_opaque_chan_ptr() -> TypeRef { ret T_ptr(T_i8()); }
|
||||||
fn C_null(t: TypeRef) -> ValueRef { ret llvm::LLVMConstNull(t); }
|
fn C_null(t: TypeRef) -> ValueRef { ret llvm::LLVMConstNull(t); }
|
||||||
|
|
||||||
fn C_integral(t: TypeRef, u: u64, sign_extend: Bool) -> ValueRef {
|
fn C_integral(t: TypeRef, u: u64, sign_extend: Bool) -> ValueRef {
|
||||||
let u_hi = (u >> 32u64) as uint;
|
let u_hi = (u >> 32u64) as unsigned;
|
||||||
let u_lo = u as uint;
|
let u_lo = u as unsigned;
|
||||||
ret llvm::LLVMRustConstInt(t, u_hi, u_lo, sign_extend);
|
ret llvm::LLVMRustConstInt(t, u_hi, u_lo, sign_extend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -782,11 +789,9 @@ fn C_u8(i: uint) -> ValueRef { ret C_integral(T_i8(), i as u64, False); }
|
||||||
// This is a 'c-like' raw string, which differs from
|
// This is a 'c-like' raw string, which differs from
|
||||||
// our boxed-and-length-annotated strings.
|
// our boxed-and-length-annotated strings.
|
||||||
fn C_cstr(cx: @crate_ctxt, s: str) -> ValueRef {
|
fn C_cstr(cx: @crate_ctxt, s: str) -> ValueRef {
|
||||||
let sc =
|
let sc = str::as_buf(s) {|buf|
|
||||||
str::as_buf(s,
|
llvm::LLVMConstString(buf, str::byte_len(s) as unsigned, False)
|
||||||
{|buf|
|
};
|
||||||
llvm::LLVMConstString(buf, str::byte_len(s), False)
|
|
||||||
});
|
|
||||||
let g =
|
let g =
|
||||||
str::as_buf(cx.names("str"),
|
str::as_buf(cx.names("str"),
|
||||||
{|buf| llvm::LLVMAddGlobal(cx.llmod, val_ty(sc), buf) });
|
{|buf| llvm::LLVMAddGlobal(cx.llmod, val_ty(sc), buf) });
|
||||||
|
@ -798,10 +803,9 @@ fn C_cstr(cx: @crate_ctxt, s: str) -> ValueRef {
|
||||||
|
|
||||||
// Returns a Plain Old LLVM String:
|
// Returns a Plain Old LLVM String:
|
||||||
fn C_postr(s: str) -> ValueRef {
|
fn C_postr(s: str) -> ValueRef {
|
||||||
ret str::as_buf(s,
|
ret str::as_buf(s) {|buf|
|
||||||
{|buf|
|
llvm::LLVMConstString(buf, str::byte_len(s) as unsigned, False)
|
||||||
llvm::LLVMConstString(buf, str::byte_len(s), False)
|
};
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn C_zero_byte_arr(size: uint) -> ValueRef unsafe {
|
fn C_zero_byte_arr(size: uint) -> ValueRef unsafe {
|
||||||
|
@ -809,28 +813,28 @@ fn C_zero_byte_arr(size: uint) -> ValueRef unsafe {
|
||||||
let elts: [ValueRef] = [];
|
let elts: [ValueRef] = [];
|
||||||
while i < size { elts += [C_u8(0u)]; i += 1u; }
|
while i < size { elts += [C_u8(0u)]; i += 1u; }
|
||||||
ret llvm::LLVMConstArray(T_i8(), vec::to_ptr(elts),
|
ret llvm::LLVMConstArray(T_i8(), vec::to_ptr(elts),
|
||||||
vec::len(elts));
|
vec::len(elts) as unsigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn C_struct(elts: [ValueRef]) -> ValueRef unsafe {
|
fn C_struct(elts: [ValueRef]) -> ValueRef unsafe {
|
||||||
ret llvm::LLVMConstStruct(vec::to_ptr(elts), vec::len(elts),
|
ret llvm::LLVMConstStruct(vec::to_ptr(elts), vec::len(elts) as unsigned,
|
||||||
False);
|
False);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn C_named_struct(T: TypeRef, elts: [ValueRef]) -> ValueRef unsafe {
|
fn C_named_struct(T: TypeRef, elts: [ValueRef]) -> ValueRef unsafe {
|
||||||
ret llvm::LLVMConstNamedStruct(T, vec::to_ptr(elts),
|
ret llvm::LLVMConstNamedStruct(T, vec::to_ptr(elts),
|
||||||
vec::len(elts));
|
vec::len(elts) as unsigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn C_array(ty: TypeRef, elts: [ValueRef]) -> ValueRef unsafe {
|
fn C_array(ty: TypeRef, elts: [ValueRef]) -> ValueRef unsafe {
|
||||||
ret llvm::LLVMConstArray(ty, vec::to_ptr(elts),
|
ret llvm::LLVMConstArray(ty, vec::to_ptr(elts),
|
||||||
vec::len(elts));
|
vec::len(elts) as unsigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn C_bytes(bytes: [u8]) -> ValueRef unsafe {
|
fn C_bytes(bytes: [u8]) -> ValueRef unsafe {
|
||||||
ret llvm::LLVMConstString(
|
ret llvm::LLVMConstString(
|
||||||
unsafe::reinterpret_cast(vec::to_ptr(bytes)),
|
unsafe::reinterpret_cast(vec::to_ptr(bytes)),
|
||||||
vec::len(bytes), False);
|
vec::len(bytes) as unsigned, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn C_shape(ccx: @crate_ctxt, bytes: [u8]) -> ValueRef {
|
fn C_shape(ccx: @crate_ctxt, bytes: [u8]) -> ValueRef {
|
||||||
|
|
|
@ -138,7 +138,7 @@ fn trans_iface_callee(bcx: @block_ctxt, fld_expr: @ast::expr,
|
||||||
fn llfn_arg_tys(ft: TypeRef) -> {inputs: [TypeRef], output: TypeRef} {
|
fn llfn_arg_tys(ft: TypeRef) -> {inputs: [TypeRef], output: TypeRef} {
|
||||||
let out_ty = llvm::LLVMGetReturnType(ft);
|
let out_ty = llvm::LLVMGetReturnType(ft);
|
||||||
let n_args = llvm::LLVMCountParamTypes(ft);
|
let n_args = llvm::LLVMCountParamTypes(ft);
|
||||||
let args = vec::init_elt(0 as TypeRef, n_args);
|
let args = vec::init_elt(0 as TypeRef, n_args as uint);
|
||||||
unsafe { llvm::LLVMGetParamTypes(ft, vec::to_ptr(args)); }
|
unsafe { llvm::LLVMGetParamTypes(ft, vec::to_ptr(args)); }
|
||||||
{inputs: args, output: out_ty}
|
{inputs: args, output: out_ty}
|
||||||
}
|
}
|
||||||
|
@ -191,19 +191,20 @@ fn trans_impl_wrapper(ccx: @crate_ctxt, pt: [ast::ident],
|
||||||
vec::slice(real_args, 2u + vec::len(extra_ptrs), vec::len(real_args));
|
vec::slice(real_args, 2u + vec::len(extra_ptrs), vec::len(real_args));
|
||||||
let llfn_ty = T_fn(wrap_args, real_ret);
|
let llfn_ty = T_fn(wrap_args, real_ret);
|
||||||
trans_wrapper(ccx, pt, llfn_ty, {|llfn, bcx|
|
trans_wrapper(ccx, pt, llfn_ty, {|llfn, bcx|
|
||||||
let dict = PointerCast(bcx, LLVMGetParam(llfn, 0u), env_ty);
|
let dict = PointerCast(bcx, LLVMGetParam(llfn, 0u32), env_ty);
|
||||||
// retptr, self
|
// retptr, self
|
||||||
let args = [LLVMGetParam(llfn, 1u), LLVMGetParam(llfn, 2u)], i = 0u;
|
let args = [LLVMGetParam(llfn, 1u32), LLVMGetParam(llfn, 2u32)];
|
||||||
|
let i = 0u;
|
||||||
// saved tydescs/dicts
|
// saved tydescs/dicts
|
||||||
while i < n_extra_ptrs {
|
while i < n_extra_ptrs {
|
||||||
i += 1u;
|
i += 1u;
|
||||||
args += [load_inbounds(bcx, dict, [0, i as int])];
|
args += [load_inbounds(bcx, dict, [0, i as int])];
|
||||||
}
|
}
|
||||||
// the rest of the parameters
|
// the rest of the parameters
|
||||||
let i = 3u, params_total = llvm::LLVMCountParamTypes(llfn_ty);
|
let i = 3u32, params_total = llvm::LLVMCountParamTypes(llfn_ty);
|
||||||
while i < params_total {
|
while i < params_total {
|
||||||
args += [LLVMGetParam(llfn, i)];
|
args += [LLVMGetParam(llfn, i)];
|
||||||
i += 1u;
|
i += 1u32;
|
||||||
}
|
}
|
||||||
Call(bcx, real_fn, args);
|
Call(bcx, real_fn, args);
|
||||||
bcx
|
bcx
|
||||||
|
@ -231,7 +232,7 @@ fn trans_iface_wrapper(ccx: @crate_ctxt, pt: [ast::ident], m: ty::method,
|
||||||
n: uint) -> ValueRef {
|
n: uint) -> ValueRef {
|
||||||
let {llty: llfty, _} = wrapper_fn_ty(ccx, T_ptr(T_i8()), m);
|
let {llty: llfty, _} = wrapper_fn_ty(ccx, T_ptr(T_i8()), m);
|
||||||
trans_wrapper(ccx, pt, llfty, {|llfn, bcx|
|
trans_wrapper(ccx, pt, llfty, {|llfn, bcx|
|
||||||
let self = Load(bcx, PointerCast(bcx, LLVMGetParam(llfn, 2u),
|
let self = Load(bcx, PointerCast(bcx, LLVMGetParam(llfn, 2u32),
|
||||||
T_ptr(T_opaque_iface_ptr(ccx))));
|
T_ptr(T_opaque_iface_ptr(ccx))));
|
||||||
let boxed = GEPi(bcx, self, [0, abi::box_rc_field_body]);
|
let boxed = GEPi(bcx, self, [0, abi::box_rc_field_body]);
|
||||||
let dict = Load(bcx, PointerCast(bcx, GEPi(bcx, boxed, [0, 1]),
|
let dict = Load(bcx, PointerCast(bcx, GEPi(bcx, boxed, [0, 1]),
|
||||||
|
@ -242,12 +243,12 @@ fn trans_iface_wrapper(ccx: @crate_ctxt, pt: [ast::ident], m: ty::method,
|
||||||
// FIXME[impl] This doesn't account for more-than-ptr-sized alignment
|
// FIXME[impl] This doesn't account for more-than-ptr-sized alignment
|
||||||
let inner_self = GEPi(bcx, boxed, [0, 2]);
|
let inner_self = GEPi(bcx, boxed, [0, 2]);
|
||||||
let args = [PointerCast(bcx, dict, T_ptr(T_i8())),
|
let args = [PointerCast(bcx, dict, T_ptr(T_i8())),
|
||||||
LLVMGetParam(llfn, 1u),
|
LLVMGetParam(llfn, 1u32),
|
||||||
PointerCast(bcx, inner_self, T_opaque_cbox_ptr(ccx))];
|
PointerCast(bcx, inner_self, T_opaque_cbox_ptr(ccx))];
|
||||||
let i = 3u, total = llvm::LLVMCountParamTypes(llfty);
|
let i = 3u32, total = llvm::LLVMCountParamTypes(llfty);
|
||||||
while i < total {
|
while i < total {
|
||||||
args += [LLVMGetParam(llfn, i)];
|
args += [LLVMGetParam(llfn, i)];
|
||||||
i += 1u;
|
i += 1u32;
|
||||||
}
|
}
|
||||||
Call(bcx, mptr, args);
|
Call(bcx, mptr, args);
|
||||||
bcx
|
bcx
|
||||||
|
|
|
@ -33,7 +33,7 @@ native mod rustrt {
|
||||||
target_task: task::task, target_port: port_id,
|
target_task: task::task, target_port: port_id,
|
||||||
data: T) -> ctypes::uintptr_t;
|
data: T) -> ctypes::uintptr_t;
|
||||||
|
|
||||||
fn new_port(unit_sz: uint) -> *rust_port;
|
fn new_port(unit_sz: ctypes::size_t) -> *rust_port;
|
||||||
fn del_port(po: *rust_port);
|
fn del_port(po: *rust_port);
|
||||||
fn rust_port_detach(po: *rust_port);
|
fn rust_port_detach(po: *rust_port);
|
||||||
fn get_port_id(po: *rust_port) -> port_id;
|
fn get_port_id(po: *rust_port) -> port_id;
|
||||||
|
|
|
@ -6,7 +6,7 @@ Unsafe pointer utility functions
|
||||||
#[abi = "rust-intrinsic"]
|
#[abi = "rust-intrinsic"]
|
||||||
native mod rusti {
|
native mod rusti {
|
||||||
fn addr_of<T>(val: T) -> *T;
|
fn addr_of<T>(val: T) -> *T;
|
||||||
fn ptr_offset<T>(ptr: *T, count: uint) -> *T;
|
fn ptr_offset<T>(ptr: *T, count: ctypes::uintptr_t) -> *T;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -16,12 +16,12 @@ native mod rustrt {
|
||||||
// available outside this crate. Otherwise it's
|
// available outside this crate. Otherwise it's
|
||||||
// visible-in-crate, but not re-exported.
|
// visible-in-crate, but not re-exported.
|
||||||
fn last_os_error() -> str;
|
fn last_os_error() -> str;
|
||||||
fn refcount<T>(t: @T) -> uint;
|
fn refcount<T>(t: @T) -> ctypes::intptr_t;
|
||||||
fn do_gc();
|
fn do_gc();
|
||||||
fn unsupervise();
|
fn unsupervise();
|
||||||
fn shape_log_str<T>(t: *sys::type_desc, data: T) -> str;
|
fn shape_log_str<T>(t: *sys::type_desc, data: T) -> str;
|
||||||
fn rust_set_exit_status(code: int);
|
fn rust_set_exit_status(code: ctypes::intptr_t);
|
||||||
fn set_min_stack(size: uint);
|
fn set_min_stack(size: ctypes::uintptr_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[abi = "rust-intrinsic"]
|
#[abi = "rust-intrinsic"]
|
||||||
|
@ -103,7 +103,7 @@ fn log_str<T>(t: T) -> str {
|
||||||
with the default failure status."
|
with the default failure status."
|
||||||
)]
|
)]
|
||||||
fn set_exit_status(code: int) {
|
fn set_exit_status(code: int) {
|
||||||
rustrt::rust_set_exit_status(code);
|
rustrt::rust_set_exit_status(code as ctypes::intptr_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: #1495 - This shouldn't exist
|
// FIXME: #1495 - This shouldn't exist
|
||||||
|
|
|
@ -55,7 +55,7 @@ export try;
|
||||||
#[abi = "rust-intrinsic"]
|
#[abi = "rust-intrinsic"]
|
||||||
native mod rusti {
|
native mod rusti {
|
||||||
// these must run on the Rust stack so that they can swap stacks etc:
|
// these must run on the Rust stack so that they can swap stacks etc:
|
||||||
fn task_sleep(task: *rust_task, time_in_us: uint, &killed: bool);
|
fn task_sleep(task: *rust_task, time_in_us: c::size_t, &killed: bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
type rust_closure = {
|
type rust_closure = {
|
||||||
|
|
|
@ -8,17 +8,17 @@ import ptr::addr_of;
|
||||||
|
|
||||||
#[abi = "rust-intrinsic"]
|
#[abi = "rust-intrinsic"]
|
||||||
native mod rusti {
|
native mod rusti {
|
||||||
fn vec_len<T>(&&v: [const T]) -> uint;
|
fn vec_len<T>(&&v: [const T]) -> ctypes::size_t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[abi = "cdecl"]
|
#[abi = "cdecl"]
|
||||||
native mod rustrt {
|
native mod rustrt {
|
||||||
fn vec_reserve_shared<T>(t: *sys::type_desc,
|
fn vec_reserve_shared<T>(t: *sys::type_desc,
|
||||||
&v: [const T],
|
&v: [const T],
|
||||||
n: uint);
|
n: ctypes::size_t);
|
||||||
fn vec_from_buf_shared<T>(t: *sys::type_desc,
|
fn vec_from_buf_shared<T>(t: *sys::type_desc,
|
||||||
ptr: *T,
|
ptr: *T,
|
||||||
count: uint) -> [T];
|
count: ctypes::size_t) -> [T];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -14,7 +14,8 @@ native mod rustrt {
|
||||||
fn debug_opaque<T>(td: *sys::type_desc, x: T);
|
fn debug_opaque<T>(td: *sys::type_desc, x: T);
|
||||||
fn debug_box<T>(td: *sys::type_desc, x: @T);
|
fn debug_box<T>(td: *sys::type_desc, x: @T);
|
||||||
fn debug_tag<T>(td: *sys::type_desc, x: T);
|
fn debug_tag<T>(td: *sys::type_desc, x: T);
|
||||||
fn debug_obj<T>(td: *sys::type_desc, x: T, nmethods: uint, nbytes: uint);
|
fn debug_obj<T>(td: *sys::type_desc, x: T,
|
||||||
|
nmethods: ctypes::size_t, nbytes: ctypes::size_t);
|
||||||
fn debug_fn<T>(td: *sys::type_desc, x: T);
|
fn debug_fn<T>(td: *sys::type_desc, x: T);
|
||||||
fn debug_ptrcast<T, U>(td: *sys::type_desc, x: @T) -> @U;
|
fn debug_ptrcast<T, U>(td: *sys::type_desc, x: @T) -> @U;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@ import os_fs;
|
||||||
|
|
||||||
#[abi = "cdecl"]
|
#[abi = "cdecl"]
|
||||||
native mod rustrt {
|
native mod rustrt {
|
||||||
fn rust_path_is_dir(path: str::sbuf) -> int;
|
fn rust_path_is_dir(path: str::sbuf) -> ctypes::c_int;
|
||||||
fn rust_path_exists(path: str::sbuf) -> int;
|
fn rust_path_exists(path: str::sbuf) -> ctypes::c_int;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -120,7 +120,7 @@ Function: path_is_dir
|
||||||
Indicates whether a path represents a directory.
|
Indicates whether a path represents a directory.
|
||||||
*/
|
*/
|
||||||
fn path_is_dir(p: path) -> bool {
|
fn path_is_dir(p: path) -> bool {
|
||||||
ret str::as_buf(p, {|buf| rustrt::rust_path_is_dir(buf) != 0 });
|
ret str::as_buf(p, {|buf| rustrt::rust_path_is_dir(buf) != 0i32 });
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -129,7 +129,7 @@ Function: path_exists
|
||||||
Indicates whether a path exists.
|
Indicates whether a path exists.
|
||||||
*/
|
*/
|
||||||
fn path_exists(p: path) -> bool {
|
fn path_exists(p: path) -> bool {
|
||||||
ret str::as_buf(p, {|buf| rustrt::rust_path_exists(buf) != 0 });
|
ret str::as_buf(p, {|buf| rustrt::rust_path_exists(buf) != 0i32 });
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
import result::{ok, err};
|
import result::{ok, err};
|
||||||
import io::writer_util;
|
import io::writer_util;
|
||||||
|
import core::ctypes;
|
||||||
|
|
||||||
export test_name;
|
export test_name;
|
||||||
export test_fn;
|
export test_fn;
|
||||||
|
@ -28,7 +29,7 @@ export joinable;
|
||||||
|
|
||||||
#[abi = "cdecl"]
|
#[abi = "cdecl"]
|
||||||
native mod rustrt {
|
native mod rustrt {
|
||||||
fn sched_threads() -> uint;
|
fn sched_threads() -> ctypes::size_t;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The name of a test. By convention this follows the rules for rust
|
// The name of a test. By convention this follows the rules for rust
|
||||||
|
|
Loading…
Reference in New Issue