From af632c91a0090d8448dd10e48d8ce53f31be0a21 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 5 Apr 2010 23:11:24 +0000 Subject: add .o file writing for inline asm in llc. Here's a silly demo: $ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o :1:2: error: unrecognized instruction abc incl %eax ^ LLVM ERROR: Error parsing inline asm Only problem seems to be that the parser finalizes OutStreamer at the end of the first inline asm, which isn't what we want. For example: $ cat asm.c int foo(int X) { __asm__ ("incl %0" : "+r" (X)); return X; } $ clang asm.c -S -o - -emit-llvm | llc ... subq $8, %rsp movl %edi, (%rsp) movl %edi, %eax ## InlineAsm Start incl %eax ## InlineAsm End movl %eax, (%rsp) movl %eax, 4(%rsp) addq $8, %rsp ret $ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o $ otool -tv t.o t.o: (__TEXT,__text) section _foo: 0000000000000000 subq $0x08,%rsp 0000000000000004 movl %edi,(%rsp) 0000000000000007 movl %edi,%eax 0000000000000009 incl %eax $ don't stop at inc! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100491 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llc/llc.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tools/llc') diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index aa977a7032..dccfb26e74 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -214,6 +214,7 @@ int main(int argc, char **argv) { // Initialize targets first, so that --version shows registered targets. InitializeAllTargets(); InitializeAllAsmPrinters(); + InitializeAllAsmParsers(); cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n"); -- cgit v1.2.3