mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-31 08:16:47 +00:00 
			
		
		
		
	git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33000 91177308-0d34-0410-b5e6-96231b3b80d8
		
			
				
	
	
		
			35 lines
		
	
	
		
			751 B
		
	
	
	
		
			LLVM
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			751 B
		
	
	
	
		
			LLVM
		
	
	
	
	
	
| ; RUN: llvm-upgrade < %s | llvm-as | llvm-dis > %t1.ll
 | |
| ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
 | |
| ; RUN: diff %t1.ll %t2.ll
 | |
| 
 | |
| %FunTy = type int(int)
 | |
| 
 | |
| declare int "test"(int)   ; Test forward declaration merging
 | |
| 
 | |
| implementation
 | |
| 
 | |
| void "invoke"(%FunTy *%x) {
 | |
| 	%foo = call %FunTy* %x(int 123)
 | |
| 	%foo2 = tail call %FunTy* %x(int 123)
 | |
| 	ret void
 | |
| }
 | |
| 
 | |
| int "main"(int %argc)   ; TODO: , sbyte **argv, sbyte **envp)
 | |
| begin
 | |
|         %retval = call int (int) *%test(int %argc)
 | |
|         %two    = add int %retval, %retval
 | |
| 	%retval2 = invoke int %test(int %argc)
 | |
| 		   to label %Next except label %Error
 | |
| Next:
 | |
| 	%two2 = add int %two, %retval2
 | |
| 	call void %invoke (%FunTy* %test)
 | |
|         ret int %two2
 | |
| Error:
 | |
| 	ret int -1
 | |
| end
 | |
| 
 | |
| int "test"(int %i0)
 | |
| begin
 | |
|     ret int %i0
 | |
| end
 |