summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-05 23:11:24 +0000
committerChris Lattner <sabre@nondot.org>2010-04-05 23:11:24 +0000
commit8900ef1931d236d354d2c413ea19ebdd6c3b488f (patch)
treedd7339d631627fd42230cc5c44dd01320bf2badb /llvm/tools
parentbdc3f3415000dcb0fc021233f0e2e7d66855dd13 (diff)
downloadbcm5719-llvm-8900ef1931d236d354d2c413ea19ebdd6c3b488f.tar.gz
bcm5719-llvm-8900ef1931d236d354d2c413ea19ebdd6c3b488f.zip
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 <inline asm>: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! llvm-svn: 100491
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llc/llc.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index aa977a7032c..dccfb26e745 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/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");
OpenPOWER on IntegriCloud