mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-03 14:21:30 +00:00 
			
		
		
		
	Disable FP elimination in funcs using 32-bit MSVC EH personalities
The value in 'ebp' acts as an implicit argument to the outlined handlers, and is recovered with frameaddress(1). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238619 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		@@ -155,6 +155,11 @@ bool WinEHStatePass::runOnFunction(Function &F) {
 | 
			
		||||
  if (!isMSVCEHPersonality(Personality))
 | 
			
		||||
    return false;
 | 
			
		||||
 | 
			
		||||
  // Disable frame pointer elimination in this function.
 | 
			
		||||
  // FIXME: Do the nested handlers need to keep the parent ebp in ebp, or can we
 | 
			
		||||
  // use an arbitrary register?
 | 
			
		||||
  F.addFnAttr("no-frame-pointer-elim", "true");
 | 
			
		||||
 | 
			
		||||
  emitExceptionRegistrationRecord(&F);
 | 
			
		||||
 | 
			
		||||
  auto *MMIPtr = getAnalysisIfAvailable<MachineModuleInfo>();
 | 
			
		||||
 
 | 
			
		||||
@@ -90,14 +90,14 @@ eh.resume:                                        ; preds = %catch.dispatch.4
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
; CHECK-LABEL: _f:
 | 
			
		||||
; CHECK: movl $-1, [[state:[0-9]+]](%esp)
 | 
			
		||||
; CHECK: movl $-1, [[state:[-0-9]+]](%ebp)
 | 
			
		||||
; CHECK: movl $___ehhandler$f, {{.*}}
 | 
			
		||||
;
 | 
			
		||||
; CHECK: movl $0, [[state]](%esp)
 | 
			
		||||
; CHECK: movl $0, [[state]](%ebp)
 | 
			
		||||
; CHECK: movl $1, (%esp)
 | 
			
		||||
; CHECK: calll _may_throw
 | 
			
		||||
;
 | 
			
		||||
; CHECK: movl $1, [[state]](%esp)
 | 
			
		||||
; CHECK: movl $1, [[state]](%ebp)
 | 
			
		||||
; CHECK: movl $2, (%esp)
 | 
			
		||||
; CHECK: calll _may_throw
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -19,16 +19,18 @@ catchall:
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
; CHECK-LABEL: _use_except_handler3:
 | 
			
		||||
; CHECK: pushl %ebp
 | 
			
		||||
; CHECK: movl %esp, %ebp
 | 
			
		||||
; CHECK: subl ${{[0-9]+}}, %esp
 | 
			
		||||
; CHECK: movl $-1, 12(%esp)
 | 
			
		||||
; CHECK: movl $L__ehtable$use_except_handler3, 8(%esp)
 | 
			
		||||
; CHECK: movl $__except_handler3, 4(%esp)
 | 
			
		||||
; CHECK: movl $-1, -4(%ebp)
 | 
			
		||||
; CHECK: movl $L__ehtable$use_except_handler3, -8(%ebp)
 | 
			
		||||
; CHECK: movl $__except_handler3, -12(%ebp)
 | 
			
		||||
; CHECK: movl %fs:0, %[[next:[^ ,]*]]
 | 
			
		||||
; CHECK: movl %[[next]], (%esp)
 | 
			
		||||
; CHECK: leal (%esp), %[[node:[^ ,]*]]
 | 
			
		||||
; CHECK: movl %[[next]], -16(%ebp)
 | 
			
		||||
; CHECK: leal -16(%ebp), %[[node:[^ ,]*]]
 | 
			
		||||
; CHECK: movl %[[node]], %fs:0
 | 
			
		||||
; CHECK: calll _may_throw_or_crash
 | 
			
		||||
; CHECK: movl (%esp), %[[next:[^ ,]*]]
 | 
			
		||||
; CHECK: movl -16(%ebp), %[[next:[^ ,]*]]
 | 
			
		||||
; CHECK: movl %[[next]], %fs:0
 | 
			
		||||
; CHECK: retl
 | 
			
		||||
 | 
			
		||||
@@ -44,17 +46,19 @@ catchall:
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
; CHECK-LABEL: _use_except_handler4:
 | 
			
		||||
; CHECK: pushl %ebp
 | 
			
		||||
; CHECK: movl %esp, %ebp
 | 
			
		||||
; CHECK: subl ${{[0-9]+}}, %esp
 | 
			
		||||
; CHECK: movl %esp, (%esp)
 | 
			
		||||
; CHECK: movl $-1, 20(%esp)
 | 
			
		||||
; CHECK: movl $L__ehtable$use_except_handler4, 4(%esp)
 | 
			
		||||
; CHECK: leal 8(%esp), %[[node:[^ ,]*]]
 | 
			
		||||
; CHECK: movl $__except_handler4, 12(%esp)
 | 
			
		||||
; CHECK: movl %esp, -24(%ebp)
 | 
			
		||||
; CHECK: movl $-1, -4(%ebp)
 | 
			
		||||
; CHECK: movl $L__ehtable$use_except_handler4, -20(%ebp)
 | 
			
		||||
; CHECK: leal -16(%ebp), %[[node:[^ ,]*]]
 | 
			
		||||
; CHECK: movl $__except_handler4, -12(%ebp)
 | 
			
		||||
; CHECK: movl %fs:0, %[[next:[^ ,]*]]
 | 
			
		||||
; CHECK: movl %[[next]], 8(%esp)
 | 
			
		||||
; CHECK: movl %[[next]], -16(%ebp)
 | 
			
		||||
; CHECK: movl %[[node]], %fs:0
 | 
			
		||||
; CHECK: calll _may_throw_or_crash
 | 
			
		||||
; CHECK: movl 8(%esp), %[[next:[^ ,]*]]
 | 
			
		||||
; CHECK: movl -16(%ebp), %[[next:[^ ,]*]]
 | 
			
		||||
; CHECK: movl %[[next]], %fs:0
 | 
			
		||||
; CHECK: retl
 | 
			
		||||
 | 
			
		||||
@@ -73,17 +77,19 @@ catchall:
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
; CHECK-LABEL: _use_CxxFrameHandler3:
 | 
			
		||||
; CHECK: pushl %ebp
 | 
			
		||||
; CHECK: movl %esp, %ebp
 | 
			
		||||
; CHECK: subl ${{[0-9]+}}, %esp
 | 
			
		||||
; CHECK: movl %esp, (%esp)
 | 
			
		||||
; CHECK: movl $-1, 12(%esp)
 | 
			
		||||
; CHECK: leal 4(%esp), %[[node:[^ ,]*]]
 | 
			
		||||
; CHECK: movl $___ehhandler$use_CxxFrameHandler3, 8(%esp)
 | 
			
		||||
; CHECK: movl %esp, -16(%ebp)
 | 
			
		||||
; CHECK: movl $-1, -4(%ebp)
 | 
			
		||||
; CHECK: leal -12(%ebp), %[[node:[^ ,]*]]
 | 
			
		||||
; CHECK: movl $___ehhandler$use_CxxFrameHandler3, -8(%ebp)
 | 
			
		||||
; CHECK: movl %fs:0, %[[next:[^ ,]*]]
 | 
			
		||||
; CHECK: movl %[[next]], 4(%esp)
 | 
			
		||||
; CHECK: movl %[[next]], -12(%ebp)
 | 
			
		||||
; CHECK: movl %[[node]], %fs:0
 | 
			
		||||
; CHECK: movl $0, 12(%esp)
 | 
			
		||||
; CHECK: movl $0, -4(%ebp)
 | 
			
		||||
; CHECK: calll _may_throw_or_crash
 | 
			
		||||
; CHECK: movl 4(%esp), %[[next:[^ ,]*]]
 | 
			
		||||
; CHECK: movl -12(%ebp), %[[next:[^ ,]*]]
 | 
			
		||||
; CHECK: movl %[[next]], %fs:0
 | 
			
		||||
; CHECK: retl
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user