mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-13 15:37:24 +00:00
Add LLVMConstNamedStruct to the C api to let its users create constants
of named struct types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135178 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
939f616e63
commit
64090bd2d4
@ -565,6 +565,9 @@ LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy,
|
||||
LLVMValueRef *ConstantVals, unsigned Length);
|
||||
LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
|
||||
LLVMBool Packed);
|
||||
LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy,
|
||||
LLVMValueRef *ConstantVals,
|
||||
unsigned Count);
|
||||
LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size);
|
||||
|
||||
/* Constant expressions */
|
||||
|
@ -595,6 +595,16 @@ LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
|
||||
return LLVMConstStructInContext(LLVMGetGlobalContext(), ConstantVals, Count,
|
||||
Packed);
|
||||
}
|
||||
|
||||
LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy,
|
||||
LLVMValueRef *ConstantVals,
|
||||
unsigned Count) {
|
||||
Constant **Elements = unwrap<Constant>(ConstantVals, Count);
|
||||
const StructType *Ty = cast<StructType>(unwrap(StructTy));
|
||||
|
||||
return wrap(ConstantStruct::get(Ty, ArrayRef<Constant*>(Elements, Count)));
|
||||
}
|
||||
|
||||
LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size) {
|
||||
return wrap(ConstantVector::get(ArrayRef<Constant*>(
|
||||
unwrap<Constant>(ScalarConstantVals, Size), Size)));
|
||||
|
Loading…
x
Reference in New Issue
Block a user