- MCContext *Context = new MCContext();
- MCStreamer *AsmStreamer =
- createAsmStreamer(*Context, Out, *getMCAsmInfo(),
- getTargetData()->isLittleEndian(),
- getVerboseAsm(),
- /*instprinter*/0,
- /*codeemitter*/0);
+ MCInstPrinter *InstPrinter =
+ getTarget().createMCInstPrinter(MAI.getAssemblerDialect(), MAI);
+ AsmStreamer.reset(createAsmStreamer(*Context, Out,
+ getTargetData()->isLittleEndian(),
+ getVerboseAsm(), InstPrinter,
+ /*codeemitter*/0));
+ break;
+ }
+ case CGFT_ObjectFile: {
+ // Create the code emitter for the target if it exists. If not, .o file
+ // emission fails.
+ MCCodeEmitter *MCE = getTarget().createCodeEmitter(*this, *Context);
+ TargetAsmBackend *TAB = getTarget().createAsmBackend(TargetTriple);
+ if (MCE == 0 || TAB == 0)
+ return true;