summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Core.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-07-14 19:09:08 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-07-14 19:09:08 +0000
commit784ad24bad4764ba99b68f6eaf7eda83be6c97ce (patch)
tree8c32df782a31f099f6a4b554809b7751fdb8562c /llvm/lib/VMCore/Core.cpp
parent9c61809c2369d78ddf118295229b69cf8bef050f (diff)
downloadbcm5719-llvm-784ad24bad4764ba99b68f6eaf7eda83be6c97ce.tar.gz
bcm5719-llvm-784ad24bad4764ba99b68f6eaf7eda83be6c97ce.zip
Add LLVMConstNamedStruct to the C api to let its users create constants
of named struct types. llvm-svn: 135178
Diffstat (limited to 'llvm/lib/VMCore/Core.cpp')
-rw-r--r--llvm/lib/VMCore/Core.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Core.cpp b/llvm/lib/VMCore/Core.cpp
index b59f6c78c52..f5bec303a4e 100644
--- a/llvm/lib/VMCore/Core.cpp
+++ b/llvm/lib/VMCore/Core.cpp
@@ -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)));
OpenPOWER on IntegriCloud