Added API for reading assembly (.ll) files

git-svn-id: http://llvm-py.googlecode.com/svn/trunk@35 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
mdevan.foobar 2008-09-08 13:09:43 +00:00
commit c10b1b58c3
10 changed files with 82 additions and 18 deletions

View file

@ -20,6 +20,7 @@
#include "llvm/Support/CallSite.h"
#include "llvm/IntrinsicInst.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Assembly/Parser.h"
// +includes for passes
#include "llvm/PassManager.h"
#include "llvm/Analysis/LoopPass.h"
@ -110,6 +111,20 @@ LLVMValueRef LLVMGetIntrinsic(LLVMModuleRef M, int ID,
return wrap(intfunc);
}
LLVMModuleRef LLVMGetModuleFromAssembly(const char *A, unsigned Len,
char **OutMessage)
{
ParseError e;
Module *MP = ParseAssemblyString(A, NULL /*unused within!*/, &e);
if (!MP) {
*OutMessage = strdup(e.getMessage().c_str());
return NULL;
}
return wrap(MP);
}
LLVMModuleRef LLVMGetModuleFromBitcode(const char *BC, unsigned Len,
char **OutMessage)
{