mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-04 05:17:07 +00:00 
			
		
		
		
	(defined by the x32 ABI) mode, in which case its pointers are 32-bits in size. This knowledge is also added to X86RegisterInfo that now returns the appropriate registers in getPointerRegClass. There are many outcomes to this change. In order to keep the patches separate and manageable, we start by focusing on some simple testable cases. The patch adds a test with passing a pointer to a function - focusing on the difference between the two data models for x86-64. Another test is added for handling of 'sret' arguments (and functionality is added in X86ISelLowering to make it work). A note on naming: the "x32 ABI" document refers to the AMD64 architecture (in LLVM it's distinguished by being is64Bits() in the x86 subtarget) with two variations: the LP64 (default) data model, and the ILP32 data model. This patch adds predicates to the subtarget which are consistent with this naming scheme. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173503 91177308-0d34-0410-b5e6-96231b3b80d8
		
			
				
	
	
		
			30 lines
		
	
	
		
			686 B
		
	
	
	
		
			LLVM
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			686 B
		
	
	
	
		
			LLVM
		
	
	
	
	
	
; RUN: llc -mtriple=x86_64-pc-linux < %s | FileCheck %s
 | 
						|
; RUN: llc -mtriple=x86_64-pc-linux-gnux32 < %s | FileCheck -check-prefix=X32ABI %s
 | 
						|
 | 
						|
; %in is kept in %esi for both ABIs. But the pointer will be passed in %edi
 | 
						|
; for x32, not %rdi
 | 
						|
 | 
						|
; CHECK: movl %esi, (%rdi)
 | 
						|
; X32ABI: movl %esi, (%edi)
 | 
						|
 | 
						|
define void @foo(i32* nocapture %out, i32 %in) nounwind {
 | 
						|
entry:
 | 
						|
  store i32 %in, i32* %out, align 4
 | 
						|
  ret void
 | 
						|
}
 | 
						|
 | 
						|
; CHECK: bar
 | 
						|
; CHECK: movl (%rsi), %eax
 | 
						|
 | 
						|
; Similarly here, but for loading
 | 
						|
; X32ABI: bar
 | 
						|
; X32ABI: movl (%esi), %eax
 | 
						|
 | 
						|
define void @bar(i32* nocapture %pOut, i32* nocapture %pIn) nounwind {
 | 
						|
entry:
 | 
						|
  %0 = load i32* %pIn, align 4
 | 
						|
  store i32 %0, i32* %pOut, align 4
 | 
						|
  ret void
 | 
						|
}
 | 
						|
 |