[llvm-commits] [compiler-rt] r93815 - in /compiler-rt/trunk/lib/arm: restore_vfp_d8_d15_regs.S save_restore_d8_d15.S save_vfp_d8_d15_regs.S switch.S switch16.S switch32.S switch8.S switchu8.S
Daniel Dunbar
daniel at zuster.org
Mon Jan 18 16:01:10 PST 2010
Author: ddunbar
Date: Mon Jan 18 18:01:10 2010
New Revision: 93815
URL: http://llvm.org/viewvc/llvm-project?rev=93815&view=rev
Log:
Split up switch.S and save_restore_d8_d15.S to follow one function per file convention.
Added:
compiler-rt/trunk/lib/arm/restore_vfp_d8_d15_regs.S
- copied, changed from r93790, compiler-rt/trunk/lib/arm/save_restore_d8_d15.S
compiler-rt/trunk/lib/arm/save_vfp_d8_d15_regs.S
- copied, changed from r93790, compiler-rt/trunk/lib/arm/save_restore_d8_d15.S
compiler-rt/trunk/lib/arm/switch16.S
compiler-rt/trunk/lib/arm/switch32.S
compiler-rt/trunk/lib/arm/switch8.S
compiler-rt/trunk/lib/arm/switchu8.S
Removed:
compiler-rt/trunk/lib/arm/save_restore_d8_d15.S
compiler-rt/trunk/lib/arm/switch.S
Copied: compiler-rt/trunk/lib/arm/restore_vfp_d8_d15_regs.S (from r93790, compiler-rt/trunk/lib/arm/save_restore_d8_d15.S)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/restore_vfp_d8_d15_regs.S?p2=compiler-rt/trunk/lib/arm/restore_vfp_d8_d15_regs.S&p1=compiler-rt/trunk/lib/arm/save_restore_d8_d15.S&r1=93790&r2=93815&rev=93815&view=diff
==============================================================================
--- compiler-rt/trunk/lib/arm/save_restore_d8_d15.S (original)
+++ compiler-rt/trunk/lib/arm/restore_vfp_d8_d15_regs.S Mon Jan 18 18:01:10 2010
@@ -11,25 +11,16 @@
//
// When compiling C++ functions that need to handle thrown exceptions the
-// compiler is required to save all registers and call __Unwind_SjLj_Register
-// in the function prolog. But when compiling for thumb1, there are
+// compiler is required to save all registers and call __Unwind_SjLj_Register
+// in the function prolog. But when compiling for thumb1, there are
// no instructions to access the floating point registers, so the
// compiler needs to add a call to the helper function _save_vfp_d8_d15_regs
-// written in ARM to save the float registers. In the epilog, the compiler
+// written in ARM to save the float registers. In the epilog, the compiler
// must also add a call to __restore_vfp_d8_d15_regs to restore those registers.
//
.text
- .syntax unified
-
-//
-// Save registers d8-d15 onto stack
-//
-DEFINE_COMPILERRT_PRIVATE_FUNCTION(__save_vfp_d8_d15_regs)
- vstmdb sp!, {d8-d15} // push registers d8-d15 onto stack
- bx lr // return to prolog
-
-
+ .syntax unified
//
// Restore registers d8-d15 from stack
@@ -42,4 +33,4 @@
// tell linker it can break up file at label boundaries
.subsections_via_symbols
-
+
Removed: compiler-rt/trunk/lib/arm/save_restore_d8_d15.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/save_restore_d8_d15.S?rev=93814&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/save_restore_d8_d15.S (original)
+++ compiler-rt/trunk/lib/arm/save_restore_d8_d15.S (removed)
@@ -1,45 +0,0 @@
-//===-- save_restore_regs.S - Implement save/restore* ---------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "../assembly.h"
-
-//
-// When compiling C++ functions that need to handle thrown exceptions the
-// compiler is required to save all registers and call __Unwind_SjLj_Register
-// in the function prolog. But when compiling for thumb1, there are
-// no instructions to access the floating point registers, so the
-// compiler needs to add a call to the helper function _save_vfp_d8_d15_regs
-// written in ARM to save the float registers. In the epilog, the compiler
-// must also add a call to __restore_vfp_d8_d15_regs to restore those registers.
-//
-
- .text
- .syntax unified
-
-//
-// Save registers d8-d15 onto stack
-//
-DEFINE_COMPILERRT_PRIVATE_FUNCTION(__save_vfp_d8_d15_regs)
- vstmdb sp!, {d8-d15} // push registers d8-d15 onto stack
- bx lr // return to prolog
-
-
-
-//
-// Restore registers d8-d15 from stack
-//
-DEFINE_COMPILERRT_PRIVATE_FUNCTION(__restore_vfp_d8_d15_regs)
- vldmia sp!, {d8-d15} // pop registers d8-d15 off stack
- bx lr // return to prolog
-
-
-
- // tell linker it can break up file at label boundaries
- .subsections_via_symbols
-
Copied: compiler-rt/trunk/lib/arm/save_vfp_d8_d15_regs.S (from r93790, compiler-rt/trunk/lib/arm/save_restore_d8_d15.S)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/save_vfp_d8_d15_regs.S?p2=compiler-rt/trunk/lib/arm/save_vfp_d8_d15_regs.S&p1=compiler-rt/trunk/lib/arm/save_restore_d8_d15.S&r1=93790&r2=93815&rev=93815&view=diff
==============================================================================
--- compiler-rt/trunk/lib/arm/save_restore_d8_d15.S (original)
+++ compiler-rt/trunk/lib/arm/save_vfp_d8_d15_regs.S Mon Jan 18 18:01:10 2010
@@ -11,16 +11,16 @@
//
// When compiling C++ functions that need to handle thrown exceptions the
-// compiler is required to save all registers and call __Unwind_SjLj_Register
-// in the function prolog. But when compiling for thumb1, there are
+// compiler is required to save all registers and call __Unwind_SjLj_Register
+// in the function prolog. But when compiling for thumb1, there are
// no instructions to access the floating point registers, so the
// compiler needs to add a call to the helper function _save_vfp_d8_d15_regs
-// written in ARM to save the float registers. In the epilog, the compiler
+// written in ARM to save the float registers. In the epilog, the compiler
// must also add a call to __restore_vfp_d8_d15_regs to restore those registers.
//
.text
- .syntax unified
+ .syntax unified
//
// Save registers d8-d15 onto stack
@@ -29,17 +29,6 @@
vstmdb sp!, {d8-d15} // push registers d8-d15 onto stack
bx lr // return to prolog
-
-
-//
-// Restore registers d8-d15 from stack
-//
-DEFINE_COMPILERRT_PRIVATE_FUNCTION(__restore_vfp_d8_d15_regs)
- vldmia sp!, {d8-d15} // pop registers d8-d15 off stack
- bx lr // return to prolog
-
-
-
// tell linker it can break up file at label boundaries
.subsections_via_symbols
-
+
Removed: compiler-rt/trunk/lib/arm/switch.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/switch.S?rev=93814&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/switch.S (original)
+++ compiler-rt/trunk/lib/arm/switch.S (removed)
@@ -1,87 +0,0 @@
-//===-- switch.S - Implement switch* --------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "../assembly.h"
-
-//
-// When compiling switch statements in thumb mode, the compiler
-// can use these __switch* helper functions The compiler emits a blx to
-// the __switch* function followed by a table of displacements for each
-// case statement. On entry, R0 is the index into the table. The __switch*
-// function uses the return address in lr to find the start of the table.
-// The first entry in the table is the count of the entries in the table.
-// It then uses R0 to index into the table and get the displacement of the
-// address to jump to. If R0 is greater than the size of the table, it jumps
-// to the last entry in the table. Each displacement in the table is actually
-// the distance from lr to the label, thus making the tables PIC.
-
-
- .text
- .syntax unified
-
-//
-// The table contains unsigned byte sized elements which are 1/2 the distance
-// from lr to the target label.
-//
-DEFINE_COMPILERRT_PRIVATE_FUNCTION(__switchu8)
- ldrb ip, [lr, #-1] // get first byte in table
- cmp r0, ip // compare with index
- ldrbcc r0, [lr, r0] // get indexed byte out of table
- ldrbhs r0, [lr, ip] // if out of range, use last entry in table
- add ip, lr, r0, lsl #1 // compute label = lr + element*2
- bx ip // jump to computed label
-
-
-
-//
-// The table contains signed byte sized elements which are 1/2 the distance
-// from lr to the target label.
-//
-DEFINE_COMPILERRT_PRIVATE_FUNCTION(__switch8)
- ldrb ip, [lr, #-1] // get first byte in table
- cmp r0, ip // signed compare with index
- ldrsbcc r0, [lr, r0] // get indexed byte out of table
- ldrsbhs r0, [lr, ip] // if out of range, use last entry in table
- add ip, lr, r0, lsl #1 // compute label = lr + element*2
- bx ip // jump to computed label
-
-
-//
-// The table contains signed 2-byte sized elements which are 1/2 the distance
-// from lr to the target label.
-//
-DEFINE_COMPILERRT_PRIVATE_FUNCTION(__switch16)
- ldrh ip, [lr, #-1] // get first 16-bit word in table
- cmp r0, ip // compare with index
- add r0, lr, r0, lsl #1 // compute address of element in table
- ldrshcc r0, [r0, #1] // load 16-bit element if r0 is in range
- add ip, lr, ip, lsl #1 // compute address of last element in table
- ldrshhs r0, [ip, #1] // load 16-bit element if r0 out of range
- add ip, lr, r0, lsl #1 // compute label = lr + element*2
- bx ip // jump to computed label
-
-
-//
-// The table contains signed 4-byte sized elements which are the distance
-// from lr to the target label.
-//
-DEFINE_COMPILERRT_PRIVATE_FUNCTION(__switch32)
- ldr ip, [lr, #-1] // get first 32-bit word in table
- cmp r0, ip // compare with index
- add r0, lr, r0, lsl #2 // compute address of element in table
- ldrcc r0, [r0, #3] // load 32-bit element if r0 is in range
- add ip, lr, ip, lsl #2 // compute address of last element in table
- ldrcs r0, [ip, #3] // load 32-bit element if r0 out of range
- add ip, lr, r0 // compute label = lr + element
- bx ip // jump to computed label
-
-
- // tell linker it can break up file at label boundaries
- .subsections_via_symbols
-
Added: compiler-rt/trunk/lib/arm/switch16.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/switch16.S?rev=93815&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/switch16.S (added)
+++ compiler-rt/trunk/lib/arm/switch16.S Mon Jan 18 18:01:10 2010
@@ -0,0 +1,43 @@
+//===-- switch.S - Implement switch* --------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "../assembly.h"
+
+//
+// When compiling switch statements in thumb mode, the compiler
+// can use these __switch* helper functions The compiler emits a blx to
+// the __switch* function followed by a table of displacements for each
+// case statement. On entry, R0 is the index into the table. The __switch*
+// function uses the return address in lr to find the start of the table.
+// The first entry in the table is the count of the entries in the table.
+// It then uses R0 to index into the table and get the displacement of the
+// address to jump to. If R0 is greater than the size of the table, it jumps
+// to the last entry in the table. Each displacement in the table is actually
+// the distance from lr to the label, thus making the tables PIC.
+
+
+ .text
+ .syntax unified
+
+//
+// The table contains signed 2-byte sized elements which are 1/2 the distance
+// from lr to the target label.
+//
+DEFINE_COMPILERRT_PRIVATE_FUNCTION(__switch16)
+ ldrh ip, [lr, #-1] // get first 16-bit word in table
+ cmp r0, ip // compare with index
+ add r0, lr, r0, lsl #1 // compute address of element in table
+ ldrshcc r0, [r0, #1] // load 16-bit element if r0 is in range
+ add ip, lr, ip, lsl #1 // compute address of last element in table
+ ldrshhs r0, [ip, #1] // load 16-bit element if r0 out of range
+ add ip, lr, r0, lsl #1 // compute label = lr + element*2
+ bx ip // jump to computed label
+
+ // tell linker it can break up file at label boundaries
+ .subsections_via_symbols
Added: compiler-rt/trunk/lib/arm/switch32.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/switch32.S?rev=93815&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/switch32.S (added)
+++ compiler-rt/trunk/lib/arm/switch32.S Mon Jan 18 18:01:10 2010
@@ -0,0 +1,45 @@
+//===-- switch.S - Implement switch* --------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "../assembly.h"
+
+//
+// When compiling switch statements in thumb mode, the compiler
+// can use these __switch* helper functions The compiler emits a blx to
+// the __switch* function followed by a table of displacements for each
+// case statement. On entry, R0 is the index into the table. The __switch*
+// function uses the return address in lr to find the start of the table.
+// The first entry in the table is the count of the entries in the table.
+// It then uses R0 to index into the table and get the displacement of the
+// address to jump to. If R0 is greater than the size of the table, it jumps
+// to the last entry in the table. Each displacement in the table is actually
+// the distance from lr to the label, thus making the tables PIC.
+
+
+ .text
+ .syntax unified
+
+//
+// The table contains signed 4-byte sized elements which are the distance
+// from lr to the target label.
+//
+DEFINE_COMPILERRT_PRIVATE_FUNCTION(__switch32)
+ ldr ip, [lr, #-1] // get first 32-bit word in table
+ cmp r0, ip // compare with index
+ add r0, lr, r0, lsl #2 // compute address of element in table
+ ldrcc r0, [r0, #3] // load 32-bit element if r0 is in range
+ add ip, lr, ip, lsl #2 // compute address of last element in table
+ ldrcs r0, [ip, #3] // load 32-bit element if r0 out of range
+ add ip, lr, r0 // compute label = lr + element
+ bx ip // jump to computed label
+
+
+ // tell linker it can break up file at label boundaries
+ .subsections_via_symbols
+
Added: compiler-rt/trunk/lib/arm/switch8.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/switch8.S?rev=93815&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/switch8.S (added)
+++ compiler-rt/trunk/lib/arm/switch8.S Mon Jan 18 18:01:10 2010
@@ -0,0 +1,42 @@
+//===-- switch.S - Implement switch* --------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "../assembly.h"
+
+//
+// When compiling switch statements in thumb mode, the compiler
+// can use these __switch* helper functions The compiler emits a blx to
+// the __switch* function followed by a table of displacements for each
+// case statement. On entry, R0 is the index into the table. The __switch*
+// function uses the return address in lr to find the start of the table.
+// The first entry in the table is the count of the entries in the table.
+// It then uses R0 to index into the table and get the displacement of the
+// address to jump to. If R0 is greater than the size of the table, it jumps
+// to the last entry in the table. Each displacement in the table is actually
+// the distance from lr to the label, thus making the tables PIC.
+
+
+ .text
+ .syntax unified
+
+//
+// The table contains signed byte sized elements which are 1/2 the distance
+// from lr to the target label.
+//
+DEFINE_COMPILERRT_PRIVATE_FUNCTION(__switch8)
+ ldrb ip, [lr, #-1] // get first byte in table
+ cmp r0, ip // signed compare with index
+ ldrsbcc r0, [lr, r0] // get indexed byte out of table
+ ldrsbhs r0, [lr, ip] // if out of range, use last entry in table
+ add ip, lr, r0, lsl #1 // compute label = lr + element*2
+ bx ip // jump to computed label
+
+ // tell linker it can break up file at label boundaries
+ .subsections_via_symbols
+
Added: compiler-rt/trunk/lib/arm/switchu8.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/switchu8.S?rev=93815&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/switchu8.S (added)
+++ compiler-rt/trunk/lib/arm/switchu8.S Mon Jan 18 18:01:10 2010
@@ -0,0 +1,42 @@
+//===-- switch.S - Implement switch* --------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "../assembly.h"
+
+//
+// When compiling switch statements in thumb mode, the compiler
+// can use these __switch* helper functions The compiler emits a blx to
+// the __switch* function followed by a table of displacements for each
+// case statement. On entry, R0 is the index into the table. The __switch*
+// function uses the return address in lr to find the start of the table.
+// The first entry in the table is the count of the entries in the table.
+// It then uses R0 to index into the table and get the displacement of the
+// address to jump to. If R0 is greater than the size of the table, it jumps
+// to the last entry in the table. Each displacement in the table is actually
+// the distance from lr to the label, thus making the tables PIC.
+
+
+ .text
+ .syntax unified
+
+//
+// The table contains unsigned byte sized elements which are 1/2 the distance
+// from lr to the target label.
+//
+DEFINE_COMPILERRT_PRIVATE_FUNCTION(__switchu8)
+ ldrb ip, [lr, #-1] // get first byte in table
+ cmp r0, ip // compare with index
+ ldrbcc r0, [lr, r0] // get indexed byte out of table
+ ldrbhs r0, [lr, ip] // if out of range, use last entry in table
+ add ip, lr, r0, lsl #1 // compute label = lr + element*2
+ bx ip // jump to computed label
+
+ // tell linker it can break up file at label boundaries
+ .subsections_via_symbols
+
More information about the llvm-commits
mailing list