Bump for 3.6-28
[LibreOffice.git] / bridges / source / cpp_uno / gcc3_ios_arm / generate-snippets.pl
blob2e6d6fefaeadba71a876be14a4bea2d7646845bf
1 #!/usr/bin/perl -w
3 # Version: MPL 1.1 / GPLv3+ / LGPLv3+
5 # The contents of this file are subject to the Mozilla Public License Version
6 # 1.1 (the "License"); you may not use this file except in compliance with
7 # the License or as specified alternatively below. You may obtain a copy of
8 # the License at http://www.mozilla.org/MPL/
10 # Software distributed under the License is distributed on an "AS IS" basis,
11 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 # for the specific language governing rights and limitations under the
13 # License.
15 # The Initial Developer of the Original Code is
16 # Tor Lillqvist <tml@iki.fi>
17 # Portions created by the Initial Developer are Copyright (C) 2011 the
18 # Initial Developer. All Rights Reserved.
20 # For minor contributions see the git repository.
22 # Alternatively, the contents of this file may be used under the terms of
23 # either the GNU General Public License Version 3 or later (the "GPLv3+"), or
24 # the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
25 # in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
26 # instead of those above.
28 my $nFunIndexes = 5;
29 my $nVtableOffsets = 1;
31 sub gen_arm ($$)
33 my ($funIndex, $vtableOffset) = @_;
34 printf ("codeSnippet%08x%d:\n", $funIndex, $vtableOffset);
35 printf ("\tmov ip, pc\n");
36 printf ("\tb _privateSnippetExecutor\n");
37 printf ("\t.long %#08x\n", $funIndex);
38 printf ("\t.long %d\n", $vtableOffset);
41 sub gen_x86 ($$$)
43 my ($funIndex, $vtableOffset, $executor) = @_;
44 printf ("codeSnippet%08x%d%s:\n", $funIndex, $vtableOffset, $executor);
45 printf ("\tmovl \$%#08x, %%eax\n", $funIndex);
46 printf ("\tmovl \$%d, %%edx\n", $vtableOffset);
47 printf ("\tjmp _privateSnippetExecutor%s\n", $executor);
50 printf (".text\n");
52 printf ("#ifdef __arm\n");
53 printf ("\t.align 4\n");
55 foreach my $funIndex (0 .. $nFunIndexes-1)
57 foreach my $vtableOffset (0 .. $nVtableOffsets-1)
59 gen_arm ($funIndex, $vtableOffset);
60 gen_arm ($funIndex|0x80000000, $vtableOffset);
64 printf ("#else\n");
65 printf ("\t.align 1, 0x90\n");
67 foreach my $funIndex (0 .. $nFunIndexes-1)
69 foreach my $vtableOffset (0 .. $nVtableOffsets-1)
71 foreach my $executor ('General', 'Void', 'Hyper', 'Float', 'Double', 'Class')
73 gen_x86 ($funIndex, $vtableOffset, $executor);
74 gen_x86 ($funIndex|0x80000000, $vtableOffset, $executor);
79 printf ("#endif\n");
81 printf ("\t.globl _nFunIndexes\n");
82 printf ("_nFunIndexes:\n");
83 printf ("\t.long %d\n", $nFunIndexes);
85 printf ("\t.globl _nVtableOffsets\n");
86 printf ("_nVtableOffsets:\n");
87 printf ("\t.long %d\n", $nVtableOffsets);
89 printf ("\t.globl _codeSnippets\n");
90 printf ("_codeSnippets:\n");
92 foreach my $funIndex (0 .. $nFunIndexes-1)
94 foreach my $vtableOffset (0 .. $nVtableOffsets-1)
96 printf ("#ifdef __arm\n");
97 printf ("\t.long codeSnippet%08x%d - _codeSnippets\n", $funIndex, $vtableOffset);
98 printf ("\t.long codeSnippet%08x%d - _codeSnippets\n", $funIndex|0x80000000, $vtableOffset);
99 printf ("#else\n");
100 foreach my $executor ('General', 'Void', 'Hyper', 'Float', 'Double', 'Class')
102 printf ("\t.long codeSnippet%08x%d%s - _codeSnippets\n", $funIndex, $vtableOffset, $executor);
103 printf ("\t.long codeSnippet%08x%d%s - _codeSnippets\n", $funIndex|0x80000000, $vtableOffset, $executor);
105 printf ("#endif\n");