mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-30 04:56:49 +00:00
Hook up -filetype=obj through the MachO streamer. Here's a demo:
$ cat t.ll @g = global i32 42 $ llc t.ll -o t.o -filetype=obj $ nm t.o 00000000 D _g There is still a ton of work left. Instructions are not being encoded yet apparently. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95162 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
985d45dea3
commit
ac7798e906
@ -282,7 +282,7 @@ namespace llvm {
|
|||||||
/// createMachOStream - Create a machine code streamer which will generative
|
/// createMachOStream - Create a machine code streamer which will generative
|
||||||
/// Mach-O format object files.
|
/// Mach-O format object files.
|
||||||
MCStreamer *createMachOStreamer(MCContext &Ctx, raw_ostream &OS,
|
MCStreamer *createMachOStreamer(MCContext &Ctx, raw_ostream &OS,
|
||||||
MCCodeEmitter *CE = 0);
|
MCCodeEmitter *CE);
|
||||||
|
|
||||||
/// createELFStreamer - Create a machine code streamer which will generative
|
/// createELFStreamer - Create a machine code streamer which will generative
|
||||||
/// ELF format object files.
|
/// ELF format object files.
|
||||||
|
@ -124,23 +124,30 @@ LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
|||||||
OwningPtr<MCStreamer> AsmStreamer;
|
OwningPtr<MCStreamer> AsmStreamer;
|
||||||
|
|
||||||
switch (FileType) {
|
switch (FileType) {
|
||||||
default:
|
default: return CGFT_ErrorOccurred;
|
||||||
case CGFT_ObjectFile:
|
case CGFT_AssemblyFile:
|
||||||
return CGFT_ErrorOccurred;
|
|
||||||
case CGFT_AssemblyFile: {
|
|
||||||
AsmStreamer.reset(createAsmStreamer(*Context, Out, *getMCAsmInfo(),
|
AsmStreamer.reset(createAsmStreamer(*Context, Out, *getMCAsmInfo(),
|
||||||
getTargetData()->isLittleEndian(),
|
getTargetData()->isLittleEndian(),
|
||||||
getVerboseAsm(), /*instprinter*/0,
|
getVerboseAsm(), /*instprinter*/0,
|
||||||
/*codeemitter*/0));
|
/*codeemitter*/0));
|
||||||
break;
|
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);
|
||||||
|
if (MCE == 0)
|
||||||
|
return CGFT_ErrorOccurred;
|
||||||
|
|
||||||
|
AsmStreamer.reset(createMachOStreamer(*Context, Out, MCE));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the AsmPrinter, which takes ownership of Context and AsmStreamer
|
// Create the AsmPrinter, which takes ownership of Context and AsmStreamer
|
||||||
// if successful.
|
// if successful.
|
||||||
FunctionPass *Printer =
|
FunctionPass *Printer =
|
||||||
getTarget().createAsmPrinter(Out, *this, *Context, *AsmStreamer,
|
getTarget().createAsmPrinter(Out, *this, *Context, *AsmStreamer,
|
||||||
getMCAsmInfo());
|
getMCAsmInfo());
|
||||||
if (Printer == 0)
|
if (Printer == 0)
|
||||||
return CGFT_ErrorOccurred;
|
return CGFT_ErrorOccurred;
|
||||||
|
|
||||||
|
@ -360,6 +360,7 @@ int main(int argc, char **argv) {
|
|||||||
sys::Path(OutputFilename).eraseFromDisk();
|
sys::Path(OutputFilename).eraseFromDisk();
|
||||||
return 1;
|
return 1;
|
||||||
case TargetMachine::CGFT_AssemblyFile:
|
case TargetMachine::CGFT_AssemblyFile:
|
||||||
|
case TargetMachine::CGFT_ObjectFile:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user