Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/mips/register-allocator-mips-inl.h

Issue 561072: MIPS port initial commit (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/register-allocator-mips.cc ('k') | src/mips/simulator-mips.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 #ifndef V8_IA32_REGISTER_ALLOCATOR_MIPS_INL_H_
29 #define V8_IA32_REGISTER_ALLOCATOR_MIPS_INL_H_
30
31 #include "v8.h"
32 #include "mips/assembler-mips.h"
33
34 namespace v8 {
35 namespace internal {
36
37 // -------------------------------------------------------------------------
38 // RegisterAllocator implementation.
39
40 bool RegisterAllocator::IsReserved(Register reg) {
41 // The code for this test relies on the order of register codes.
42 return reg.is(cp) || reg.is(s8_fp) || reg.is(sp);
43 }
44
45
46 int RegisterAllocator::ToNumber(Register reg) {
47 ASSERT(reg.is_valid() && !IsReserved(reg));
48 const int kNumbers[] = {
49 0, // zero_reg
50 1, // at
51 2, // v0
52 3, // v1
53 4, // a0
54 5, // a1
55 6, // a2
56 7, // a3
57 8, // t0
58 9, // t1
59 10, // t2
60 11, // t3
61 12, // t4
62 13, // t5
63 14, // t
64 15, // t7
65 16, // t8
66 17, // t9
67 18, // s0
68 19, // s1
69 20, // s2
70 21, // s3
71 22, // s4
72 23, // s5
73 24, // s6
74 25, // s7
75 26, // k0
76 27, // k1
77 28, // gp
78 29, // sp
79 30, // s8_fp
80 31, // ra
81 };
82 return kNumbers[reg.code()];
83 }
84
85
86 Register RegisterAllocator::ToRegister(int num) {
87 ASSERT(num >= 0 && num < kNumRegisters);
88 const Register kRegisters[] = {
89 zero_reg,
90 at,
91 v0,
92 v1,
93 a0,
94 a1,
95 a2,
96 a3,
97 t0,
98 t1,
99 t2,
100 t3,
101 t4,
102 t5,
103 t6,
104 t7,
105 s0,
106 s1,
107 s2,
108 s3,
109 s4,
110 s5,
111 s6,
112 s7,
113 t8,
114 t9,
115 k0,
116 k1,
117 gp,
118 sp,
119 s8_fp,
120 ra
121 };
122 return kRegisters[num];
123 }
124
125
126 void RegisterAllocator::Initialize() {
127 Reset();
128 // The non-reserved a1 and ra registers are live on JS function entry.
129 Use(a1); // JS function.
130 Use(ra); // Return address.
131 }
132
133
134 } } // namespace v8::internal
135
136 #endif // V8_IA32_REGISTER_ALLOCATOR_MIPS_INL_H_
137
OLDNEW
« no previous file with comments | « src/mips/register-allocator-mips.cc ('k') | src/mips/simulator-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698