mirror of
https://github.com/ziglang/zig.git
synced 2026-01-07 05:55:36 +00:00
llvm: convert attributes and non-intrinsic calls
This commit is contained in:
parent
23a806102a
commit
aa44f8f0fd
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -26,10 +26,13 @@ pub const Context = opaque {
|
||||
extern fn LLVMContextDispose(C: *Context) void;
|
||||
|
||||
pub const createEnumAttribute = LLVMCreateEnumAttribute;
|
||||
extern fn LLVMCreateEnumAttribute(*Context, KindID: c_uint, Val: u64) *Attribute;
|
||||
extern fn LLVMCreateEnumAttribute(C: *Context, KindID: c_uint, Val: u64) *Attribute;
|
||||
|
||||
pub const createTypeAttribute = LLVMCreateTypeAttribute;
|
||||
extern fn LLVMCreateTypeAttribute(C: *Context, KindID: c_uint, Type: *Type) *Attribute;
|
||||
|
||||
pub const createStringAttribute = LLVMCreateStringAttribute;
|
||||
extern fn LLVMCreateStringAttribute(*Context, Key: [*]const u8, Key_Len: c_uint, Value: [*]const u8, Value_Len: c_uint) *Attribute;
|
||||
extern fn LLVMCreateStringAttribute(C: *Context, Key: [*]const u8, Key_Len: c_uint, Value: [*]const u8, Value_Len: c_uint) *Attribute;
|
||||
|
||||
pub const pointerType = LLVMPointerTypeInContext;
|
||||
extern fn LLVMPointerTypeInContext(C: *Context, AddressSpace: c_uint) *Type;
|
||||
@ -309,12 +312,18 @@ pub const Value = opaque {
|
||||
pub const setAlignment = LLVMSetAlignment;
|
||||
extern fn LLVMSetAlignment(V: *Value, Bytes: c_uint) void;
|
||||
|
||||
pub const getFunctionCallConv = LLVMGetFunctionCallConv;
|
||||
extern fn LLVMGetFunctionCallConv(Fn: *Value) CallConv;
|
||||
|
||||
pub const setFunctionCallConv = LLVMSetFunctionCallConv;
|
||||
extern fn LLVMSetFunctionCallConv(Fn: *Value, CC: CallConv) void;
|
||||
|
||||
pub const setInstructionCallConv = LLVMSetInstructionCallConv;
|
||||
extern fn LLVMSetInstructionCallConv(Instr: *Value, CC: CallConv) void;
|
||||
|
||||
pub const setTailCallKind = ZigLLVMSetTailCallKind;
|
||||
extern fn ZigLLVMSetTailCallKind(CallInst: *Value, TailCallKind: TailCallKind) void;
|
||||
|
||||
pub const addCallSiteAttribute = LLVMAddCallSiteAttribute;
|
||||
extern fn LLVMAddCallSiteAttribute(C: *Value, Idx: AttributeIndex, A: *Attribute) void;
|
||||
|
||||
pub const fnSetSubprogram = ZigLLVMFnSetSubprogram;
|
||||
extern fn ZigLLVMFnSetSubprogram(f: *Value, subprogram: *DISubprogram) void;
|
||||
|
||||
@ -642,7 +651,17 @@ pub const Builder = opaque {
|
||||
Name: [*:0]const u8,
|
||||
) *Value;
|
||||
|
||||
pub const buildCall = ZigLLVMBuildCall;
|
||||
pub const buildCall = LLVMBuildCall2;
|
||||
extern fn LLVMBuildCall2(
|
||||
*Builder,
|
||||
*Type,
|
||||
Fn: *Value,
|
||||
Args: [*]const *Value,
|
||||
NumArgs: c_uint,
|
||||
Name: [*:0]const u8,
|
||||
) *Value;
|
||||
|
||||
pub const buildCallOld = ZigLLVMBuildCall;
|
||||
extern fn ZigLLVMBuildCall(
|
||||
*Builder,
|
||||
*Type,
|
||||
@ -1605,6 +1624,13 @@ pub const CallAttr = enum(c_int) {
|
||||
AlwaysInline,
|
||||
};
|
||||
|
||||
pub const TailCallKind = enum(c_uint) {
|
||||
None,
|
||||
Tail,
|
||||
MustTail,
|
||||
NoTail,
|
||||
};
|
||||
|
||||
pub const DLLStorageClass = enum(c_uint) {
|
||||
Default,
|
||||
DLLImport,
|
||||
|
||||
@ -453,6 +453,10 @@ LLVMValueRef ZigLLVMBuildCall(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn,
|
||||
return wrap(call_inst);
|
||||
}
|
||||
|
||||
ZIG_EXTERN_C void ZigLLVMSetTailCallKind(LLVMValueRef Call, CallInst::TailCallKind TailCallKind) {
|
||||
unwrap<CallInst>(Call)->setTailCallKind(TailCallKind);
|
||||
}
|
||||
|
||||
void ZigLLVMAddAttributeAtIndex(LLVMValueRef Val, unsigned Idx, LLVMAttributeRef A) {
|
||||
if (isa<Function>(unwrap(Val))) {
|
||||
unwrap<Function>(Val)->addAttributeAtIndex(Idx, unwrap(A));
|
||||
@ -461,7 +465,6 @@ void ZigLLVMAddAttributeAtIndex(LLVMValueRef Val, unsigned Idx, LLVMAttributeRef
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LLVMValueRef ZigLLVMBuildMemCpy(LLVMBuilderRef B, LLVMValueRef Dst, unsigned DstAlign,
|
||||
LLVMValueRef Src, unsigned SrcAlign, LLVMValueRef Size, bool isVolatile)
|
||||
{
|
||||
@ -1116,11 +1119,6 @@ void ZigLLVMAddFunctionAttr(LLVMValueRef fn_ref, const char *attr_name, const ch
|
||||
func->addFnAttr(attr_name, attr_value);
|
||||
}
|
||||
|
||||
void ZigLLVMAddFunctionAttrCold(LLVMValueRef fn_ref) {
|
||||
Function *func = unwrap<Function>(fn_ref);
|
||||
func->addFnAttr(Attribute::Cold);
|
||||
}
|
||||
|
||||
void ZigLLVMParseCommandLineOptions(size_t argc, const char *const *argv) {
|
||||
cl::ParseCommandLineOptions(argc, argv);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user