rustc: Fall back to intrinsics.ll if we can't parse the bc
This will allow us to transition to the new bitcode format.
This commit is contained in:
parent
143f87899b
commit
9a188b2e94
4 changed files with 61 additions and 4 deletions
|
@ -12,9 +12,11 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===
|
||||
|
||||
#include "llvm/LLVMContext.h"
|
||||
#include "llvm/Linker.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/Assembly/Parser.h"
|
||||
#include "llvm/Assembly/PrintModulePass.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Support/Timer.h"
|
||||
|
@ -22,6 +24,7 @@
|
|||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Support/TargetSelect.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include "llvm/Support/Host.h"
|
||||
#include "llvm-c/Core.h"
|
||||
|
@ -109,6 +112,18 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
|
|||
delete Target;
|
||||
}
|
||||
|
||||
extern "C" LLVMModuleRef LLVMRustParseAssemblyFile(const char *Filename) {
|
||||
|
||||
SMDiagnostic d;
|
||||
Module *m = ParseAssemblyFile(Filename, d, getGlobalContext());
|
||||
if (m) {
|
||||
return wrap(m);
|
||||
} else {
|
||||
LLVMRustError = d.getMessage().c_str();
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" LLVMModuleRef LLVMRustParseBitcode(LLVMMemoryBufferRef MemBuf) {
|
||||
LLVMModuleRef M;
|
||||
return LLVMParseBitcode(MemBuf, &M, const_cast<char **>(&LLVMRustError))
|
||||
|
|
|
@ -6,6 +6,7 @@ LLVMRustGetHostTriple
|
|||
LLVMRustConstSmallInt
|
||||
LLVMRustConstInt
|
||||
LLVMRustParseBitcode
|
||||
LLVMRustParseAssemblyFile
|
||||
LLVMRustPrintPassTimings
|
||||
LLVMRustEnableSegmentedStacks
|
||||
LLVMLinkModules
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue