1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

add C api for hte new type system rewrite API. Patch by Vitaly Lugovskiy!

llvm-svn: 135132
This commit is contained in:
Chris Lattner 2011-07-14 05:53:17 +00:00
parent 3d2be55d6c
commit bd1cea5fe4
2 changed files with 17 additions and 1 deletions

View File

@ -387,6 +387,10 @@ LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes,
unsigned ElementCount, LLVMBool Packed);
LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount,
LLVMBool Packed);
LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const char *Name);
void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes,
unsigned ElementCount, LLVMBool Packed);
unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy);
void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest);
LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy);
@ -408,7 +412,6 @@ LLVMTypeRef LLVMX86MMXTypeInContext(LLVMContextRef C);
LLVMTypeRef LLVMVoidType(void);
LLVMTypeRef LLVMLabelType(void);
LLVMTypeRef LLVMOpaqueType(void);
LLVMTypeRef LLVMX86MMXType(void);
/*===-- Values ------------------------------------------------------------===*/

View File

@ -304,6 +304,19 @@ LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes,
ElementCount, Packed);
}
LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const char *Name)
{
return wrap(StructType::createNamed(*unwrap(C), Name));
}
void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes,
unsigned ElementCount, LLVMBool Packed) {
std::vector<Type*> Tys;
for (LLVMTypeRef *I = ElementTypes,
*E = ElementTypes + ElementCount; I != E; ++I)
Tys.push_back(unwrap(*I));
unwrap<StructType>(StructTy)->setBody(Tys, Packed != 0);
}
unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy) {
return unwrap<StructType>(StructTy)->getNumElements();