Daniel Dunbar
							
						 
						
							 
							
							
							
							
								
							
							
								3439ed6324 
								
							 
						 
						
							
							
								
								Inline Asm: Ensure buffer is newline terminated to match how the text is printed.  
							
							 
							
							... 
							
							
							
							- This is a hack, but I can't decide the best place to handle this. Chris?
llvm-svn: 103765 
							
						 
						
							2010-05-14 04:31:50 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								294a90d87a 
								
							 
						 
						
							
							
								
								implicit defs get added to the end of machine instrs sometimes.  Scan the whole instruction for the metadata operand instead of assuming it will be at the end of the instruction.  
							
							 
							
							... 
							
							
							
							llvm-svn: 100792 
							
						 
						
							2010-04-08 18:20:52 +00:00  
						
					 
				
					
						
							
							
								 
								Benjamin Kramer
							
						 
						
							 
							
							
							
							
								
							
							
								a6769269f3 
								
							 
						 
						
							
							
								
								Use twines to simplify calls to report_fatal_error. For code size and readability.  
							
							 
							
							... 
							
							
							
							llvm-svn: 100756 
							
						 
						
							2010-04-08 10:44:28 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								1e45789ee0 
								
							 
						 
						
							
							
								
								introduce a new recoverable error handling API to LLVMContext  
							
							 
							
							... 
							
							
							
							and use it in one place in inline asm handling stuff.  Before
we'd generate this for an invalid modifier letter:
$ clang asm.c -c -o t.o
fatal error: error in backend: Invalid operand found in inline asm: 'abc incl    ${0:Z}'
INLINEASM <es:abc incl    ${0:Z}>, 10, %EAX<def>, 2147483657, %EAX, 14, %EFLAGS<earlyclobber,def,dead>, <!-1>
Now we generate this:
$ clang asm.c -c -o t.o
error: invalid operand in inline asm: 'incl    ${0:Z}'
asm.c:3:12: note: generated from here
  __asm__ ("incl    %Z0" : "+r" (X));
           ^
1 error generated.
This is much better but still admittedly not great ("why" is the operand 
invalid??), codegen should try harder with its diagnostics :)
llvm-svn: 100723 
							
						 
						
							2010-04-07 23:40:44 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								2104b8d36e 
								
							 
						 
						
							
							
								
								rename llvm::llvm_report_error -> llvm::report_fatal_error  
							
							 
							
							... 
							
							
							
							llvm-svn: 100709 
							
						 
						
							2010-04-07 22:58:41 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								51065568cd 
								
							 
						 
						
							
							
								
								Have the inst emitter add the !srcloc mdnode to the machine instr.  
							
							 
							
							... 
							
							
							
							Have the asmprinter use the mdnode to scavenge a source location if
present.  Document this nonsense in langref.
llvm-svn: 100607 
							
						 
						
							2010-04-07 05:38:05 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								d62adaa54d 
								
							 
						 
						
							
							
								
								remove another magic number.  
							
							 
							
							... 
							
							
							
							llvm-svn: 100606 
							
						 
						
							2010-04-07 05:27:36 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								92aba5a817 
								
							 
						 
						
							
							
								
								propagate cookie management out one layer of function calls.  
							
							 
							
							... 
							
							
							
							llvm-svn: 100510 
							
						 
						
							2010-04-06 00:58:50 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								59126b2500 
								
							 
						 
						
							
							
								
								report errors through LLVMContext's inline asm handler if available.  
							
							 
							
							... 
							
							
							
							llvm-svn: 100509 
							
						 
						
							2010-04-06 00:55:39 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								3b21e4d404 
								
							 
						 
						
							
							
								
								Give AsmParser an option to control whether it finalizes  
							
							 
							
							... 
							
							
							
							the stream.  New demo:
$ 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
000000000000000b	movl	%eax,(%rsp)
000000000000000e	movl	%eax,0x04(%rsp)
0000000000000012	addq	$0x08,%rsp
0000000000000016	ret
llvm-svn: 100492 
							
						 
						
							2010-04-05 23:15:42 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								8900ef1931 
								
							 
						 
						
							
							
								
								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 
							
						 
						
							2010-04-05 23:11:24 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								0e45d24a4e 
								
							 
						 
						
							
							
								
								stringref-ize the MemoryBuffer::get apis.  This requires  
							
							 
							
							... 
							
							
							
							a co-committed clang patch.
llvm-svn: 100485 
							
						 
						
							2010-04-05 22:42:30 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								9efd118938 
								
							 
						 
						
							
							
								
								move uleb/sleb printing into AsmPrinter from DwarfPrinter.  
							
							 
							
							... 
							
							
							
							llvm-svn: 100344 
							
						 
						
							2010-04-04 19:09:29 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								baa2c972e9 
								
							 
						 
						
							
							
								
								use stringref instead of strtol to avoid errno gymnastics.  
							
							 
							
							... 
							
							
							
							llvm-svn: 100341 
							
						 
						
							2010-04-04 18:42:18 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								1e15869d1f 
								
							 
						 
						
							
							
								
								split inline asm support out to its own .cpp file.  
							
							 
							
							... 
							
							
							
							llvm-svn: 100340 
							
						 
						
							2010-04-04 18:34:07 +00:00