blob: 26ea6a8ec7568c246a72706f57f15a078020f1b0 [file] [log] [blame]
Brian Carlstrom7940e442013-07-12 13:46:57 -07001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/* This file contains codegen for the Mips ISA */
18
19#include "codegen_mips.h"
20#include "dex/quick/mir_to_lir-inl.h"
Ian Rogers166db042013-07-26 12:05:57 -070021#include "entrypoints/quick/quick_entrypoints.h"
Ian Rogers576ca0c2014-06-06 15:58:22 -070022#include "gc/accounting/card_table.h"
Brian Carlstrom7940e442013-07-12 13:46:57 -070023#include "mips_lir.h"
Brian Carlstrom7940e442013-07-12 13:46:57 -070024
25namespace art {
26
Razvan A Lupusoru3bc01742014-02-06 13:18:43 -080027bool MipsMir2Lir::GenSpecialCase(BasicBlock* bb, MIR* mir,
Vladimir Marko5816ed42013-11-27 17:04:20 +000028 const InlineMethod& special) {
Razvan A Lupusoru3bc01742014-02-06 13:18:43 -080029 // TODO
30 return false;
Brian Carlstrom7940e442013-07-12 13:46:57 -070031}
32
33/*
34 * The lack of pc-relative loads on Mips presents somewhat of a challenge
35 * for our PIC switch table strategy. To materialize the current location
buzbee2700f7e2014-03-07 09:46:20 -080036 * we'll do a dummy JAL and reference our tables using rRA as the
37 * base register. Note that rRA will be used both as the base to
Brian Carlstrom7940e442013-07-12 13:46:57 -070038 * locate the switch table data and as the reference base for the switch
39 * target offsets stored in the table. We'll use a special pseudo-instruction
40 * to represent the jal and trigger the construction of the
41 * switch table offsets (which will happen after final assembly and all
42 * labels are fixed).
43 *
44 * The test loop will look something like:
45 *
buzbee2700f7e2014-03-07 09:46:20 -080046 * ori r_end, rZERO, #table_size ; size in bytes
47 * jal BaseLabel ; stores "return address" (BaseLabel) in rRA
Brian Carlstrom7940e442013-07-12 13:46:57 -070048 * nop ; opportunistically fill
49 * BaseLabel:
buzbee2700f7e2014-03-07 09:46:20 -080050 * addiu r_base, rRA, <table> - <BaseLabel> ; table relative to BaseLabel
51 addu r_end, r_end, r_base ; end of table
Brian Carlstrom7940e442013-07-12 13:46:57 -070052 * lw r_val, [rSP, v_reg_off] ; Test Value
53 * loop:
buzbee2700f7e2014-03-07 09:46:20 -080054 * beq r_base, r_end, done
55 * lw r_key, 0(r_base)
56 * addu r_base, 8
Brian Carlstrom7940e442013-07-12 13:46:57 -070057 * bne r_val, r_key, loop
buzbee2700f7e2014-03-07 09:46:20 -080058 * lw r_disp, -4(r_base)
59 * addu rRA, r_disp
60 * jr rRA
Brian Carlstrom7940e442013-07-12 13:46:57 -070061 * done:
62 *
63 */
buzbee0d829482013-10-11 15:24:55 -070064void MipsMir2Lir::GenSparseSwitch(MIR* mir, DexOffset table_offset,
Brian Carlstrom2ce745c2013-07-17 17:44:30 -070065 RegLocation rl_src) {
Brian Carlstrom7940e442013-07-12 13:46:57 -070066 const uint16_t* table = cu_->insns + current_dalvik_offset_ + table_offset;
67 if (cu_->verbose) {
68 DumpSparseSwitchTable(table);
69 }
70 // Add the table to the list - we'll process it later
buzbee0d829482013-10-11 15:24:55 -070071 SwitchTable* tab_rec =
Vladimir Marko83cc7ae2014-02-12 18:02:05 +000072 static_cast<SwitchTable*>(arena_->Alloc(sizeof(SwitchTable), kArenaAllocData));
Brian Carlstrom7940e442013-07-12 13:46:57 -070073 tab_rec->table = table;
74 tab_rec->vaddr = current_dalvik_offset_;
75 int elements = table[1];
76 tab_rec->targets =
Vladimir Marko83cc7ae2014-02-12 18:02:05 +000077 static_cast<LIR**>(arena_->Alloc(elements * sizeof(LIR*), kArenaAllocLIR));
Brian Carlstrom7940e442013-07-12 13:46:57 -070078 switch_tables_.Insert(tab_rec);
79
80 // The table is composed of 8-byte key/disp pairs
81 int byte_size = elements * 8;
82
83 int size_hi = byte_size >> 16;
84 int size_lo = byte_size & 0xffff;
85
buzbee2700f7e2014-03-07 09:46:20 -080086 RegStorage r_end = AllocTemp();
Brian Carlstrom7940e442013-07-12 13:46:57 -070087 if (size_hi) {
buzbee2700f7e2014-03-07 09:46:20 -080088 NewLIR2(kMipsLui, r_end.GetReg(), size_hi);
Brian Carlstrom7940e442013-07-12 13:46:57 -070089 }
90 // Must prevent code motion for the curr pc pair
91 GenBarrier(); // Scheduling barrier
92 NewLIR0(kMipsCurrPC); // Really a jal to .+8
93 // Now, fill the branch delay slot
94 if (size_hi) {
buzbee2700f7e2014-03-07 09:46:20 -080095 NewLIR3(kMipsOri, r_end.GetReg(), r_end.GetReg(), size_lo);
Brian Carlstrom7940e442013-07-12 13:46:57 -070096 } else {
buzbee2700f7e2014-03-07 09:46:20 -080097 NewLIR3(kMipsOri, r_end.GetReg(), rZERO, size_lo);
Brian Carlstrom7940e442013-07-12 13:46:57 -070098 }
99 GenBarrier(); // Scheduling barrier
100
101 // Construct BaseLabel and set up table base register
102 LIR* base_label = NewLIR0(kPseudoTargetLabel);
103 // Remember base label so offsets can be computed later
104 tab_rec->anchor = base_label;
buzbee2700f7e2014-03-07 09:46:20 -0800105 RegStorage r_base = AllocTemp();
106 NewLIR4(kMipsDelta, r_base.GetReg(), 0, WrapPointer(base_label), WrapPointer(tab_rec));
107 OpRegRegReg(kOpAdd, r_end, r_end, r_base);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700108
109 // Grab switch test value
110 rl_src = LoadValue(rl_src, kCoreReg);
111
112 // Test loop
buzbee2700f7e2014-03-07 09:46:20 -0800113 RegStorage r_key = AllocTemp();
Brian Carlstrom7940e442013-07-12 13:46:57 -0700114 LIR* loop_label = NewLIR0(kPseudoTargetLabel);
buzbee2700f7e2014-03-07 09:46:20 -0800115 LIR* exit_branch = OpCmpBranch(kCondEq, r_base, r_end, NULL);
buzbee695d13a2014-04-19 13:32:20 -0700116 Load32Disp(r_base, 0, r_key);
buzbee2700f7e2014-03-07 09:46:20 -0800117 OpRegImm(kOpAdd, r_base, 8);
118 OpCmpBranch(kCondNe, rl_src.reg, r_key, loop_label);
119 RegStorage r_disp = AllocTemp();
buzbee695d13a2014-04-19 13:32:20 -0700120 Load32Disp(r_base, -4, r_disp);
buzbee2700f7e2014-03-07 09:46:20 -0800121 OpRegRegReg(kOpAdd, rs_rRA, rs_rRA, r_disp);
122 OpReg(kOpBx, rs_rRA);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700123
124 // Loop exit
125 LIR* exit_label = NewLIR0(kPseudoTargetLabel);
126 exit_branch->target = exit_label;
127}
128
129/*
130 * Code pattern will look something like:
131 *
132 * lw r_val
buzbee2700f7e2014-03-07 09:46:20 -0800133 * jal BaseLabel ; stores "return address" (BaseLabel) in rRA
Brian Carlstrom7940e442013-07-12 13:46:57 -0700134 * nop ; opportunistically fill
135 * [subiu r_val, bias] ; Remove bias if low_val != 0
136 * bound check -> done
buzbee2700f7e2014-03-07 09:46:20 -0800137 * lw r_disp, [rRA, r_val]
138 * addu rRA, r_disp
139 * jr rRA
Brian Carlstrom7940e442013-07-12 13:46:57 -0700140 * done:
141 */
buzbee0d829482013-10-11 15:24:55 -0700142void MipsMir2Lir::GenPackedSwitch(MIR* mir, DexOffset table_offset,
Brian Carlstrom2ce745c2013-07-17 17:44:30 -0700143 RegLocation rl_src) {
Brian Carlstrom7940e442013-07-12 13:46:57 -0700144 const uint16_t* table = cu_->insns + current_dalvik_offset_ + table_offset;
145 if (cu_->verbose) {
146 DumpPackedSwitchTable(table);
147 }
148 // Add the table to the list - we'll process it later
buzbee0d829482013-10-11 15:24:55 -0700149 SwitchTable* tab_rec =
Vladimir Marko83cc7ae2014-02-12 18:02:05 +0000150 static_cast<SwitchTable*>(arena_->Alloc(sizeof(SwitchTable), kArenaAllocData));
Brian Carlstrom7940e442013-07-12 13:46:57 -0700151 tab_rec->table = table;
152 tab_rec->vaddr = current_dalvik_offset_;
153 int size = table[1];
Mathieu Chartierf6c4b3b2013-08-24 16:11:37 -0700154 tab_rec->targets = static_cast<LIR**>(arena_->Alloc(size * sizeof(LIR*),
Vladimir Marko83cc7ae2014-02-12 18:02:05 +0000155 kArenaAllocLIR));
Brian Carlstrom7940e442013-07-12 13:46:57 -0700156 switch_tables_.Insert(tab_rec);
157
158 // Get the switch value
159 rl_src = LoadValue(rl_src, kCoreReg);
160
161 // Prepare the bias. If too big, handle 1st stage here
162 int low_key = s4FromSwitchData(&table[2]);
163 bool large_bias = false;
buzbee2700f7e2014-03-07 09:46:20 -0800164 RegStorage r_key;
Brian Carlstrom7940e442013-07-12 13:46:57 -0700165 if (low_key == 0) {
buzbee2700f7e2014-03-07 09:46:20 -0800166 r_key = rl_src.reg;
Brian Carlstrom7940e442013-07-12 13:46:57 -0700167 } else if ((low_key & 0xffff) != low_key) {
168 r_key = AllocTemp();
169 LoadConstant(r_key, low_key);
170 large_bias = true;
171 } else {
172 r_key = AllocTemp();
173 }
174
175 // Must prevent code motion for the curr pc pair
176 GenBarrier();
177 NewLIR0(kMipsCurrPC); // Really a jal to .+8
178 // Now, fill the branch delay slot with bias strip
179 if (low_key == 0) {
180 NewLIR0(kMipsNop);
181 } else {
182 if (large_bias) {
buzbee2700f7e2014-03-07 09:46:20 -0800183 OpRegRegReg(kOpSub, r_key, rl_src.reg, r_key);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700184 } else {
buzbee2700f7e2014-03-07 09:46:20 -0800185 OpRegRegImm(kOpSub, r_key, rl_src.reg, low_key);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700186 }
187 }
188 GenBarrier(); // Scheduling barrier
189
190 // Construct BaseLabel and set up table base register
191 LIR* base_label = NewLIR0(kPseudoTargetLabel);
192 // Remember base label so offsets can be computed later
193 tab_rec->anchor = base_label;
194
195 // Bounds check - if < 0 or >= size continue following switch
196 LIR* branch_over = OpCmpImmBranch(kCondHi, r_key, size-1, NULL);
197
198 // Materialize the table base pointer
buzbee2700f7e2014-03-07 09:46:20 -0800199 RegStorage r_base = AllocTemp();
200 NewLIR4(kMipsDelta, r_base.GetReg(), 0, WrapPointer(base_label), WrapPointer(tab_rec));
Brian Carlstrom7940e442013-07-12 13:46:57 -0700201
202 // Load the displacement from the switch table
buzbee2700f7e2014-03-07 09:46:20 -0800203 RegStorage r_disp = AllocTemp();
buzbee695d13a2014-04-19 13:32:20 -0700204 LoadBaseIndexed(r_base, r_key, r_disp, 2, k32);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700205
buzbee2700f7e2014-03-07 09:46:20 -0800206 // Add to rAP and go
207 OpRegRegReg(kOpAdd, rs_rRA, rs_rRA, r_disp);
208 OpReg(kOpBx, rs_rRA);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700209
210 /* branch_over target here */
211 LIR* target = NewLIR0(kPseudoTargetLabel);
212 branch_over->target = target;
213}
214
215/*
216 * Array data table format:
217 * ushort ident = 0x0300 magic value
218 * ushort width width of each element in the table
219 * uint size number of elements in the table
220 * ubyte data[size*width] table of data values (may contain a single-byte
221 * padding at the end)
222 *
223 * Total size is 4+(width * size + 1)/2 16-bit code units.
224 */
buzbee0d829482013-10-11 15:24:55 -0700225void MipsMir2Lir::GenFillArrayData(DexOffset table_offset, RegLocation rl_src) {
Brian Carlstrom7940e442013-07-12 13:46:57 -0700226 const uint16_t* table = cu_->insns + current_dalvik_offset_ + table_offset;
227 // Add the table to the list - we'll process it later
buzbee0d829482013-10-11 15:24:55 -0700228 FillArrayData* tab_rec =
Mathieu Chartierf6c4b3b2013-08-24 16:11:37 -0700229 reinterpret_cast<FillArrayData*>(arena_->Alloc(sizeof(FillArrayData),
Vladimir Marko83cc7ae2014-02-12 18:02:05 +0000230 kArenaAllocData));
Brian Carlstrom7940e442013-07-12 13:46:57 -0700231 tab_rec->table = table;
232 tab_rec->vaddr = current_dalvik_offset_;
233 uint16_t width = tab_rec->table[1];
234 uint32_t size = tab_rec->table[2] | ((static_cast<uint32_t>(tab_rec->table[3])) << 16);
235 tab_rec->size = (size * width) + 8;
236
237 fill_array_data_.Insert(tab_rec);
238
239 // Making a call - use explicit registers
240 FlushAllRegs(); /* Everything to home location */
241 LockCallTemps();
buzbee2700f7e2014-03-07 09:46:20 -0800242 LoadValueDirectFixed(rl_src, rs_rMIPS_ARG0);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700243
244 // Must prevent code motion for the curr pc pair
245 GenBarrier();
246 NewLIR0(kMipsCurrPC); // Really a jal to .+8
247 // Now, fill the branch delay slot with the helper load
Ian Rogersdd7624d2014-03-14 17:43:00 -0700248 RegStorage r_tgt = LoadHelper(QUICK_ENTRYPOINT_OFFSET(4, pHandleFillArrayData));
Brian Carlstrom7940e442013-07-12 13:46:57 -0700249 GenBarrier(); // Scheduling barrier
250
251 // Construct BaseLabel and set up table base register
252 LIR* base_label = NewLIR0(kPseudoTargetLabel);
253
254 // Materialize a pointer to the fill data image
buzbee0d829482013-10-11 15:24:55 -0700255 NewLIR4(kMipsDelta, rMIPS_ARG1, 0, WrapPointer(base_label), WrapPointer(tab_rec));
Brian Carlstrom7940e442013-07-12 13:46:57 -0700256
257 // And go...
Vladimir Marko31c2aac2013-12-09 16:31:19 +0000258 ClobberCallerSave();
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700259 LIR* call_inst = OpReg(kOpBlx, r_tgt); // ( array*, fill_data* )
Brian Carlstrom7940e442013-07-12 13:46:57 -0700260 MarkSafepointPC(call_inst);
261}
262
Brian Carlstrom2ce745c2013-07-17 17:44:30 -0700263void MipsMir2Lir::GenMoveException(RegLocation rl_dest) {
Ian Rogersdd7624d2014-03-14 17:43:00 -0700264 int ex_offset = Thread::ExceptionOffset<4>().Int32Value();
buzbeea0cd2d72014-06-01 09:33:49 -0700265 RegLocation rl_result = EvalLoc(rl_dest, kRefReg, true);
266 RegStorage reset_reg = AllocTempRef();
Andreas Gampe3c12c512014-06-24 18:46:29 +0000267 LoadRefDisp(rs_rMIPS_SELF, ex_offset, rl_result.reg, kNotVolatile);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700268 LoadConstant(reset_reg, 0);
Andreas Gampe3c12c512014-06-24 18:46:29 +0000269 StoreRefDisp(rs_rMIPS_SELF, ex_offset, reset_reg, kNotVolatile);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700270 FreeTemp(reset_reg);
271 StoreValue(rl_dest, rl_result);
272}
273
274/*
275 * Mark garbage collection card. Skip if the value we're storing is null.
276 */
buzbee2700f7e2014-03-07 09:46:20 -0800277void MipsMir2Lir::MarkGCCard(RegStorage val_reg, RegStorage tgt_addr_reg) {
278 RegStorage reg_card_base = AllocTemp();
279 RegStorage reg_card_no = AllocTemp();
Brian Carlstrom7940e442013-07-12 13:46:57 -0700280 LIR* branch_over = OpCmpImmBranch(kCondEq, val_reg, 0, NULL);
buzbee695d13a2014-04-19 13:32:20 -0700281 // NOTE: native pointer.
Ian Rogersdd7624d2014-03-14 17:43:00 -0700282 LoadWordDisp(rs_rMIPS_SELF, Thread::CardTableOffset<4>().Int32Value(), reg_card_base);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700283 OpRegRegImm(kOpLsr, reg_card_no, tgt_addr_reg, gc::accounting::CardTable::kCardShift);
buzbee2700f7e2014-03-07 09:46:20 -0800284 StoreBaseIndexed(reg_card_base, reg_card_no, reg_card_base, 0, kUnsignedByte);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700285 LIR* target = NewLIR0(kPseudoTargetLabel);
286 branch_over->target = target;
287 FreeTemp(reg_card_base);
288 FreeTemp(reg_card_no);
289}
Ian Rogersd9c4fc92013-10-01 19:45:43 -0700290
Brian Carlstrom2ce745c2013-07-17 17:44:30 -0700291void MipsMir2Lir::GenEntrySequence(RegLocation* ArgLocs, RegLocation rl_method) {
Brian Carlstrom7940e442013-07-12 13:46:57 -0700292 int spill_count = num_core_spills_ + num_fp_spills_;
293 /*
294 * On entry, rMIPS_ARG0, rMIPS_ARG1, rMIPS_ARG2 & rMIPS_ARG3 are live. Let the register
295 * allocation mechanism know so it doesn't try to use any of them when
296 * expanding the frame or flushing. This leaves the utility
297 * code with a single temp: r12. This should be enough.
298 */
buzbee091cc402014-03-31 10:14:40 -0700299 LockTemp(rs_rMIPS_ARG0);
300 LockTemp(rs_rMIPS_ARG1);
301 LockTemp(rs_rMIPS_ARG2);
302 LockTemp(rs_rMIPS_ARG3);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700303
304 /*
305 * We can safely skip the stack overflow check if we're
306 * a leaf *and* our frame size < fudge factor.
307 */
Andreas Gampe7cd26f32014-06-18 17:01:15 -0700308 bool skip_overflow_check = mir_graph_->MethodIsLeaf() && !IsLargeFrame(frame_size_, kMips);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700309 NewLIR0(kPseudoMethodEntry);
buzbee2700f7e2014-03-07 09:46:20 -0800310 RegStorage check_reg = AllocTemp();
311 RegStorage new_sp = AllocTemp();
Brian Carlstrom7940e442013-07-12 13:46:57 -0700312 if (!skip_overflow_check) {
313 /* Load stack limit */
buzbee695d13a2014-04-19 13:32:20 -0700314 Load32Disp(rs_rMIPS_SELF, Thread::StackEndOffset<4>().Int32Value(), check_reg);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700315 }
316 /* Spill core callee saves */
317 SpillCoreRegs();
318 /* NOTE: promotion of FP regs currently unsupported, thus no FP spill */
319 DCHECK_EQ(num_fp_spills_, 0);
Mathieu Chartier0d507d12014-03-19 10:17:28 -0700320 const int frame_sub = frame_size_ - spill_count * 4;
Brian Carlstrom7940e442013-07-12 13:46:57 -0700321 if (!skip_overflow_check) {
Mathieu Chartier0d507d12014-03-19 10:17:28 -0700322 class StackOverflowSlowPath : public LIRSlowPath {
323 public:
324 StackOverflowSlowPath(Mir2Lir* m2l, LIR* branch, size_t sp_displace)
325 : LIRSlowPath(m2l, m2l->GetCurrentDexPc(), branch, nullptr), sp_displace_(sp_displace) {
326 }
327 void Compile() OVERRIDE {
328 m2l_->ResetRegPool();
329 m2l_->ResetDefTracking();
Mingyao Yang6ffcfa02014-04-25 11:06:00 -0700330 GenerateTargetLabel(kPseudoThrowTarget);
Mathieu Chartier0d507d12014-03-19 10:17:28 -0700331 // LR is offset 0 since we push in reverse order.
buzbee695d13a2014-04-19 13:32:20 -0700332 m2l_->Load32Disp(rs_rMIPS_SP, 0, rs_rRA);
buzbee2700f7e2014-03-07 09:46:20 -0800333 m2l_->OpRegImm(kOpAdd, rs_rMIPS_SP, sp_displace_);
Mathieu Chartier0d507d12014-03-19 10:17:28 -0700334 m2l_->ClobberCallerSave();
Ian Rogersdd7624d2014-03-14 17:43:00 -0700335 ThreadOffset<4> func_offset = QUICK_ENTRYPOINT_OFFSET(4, pThrowStackOverflow);
buzbee2700f7e2014-03-07 09:46:20 -0800336 RegStorage r_tgt = m2l_->CallHelperSetup(func_offset); // Doesn't clobber LR.
Mathieu Chartier0d507d12014-03-19 10:17:28 -0700337 m2l_->CallHelper(r_tgt, func_offset, false /* MarkSafepointPC */, false /* UseLink */);
338 }
339
340 private:
341 const size_t sp_displace_;
342 };
buzbee2700f7e2014-03-07 09:46:20 -0800343 OpRegRegImm(kOpSub, new_sp, rs_rMIPS_SP, frame_sub);
Mathieu Chartier0d507d12014-03-19 10:17:28 -0700344 LIR* branch = OpCmpBranch(kCondUlt, new_sp, check_reg, nullptr);
345 AddSlowPath(new(arena_)StackOverflowSlowPath(this, branch, spill_count * 4));
346 // TODO: avoid copy for small frame sizes.
buzbee2700f7e2014-03-07 09:46:20 -0800347 OpRegCopy(rs_rMIPS_SP, new_sp); // Establish stack
Brian Carlstrom7940e442013-07-12 13:46:57 -0700348 } else {
buzbee2700f7e2014-03-07 09:46:20 -0800349 OpRegImm(kOpSub, rs_rMIPS_SP, frame_sub);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700350 }
351
352 FlushIns(ArgLocs, rl_method);
353
buzbee091cc402014-03-31 10:14:40 -0700354 FreeTemp(rs_rMIPS_ARG0);
355 FreeTemp(rs_rMIPS_ARG1);
356 FreeTemp(rs_rMIPS_ARG2);
357 FreeTemp(rs_rMIPS_ARG3);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700358}
359
Brian Carlstrom2ce745c2013-07-17 17:44:30 -0700360void MipsMir2Lir::GenExitSequence() {
Brian Carlstrom7940e442013-07-12 13:46:57 -0700361 /*
362 * In the exit path, rMIPS_RET0/rMIPS_RET1 are live - make sure they aren't
363 * allocated by the register utilities as temps.
364 */
buzbee091cc402014-03-31 10:14:40 -0700365 LockTemp(rs_rMIPS_RET0);
366 LockTemp(rs_rMIPS_RET1);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700367
368 NewLIR0(kPseudoMethodExit);
369 UnSpillCoreRegs();
buzbee2700f7e2014-03-07 09:46:20 -0800370 OpReg(kOpBx, rs_rRA);
Brian Carlstrom7940e442013-07-12 13:46:57 -0700371}
372
Razvan A Lupusoru3bc01742014-02-06 13:18:43 -0800373void MipsMir2Lir::GenSpecialExitSequence() {
buzbee2700f7e2014-03-07 09:46:20 -0800374 OpReg(kOpBx, rs_rRA);
Razvan A Lupusoru3bc01742014-02-06 13:18:43 -0800375}
376
Brian Carlstrom7940e442013-07-12 13:46:57 -0700377} // namespace art