blob: 38fd2440878ca467f42d3fcbb854c4906099824e [file] [log] [blame]
Dave Allison65fcc2c2014-04-28 13:45:27 -07001/*
2 * Copyright (C) 2014 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#ifndef ART_COMPILER_UTILS_ARM_ASSEMBLER_THUMB2_H_
18#define ART_COMPILER_UTILS_ARM_ASSEMBLER_THUMB2_H_
19
Vladimir Markocf93a5c2015-06-16 11:33:24 +000020#include <deque>
Andreas Gampe7cffc3b2015-10-19 21:31:53 -070021#include <utility>
Dave Allison65fcc2c2014-04-28 13:45:27 -070022#include <vector>
23
24#include "base/logging.h"
25#include "constants_arm.h"
26#include "utils/arm/managed_register_arm.h"
27#include "utils/arm/assembler_arm.h"
Vladimir Marko6b756b52015-07-14 11:58:38 +010028#include "utils/array_ref.h"
Dave Allison65fcc2c2014-04-28 13:45:27 -070029#include "offsets.h"
Dave Allison65fcc2c2014-04-28 13:45:27 -070030
31namespace art {
32namespace arm {
33
Dave Allison65fcc2c2014-04-28 13:45:27 -070034class Thumb2Assembler FINAL : public ArmAssembler {
35 public:
Nicolas Geoffrayd126ba12015-05-20 11:25:27 +010036 explicit Thumb2Assembler(bool can_relocate_branches = true)
37 : can_relocate_branches_(can_relocate_branches),
Nicolas Geoffray8d486732014-07-16 16:23:40 +010038 force_32bit_(false),
39 it_cond_index_(kNoItCondition),
Vladimir Markocf93a5c2015-06-16 11:33:24 +000040 next_condition_(AL),
41 fixups_(),
Vladimir Marko6b756b52015-07-14 11:58:38 +010042 fixup_dependents_(),
Vladimir Markocf93a5c2015-06-16 11:33:24 +000043 literals_(),
44 last_position_adjustment_(0u),
45 last_old_position_(0u),
46 last_fixup_id_(0u) {
Dave Allison65fcc2c2014-04-28 13:45:27 -070047 }
48
49 virtual ~Thumb2Assembler() {
Dave Allison65fcc2c2014-04-28 13:45:27 -070050 }
51
52 bool IsThumb() const OVERRIDE {
53 return true;
54 }
55
56 bool IsForced32Bit() const {
57 return force_32bit_;
58 }
59
Nicolas Geoffrayd126ba12015-05-20 11:25:27 +010060 bool CanRelocateBranches() const {
61 return can_relocate_branches_;
Nicolas Geoffray8d486732014-07-16 16:23:40 +010062 }
63
Vladimir Markocf93a5c2015-06-16 11:33:24 +000064 void FinalizeCode() OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -070065
66 // Data-processing instructions.
Vladimir Marko73cf0fb2015-07-30 15:07:22 +010067 virtual void and_(Register rd, Register rn, const ShifterOperand& so,
68 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -070069
Vladimir Marko73cf0fb2015-07-30 15:07:22 +010070 virtual void eor(Register rd, Register rn, const ShifterOperand& so,
71 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -070072
Vladimir Marko73cf0fb2015-07-30 15:07:22 +010073 virtual void sub(Register rd, Register rn, const ShifterOperand& so,
74 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -070075
Vladimir Marko73cf0fb2015-07-30 15:07:22 +010076 virtual void rsb(Register rd, Register rn, const ShifterOperand& so,
77 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -070078
Vladimir Marko73cf0fb2015-07-30 15:07:22 +010079 virtual void add(Register rd, Register rn, const ShifterOperand& so,
80 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -070081
Vladimir Marko73cf0fb2015-07-30 15:07:22 +010082 virtual void adc(Register rd, Register rn, const ShifterOperand& so,
83 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -070084
Vladimir Marko73cf0fb2015-07-30 15:07:22 +010085 virtual void sbc(Register rd, Register rn, const ShifterOperand& so,
86 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -070087
Vladimir Marko73cf0fb2015-07-30 15:07:22 +010088 virtual void rsc(Register rd, Register rn, const ShifterOperand& so,
89 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -070090
91 void tst(Register rn, const ShifterOperand& so, Condition cond = AL) OVERRIDE;
92
93 void teq(Register rn, const ShifterOperand& so, Condition cond = AL) OVERRIDE;
94
95 void cmp(Register rn, const ShifterOperand& so, Condition cond = AL) OVERRIDE;
96
97 void cmn(Register rn, const ShifterOperand& so, Condition cond = AL) OVERRIDE;
98
Vladimir Marko73cf0fb2015-07-30 15:07:22 +010099 virtual void orr(Register rd, Register rn, const ShifterOperand& so,
100 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -0700101
Vladimir Markod2b4ca22015-09-14 15:13:26 +0100102 virtual void orn(Register rd, Register rn, const ShifterOperand& so,
103 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
104
Vladimir Marko73cf0fb2015-07-30 15:07:22 +0100105 virtual void mov(Register rd, const ShifterOperand& so,
106 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -0700107
Vladimir Marko73cf0fb2015-07-30 15:07:22 +0100108 virtual void bic(Register rd, Register rn, const ShifterOperand& so,
109 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -0700110
Vladimir Marko73cf0fb2015-07-30 15:07:22 +0100111 virtual void mvn(Register rd, const ShifterOperand& so,
112 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -0700113
114 // Miscellaneous data-processing instructions.
115 void clz(Register rd, Register rm, Condition cond = AL) OVERRIDE;
116 void movw(Register rd, uint16_t imm16, Condition cond = AL) OVERRIDE;
117 void movt(Register rd, uint16_t imm16, Condition cond = AL) OVERRIDE;
Scott Wakeling9ee23f42015-07-23 10:44:35 +0100118 void rbit(Register rd, Register rm, Condition cond = AL) OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -0700119
120 // Multiply instructions.
121 void mul(Register rd, Register rn, Register rm, Condition cond = AL) OVERRIDE;
122 void mla(Register rd, Register rn, Register rm, Register ra,
123 Condition cond = AL) OVERRIDE;
124 void mls(Register rd, Register rn, Register rm, Register ra,
125 Condition cond = AL) OVERRIDE;
Zheng Xuc6667102015-05-15 16:08:45 +0800126 void smull(Register rd_lo, Register rd_hi, Register rn, Register rm,
127 Condition cond = AL) OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -0700128 void umull(Register rd_lo, Register rd_hi, Register rn, Register rm,
129 Condition cond = AL) OVERRIDE;
130
131 void sdiv(Register rd, Register rn, Register rm, Condition cond = AL) OVERRIDE;
132 void udiv(Register rd, Register rn, Register rm, Condition cond = AL) OVERRIDE;
133
Roland Levillain981e4542014-11-14 11:47:14 +0000134 // Bit field extract instructions.
Roland Levillain51d3fc42014-11-13 14:11:42 +0000135 void sbfx(Register rd, Register rn, uint32_t lsb, uint32_t width, Condition cond = AL) OVERRIDE;
Roland Levillain981e4542014-11-14 11:47:14 +0000136 void ubfx(Register rd, Register rn, uint32_t lsb, uint32_t width, Condition cond = AL) OVERRIDE;
Roland Levillain51d3fc42014-11-13 14:11:42 +0000137
Dave Allison65fcc2c2014-04-28 13:45:27 -0700138 // Load/store instructions.
139 void ldr(Register rd, const Address& ad, Condition cond = AL) OVERRIDE;
140 void str(Register rd, const Address& ad, Condition cond = AL) OVERRIDE;
141
142 void ldrb(Register rd, const Address& ad, Condition cond = AL) OVERRIDE;
143 void strb(Register rd, const Address& ad, Condition cond = AL) OVERRIDE;
144
145 void ldrh(Register rd, const Address& ad, Condition cond = AL) OVERRIDE;
146 void strh(Register rd, const Address& ad, Condition cond = AL) OVERRIDE;
147
148 void ldrsb(Register rd, const Address& ad, Condition cond = AL) OVERRIDE;
149 void ldrsh(Register rd, const Address& ad, Condition cond = AL) OVERRIDE;
150
Roland Levillain4af147e2015-04-07 13:54:49 +0100151 // Load/store register dual instructions using registers `rd` and `rd` + 1.
Dave Allison65fcc2c2014-04-28 13:45:27 -0700152 void ldrd(Register rd, const Address& ad, Condition cond = AL) OVERRIDE;
153 void strd(Register rd, const Address& ad, Condition cond = AL) OVERRIDE;
154
Roland Levillain4af147e2015-04-07 13:54:49 +0100155 // Load/store register dual instructions using registers `rd` and `rd2`.
156 // Note that contrary to the ARM A1 encoding, the Thumb-2 T1 encoding
157 // does not require `rd` to be even, nor `rd2' to be equal to `rd` + 1.
158 void ldrd(Register rd, Register rd2, const Address& ad, Condition cond);
159 void strd(Register rd, Register rd2, const Address& ad, Condition cond);
160
161
Dave Allison65fcc2c2014-04-28 13:45:27 -0700162 void ldm(BlockAddressMode am, Register base,
163 RegList regs, Condition cond = AL) OVERRIDE;
164 void stm(BlockAddressMode am, Register base,
165 RegList regs, Condition cond = AL) OVERRIDE;
166
167 void ldrex(Register rd, Register rn, Condition cond = AL) OVERRIDE;
168 void strex(Register rd, Register rt, Register rn, Condition cond = AL) OVERRIDE;
169
170 void ldrex(Register rd, Register rn, uint16_t imm, Condition cond = AL);
171 void strex(Register rd, Register rt, Register rn, uint16_t imm, Condition cond = AL);
172
Calin Juravle52c48962014-12-16 17:02:57 +0000173 void ldrexd(Register rt, Register rt2, Register rn, Condition cond = AL) OVERRIDE;
174 void strexd(Register rd, Register rt, Register rt2, Register rn, Condition cond = AL) OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -0700175
176 // Miscellaneous instructions.
177 void clrex(Condition cond = AL) OVERRIDE;
178 void nop(Condition cond = AL) OVERRIDE;
179
180 void bkpt(uint16_t imm16) OVERRIDE;
181 void svc(uint32_t imm24) OVERRIDE;
182
183 // If-then
184 void it(Condition firstcond, ItState i1 = kItOmitted,
185 ItState i2 = kItOmitted, ItState i3 = kItOmitted) OVERRIDE;
186
187 void cbz(Register rn, Label* target) OVERRIDE;
188 void cbnz(Register rn, Label* target) OVERRIDE;
189
190 // Floating point instructions (VFPv3-D16 and VFPv3-D32 profiles).
191 void vmovsr(SRegister sn, Register rt, Condition cond = AL) OVERRIDE;
192 void vmovrs(Register rt, SRegister sn, Condition cond = AL) OVERRIDE;
193 void vmovsrr(SRegister sm, Register rt, Register rt2, Condition cond = AL) OVERRIDE;
194 void vmovrrs(Register rt, Register rt2, SRegister sm, Condition cond = AL) OVERRIDE;
195 void vmovdrr(DRegister dm, Register rt, Register rt2, Condition cond = AL) OVERRIDE;
196 void vmovrrd(Register rt, Register rt2, DRegister dm, Condition cond = AL) OVERRIDE;
197 void vmovs(SRegister sd, SRegister sm, Condition cond = AL) OVERRIDE;
198 void vmovd(DRegister dd, DRegister dm, Condition cond = AL) OVERRIDE;
199
200 // Returns false if the immediate cannot be encoded.
201 bool vmovs(SRegister sd, float s_imm, Condition cond = AL) OVERRIDE;
202 bool vmovd(DRegister dd, double d_imm, Condition cond = AL) OVERRIDE;
203
204 void vldrs(SRegister sd, const Address& ad, Condition cond = AL) OVERRIDE;
205 void vstrs(SRegister sd, const Address& ad, Condition cond = AL) OVERRIDE;
206 void vldrd(DRegister dd, const Address& ad, Condition cond = AL) OVERRIDE;
207 void vstrd(DRegister dd, const Address& ad, Condition cond = AL) OVERRIDE;
208
209 void vadds(SRegister sd, SRegister sn, SRegister sm, Condition cond = AL) OVERRIDE;
210 void vaddd(DRegister dd, DRegister dn, DRegister dm, Condition cond = AL) OVERRIDE;
211 void vsubs(SRegister sd, SRegister sn, SRegister sm, Condition cond = AL) OVERRIDE;
212 void vsubd(DRegister dd, DRegister dn, DRegister dm, Condition cond = AL) OVERRIDE;
213 void vmuls(SRegister sd, SRegister sn, SRegister sm, Condition cond = AL) OVERRIDE;
214 void vmuld(DRegister dd, DRegister dn, DRegister dm, Condition cond = AL) OVERRIDE;
215 void vmlas(SRegister sd, SRegister sn, SRegister sm, Condition cond = AL) OVERRIDE;
216 void vmlad(DRegister dd, DRegister dn, DRegister dm, Condition cond = AL) OVERRIDE;
217 void vmlss(SRegister sd, SRegister sn, SRegister sm, Condition cond = AL) OVERRIDE;
218 void vmlsd(DRegister dd, DRegister dn, DRegister dm, Condition cond = AL) OVERRIDE;
219 void vdivs(SRegister sd, SRegister sn, SRegister sm, Condition cond = AL) OVERRIDE;
220 void vdivd(DRegister dd, DRegister dn, DRegister dm, Condition cond = AL) OVERRIDE;
221
222 void vabss(SRegister sd, SRegister sm, Condition cond = AL) OVERRIDE;
223 void vabsd(DRegister dd, DRegister dm, Condition cond = AL) OVERRIDE;
224 void vnegs(SRegister sd, SRegister sm, Condition cond = AL) OVERRIDE;
225 void vnegd(DRegister dd, DRegister dm, Condition cond = AL) OVERRIDE;
226 void vsqrts(SRegister sd, SRegister sm, Condition cond = AL) OVERRIDE;
227 void vsqrtd(DRegister dd, DRegister dm, Condition cond = AL) OVERRIDE;
228
229 void vcvtsd(SRegister sd, DRegister dm, Condition cond = AL) OVERRIDE;
230 void vcvtds(DRegister dd, SRegister sm, Condition cond = AL) OVERRIDE;
231 void vcvtis(SRegister sd, SRegister sm, Condition cond = AL) OVERRIDE;
232 void vcvtid(SRegister sd, DRegister dm, Condition cond = AL) OVERRIDE;
233 void vcvtsi(SRegister sd, SRegister sm, Condition cond = AL) OVERRIDE;
234 void vcvtdi(DRegister dd, SRegister sm, Condition cond = AL) OVERRIDE;
235 void vcvtus(SRegister sd, SRegister sm, Condition cond = AL) OVERRIDE;
236 void vcvtud(SRegister sd, DRegister dm, Condition cond = AL) OVERRIDE;
237 void vcvtsu(SRegister sd, SRegister sm, Condition cond = AL) OVERRIDE;
238 void vcvtdu(DRegister dd, SRegister sm, Condition cond = AL) OVERRIDE;
239
240 void vcmps(SRegister sd, SRegister sm, Condition cond = AL) OVERRIDE;
241 void vcmpd(DRegister dd, DRegister dm, Condition cond = AL) OVERRIDE;
242 void vcmpsz(SRegister sd, Condition cond = AL) OVERRIDE;
243 void vcmpdz(DRegister dd, Condition cond = AL) OVERRIDE;
244 void vmstat(Condition cond = AL) OVERRIDE; // VMRS APSR_nzcv, FPSCR
245
246 void vpushs(SRegister reg, int nregs, Condition cond = AL) OVERRIDE;
247 void vpushd(DRegister reg, int nregs, Condition cond = AL) OVERRIDE;
248 void vpops(SRegister reg, int nregs, Condition cond = AL) OVERRIDE;
249 void vpopd(DRegister reg, int nregs, Condition cond = AL) OVERRIDE;
250
251 // Branch instructions.
252 void b(Label* label, Condition cond = AL);
253 void bl(Label* label, Condition cond = AL);
254 void blx(Label* label);
255 void blx(Register rm, Condition cond = AL) OVERRIDE;
256 void bx(Register rm, Condition cond = AL) OVERRIDE;
257
Vladimir Marko73cf0fb2015-07-30 15:07:22 +0100258 virtual void Lsl(Register rd, Register rm, uint32_t shift_imm,
259 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
260 virtual void Lsr(Register rd, Register rm, uint32_t shift_imm,
261 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
262 virtual void Asr(Register rd, Register rm, uint32_t shift_imm,
263 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
264 virtual void Ror(Register rd, Register rm, uint32_t shift_imm,
265 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
266 virtual void Rrx(Register rd, Register rm,
267 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
Dave Allison45fdb932014-06-25 12:37:10 -0700268
Vladimir Marko73cf0fb2015-07-30 15:07:22 +0100269 virtual void Lsl(Register rd, Register rm, Register rn,
270 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
271 virtual void Lsr(Register rd, Register rm, Register rn,
272 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
273 virtual void Asr(Register rd, Register rm, Register rn,
274 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
275 virtual void Ror(Register rd, Register rm, Register rn,
276 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -0700277
278 void Push(Register rd, Condition cond = AL) OVERRIDE;
279 void Pop(Register rd, Condition cond = AL) OVERRIDE;
280
281 void PushList(RegList regs, Condition cond = AL) OVERRIDE;
282 void PopList(RegList regs, Condition cond = AL) OVERRIDE;
283
284 void Mov(Register rd, Register rm, Condition cond = AL) OVERRIDE;
285
286 void CompareAndBranchIfZero(Register r, Label* label) OVERRIDE;
287 void CompareAndBranchIfNonZero(Register r, Label* label) OVERRIDE;
288
Nicolas Geoffray19a19cf2014-10-22 16:07:05 +0100289 // Memory barriers.
290 void dmb(DmbOptions flavor) OVERRIDE;
291
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000292 // Get the final position of a label after local fixup based on the old position
293 // recorded before FinalizeCode().
294 uint32_t GetAdjustedPosition(uint32_t old_position) OVERRIDE;
295
296 using ArmAssembler::NewLiteral; // Make the helper template visible.
297
298 Literal* NewLiteral(size_t size, const uint8_t* data) OVERRIDE;
299 void LoadLiteral(Register rt, Literal* literal) OVERRIDE;
300 void LoadLiteral(Register rt, Register rt2, Literal* literal) OVERRIDE;
301 void LoadLiteral(SRegister sd, Literal* literal) OVERRIDE;
302 void LoadLiteral(DRegister dd, Literal* literal) OVERRIDE;
303
Dave Allison65fcc2c2014-04-28 13:45:27 -0700304 // Add signed constant value to rd. May clobber IP.
Dave Allison65fcc2c2014-04-28 13:45:27 -0700305 void AddConstant(Register rd, Register rn, int32_t value,
Vladimir Marko449b1092015-09-08 12:16:45 +0100306 Condition cond = AL, SetCc set_cc = kCcDontCare) OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -0700307
Andreas Gampe7cffc3b2015-10-19 21:31:53 -0700308 void CmpConstant(Register rn, int32_t value, Condition cond = AL) OVERRIDE;
309
Dave Allison65fcc2c2014-04-28 13:45:27 -0700310 // Load and Store. May clobber IP.
311 void LoadImmediate(Register rd, int32_t value, Condition cond = AL) OVERRIDE;
Dave Allison65fcc2c2014-04-28 13:45:27 -0700312 void MarkExceptionHandler(Label* label) OVERRIDE;
313 void LoadFromOffset(LoadOperandType type,
314 Register reg,
315 Register base,
316 int32_t offset,
317 Condition cond = AL) OVERRIDE;
318 void StoreToOffset(StoreOperandType type,
319 Register reg,
320 Register base,
321 int32_t offset,
322 Condition cond = AL) OVERRIDE;
323 void LoadSFromOffset(SRegister reg,
324 Register base,
325 int32_t offset,
326 Condition cond = AL) OVERRIDE;
327 void StoreSToOffset(SRegister reg,
328 Register base,
329 int32_t offset,
330 Condition cond = AL) OVERRIDE;
331 void LoadDFromOffset(DRegister reg,
332 Register base,
333 int32_t offset,
334 Condition cond = AL) OVERRIDE;
335 void StoreDToOffset(DRegister reg,
336 Register base,
337 int32_t offset,
338 Condition cond = AL) OVERRIDE;
339
Nicolas Geoffray3bcc8ea2014-11-28 15:00:02 +0000340 bool ShifterOperandCanHold(Register rd,
341 Register rn,
342 Opcode opcode,
343 uint32_t immediate,
344 ShifterOperand* shifter_op) OVERRIDE;
345
Nicolas Geoffray5bd05a52015-10-13 09:48:30 +0100346 bool ShifterOperandCanAlwaysHold(uint32_t immediate) OVERRIDE;
347
Dave Allison65fcc2c2014-04-28 13:45:27 -0700348
Ian Rogers13735952014-10-08 12:43:28 -0700349 static bool IsInstructionForExceptionHandling(uintptr_t pc);
Dave Allison65fcc2c2014-04-28 13:45:27 -0700350
351 // Emit data (e.g. encoded instruction or immediate) to the.
352 // instruction stream.
353 void Emit32(int32_t value); // Emit a 32 bit instruction in thumb format.
354 void Emit16(int16_t value); // Emit a 16 bit instruction in little endian format.
355 void Bind(Label* label) OVERRIDE;
356
357 void MemoryBarrier(ManagedRegister scratch) OVERRIDE;
358
359 // Force the assembler to generate 32 bit instructions.
360 void Force32Bit() {
361 force_32bit_ = true;
362 }
363
Andreas Gampe7cffc3b2015-10-19 21:31:53 -0700364 // Emit an ADR (or a sequence of instructions) to load the jump table address into base_reg. This
365 // will generate a fixup.
366 JumpTable* CreateJumpTable(std::vector<Label*>&& labels, Register base_reg) OVERRIDE;
367 // Emit an ADD PC, X to dispatch a jump-table jump. This will generate a fixup.
368 void EmitJumpTableDispatch(JumpTable* jump_table, Register displacement_reg) OVERRIDE;
369
Dave Allison65fcc2c2014-04-28 13:45:27 -0700370 private:
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000371 typedef uint16_t FixupId;
372
373 // Fixup: branches and literal pool references.
374 //
375 // The thumb2 architecture allows branches to be either 16 or 32 bit instructions. This
376 // depends on both the type of branch and the offset to which it is branching. The 16-bit
377 // cbz and cbnz instructions may also need to be replaced with a separate 16-bit compare
378 // instruction and a 16- or 32-bit branch instruction. Load from a literal pool can also be
379 // 16-bit or 32-bit instruction and, if the method is large, we may need to use a sequence
380 // of instructions to make up for the limited range of load literal instructions (up to
381 // 4KiB for the 32-bit variant). When generating code for these insns we don't know the
382 // size before hand, so we assume it is the smallest available size and determine the final
383 // code offsets and sizes and emit code in FinalizeCode().
384 //
385 // To handle this, we keep a record of every branch and literal pool load in the program.
386 // The actual instruction encoding for these is delayed until we know the final size of
387 // every instruction. When we bind a label to a branch we don't know the final location yet
388 // as some preceding instructions may need to be expanded, so we record a non-final offset.
389 // In FinalizeCode(), we expand the sizes of branches and literal loads that are out of
390 // range. With each expansion, we need to update dependent Fixups, i.e. insntructios with
391 // target on the other side of the expanded insn, as their offsets change and this may
392 // trigger further expansion.
393 //
394 // All Fixups have a 'fixup id' which is a 16 bit unsigned number used to identify the
395 // Fixup. For each unresolved label we keep a singly-linked list of all Fixups pointing
396 // to it, using the fixup ids as links. The first link is stored in the label's position
397 // (the label is linked but not bound), the following links are stored in the code buffer,
398 // in the placeholder where we will eventually emit the actual code.
399
400 class Fixup {
401 public:
402 // Branch type.
403 enum Type : uint8_t {
404 kConditional, // B<cond>.
405 kUnconditional, // B.
406 kUnconditionalLink, // BL.
407 kUnconditionalLinkX, // BLX.
408 kCompareAndBranchXZero, // cbz/cbnz.
409 kLoadLiteralNarrow, // Load narrrow integer literal.
410 kLoadLiteralWide, // Load wide integer literal.
Andreas Gampe7cffc3b2015-10-19 21:31:53 -0700411 kLoadLiteralAddr, // Load address of literal (used for jump table).
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000412 kLoadFPLiteralSingle, // Load FP literal single.
413 kLoadFPLiteralDouble, // Load FP literal double.
414 };
415
416 // Calculated size of branch instruction based on type and offset.
417 enum Size : uint8_t {
418 // Branch variants.
419 kBranch16Bit,
420 kBranch32Bit,
421 // NOTE: We don't support branches which would require multiple instructions, i.e.
422 // conditinoal branches beyond +-1MiB and unconditional branches beyond +-16MiB.
423
424 // CBZ/CBNZ variants.
425 kCbxz16Bit, // CBZ/CBNZ rX, label; X < 8; 7-bit positive offset.
426 kCbxz32Bit, // CMP rX, #0 + Bcc label; X < 8; 16-bit Bcc; +-8-bit offset.
427 kCbxz48Bit, // CMP rX, #0 + Bcc label; X < 8; 32-bit Bcc; up to +-1MiB offset.
428
429 // Load integer literal variants.
430 // LDR rX, label; X < 8; 16-bit variant up to 1KiB offset; 2 bytes.
431 kLiteral1KiB,
432 // LDR rX, label; 32-bit variant up to 4KiB offset; 4 bytes.
433 kLiteral4KiB,
434 // MOV rX, imm16 + ADD rX, pc + LDR rX, [rX]; X < 8; up to 64KiB offset; 8 bytes.
435 kLiteral64KiB,
436 // MOV rX, modimm + ADD rX, pc + LDR rX, [rX, #imm12]; up to 1MiB offset; 10 bytes.
437 kLiteral1MiB,
438 // NOTE: We don't provide the 12-byte version of kLiteralFar below where the LDR is 16-bit.
439 // MOV rX, imm16 + MOVT rX, imm16 + ADD rX, pc + LDR rX, [rX]; any offset; 14 bytes.
440 kLiteralFar,
441
Andreas Gampe7cffc3b2015-10-19 21:31:53 -0700442 // Load literal base addr.
443 // ADR rX, label; X < 8; 8 bit immediate, shifted to 10 bit. 2 bytes.
444 kLiteralAddr1KiB,
445 // ADR rX, label; 4KiB offset. 4 bytes.
446 kLiteralAddr4KiB,
447 // MOV rX, imm16 + ADD rX, pc; 64KiB offset. 6 bytes.
448 kLiteralAddr64KiB,
449 // MOV rX, imm16 + MOVT rX, imm16 + ADD rX, pc; any offset; 10 bytes.
450 kLiteralAddrFar,
451
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000452 // Load long or FP literal variants.
453 // VLDR s/dX, label; 32-bit insn, up to 1KiB offset; 4 bytes.
454 kLongOrFPLiteral1KiB,
455 // MOV ip, modimm + ADD ip, pc + VLDR s/dX, [IP, #imm8*4]; up to 256KiB offset; 10 bytes.
456 kLongOrFPLiteral256KiB,
457 // MOV ip, imm16 + MOVT ip, imm16 + ADD ip, pc + VLDR s/dX, [IP]; any offset; 14 bytes.
458 kLongOrFPLiteralFar,
459 };
460
461 // Unresolved branch possibly with a condition.
462 static Fixup Branch(uint32_t location, Type type, Size size = kBranch16Bit,
463 Condition cond = AL) {
464 DCHECK(type == kConditional || type == kUnconditional ||
465 type == kUnconditionalLink || type == kUnconditionalLinkX);
466 DCHECK(size == kBranch16Bit || size == kBranch32Bit);
467 DCHECK(size == kBranch32Bit || (type == kConditional || type == kUnconditional));
468 return Fixup(kNoRegister, kNoRegister, kNoSRegister, kNoDRegister,
469 cond, type, size, location);
470 }
471
472 // Unresolved compare-and-branch instruction with a register and condition (EQ or NE).
473 static Fixup CompareAndBranch(uint32_t location, Register rn, Condition cond) {
474 DCHECK(cond == EQ || cond == NE);
475 return Fixup(rn, kNoRegister, kNoSRegister, kNoDRegister,
476 cond, kCompareAndBranchXZero, kCbxz16Bit, location);
477 }
478
479 // Load narrow literal.
Andreas Gampe7cffc3b2015-10-19 21:31:53 -0700480 static Fixup LoadNarrowLiteral(uint32_t location, Register rt, Size size) {
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000481 DCHECK(size == kLiteral1KiB || size == kLiteral4KiB || size == kLiteral64KiB ||
482 size == kLiteral1MiB || size == kLiteralFar);
483 DCHECK(!IsHighRegister(rt) || (size != kLiteral1KiB && size != kLiteral64KiB));
484 return Fixup(rt, kNoRegister, kNoSRegister, kNoDRegister,
485 AL, kLoadLiteralNarrow, size, location);
486 }
487
488 // Load wide literal.
489 static Fixup LoadWideLiteral(uint32_t location, Register rt, Register rt2,
490 Size size = kLongOrFPLiteral1KiB) {
491 DCHECK(size == kLongOrFPLiteral1KiB || size == kLongOrFPLiteral256KiB ||
492 size == kLongOrFPLiteralFar);
493 DCHECK(!IsHighRegister(rt) || (size != kLiteral1KiB && size != kLiteral64KiB));
494 return Fixup(rt, rt2, kNoSRegister, kNoDRegister,
495 AL, kLoadLiteralWide, size, location);
496 }
497
498 // Load FP single literal.
499 static Fixup LoadSingleLiteral(uint32_t location, SRegister sd,
500 Size size = kLongOrFPLiteral1KiB) {
501 DCHECK(size == kLongOrFPLiteral1KiB || size == kLongOrFPLiteral256KiB ||
502 size == kLongOrFPLiteralFar);
503 return Fixup(kNoRegister, kNoRegister, sd, kNoDRegister,
504 AL, kLoadFPLiteralSingle, size, location);
505 }
506
507 // Load FP double literal.
508 static Fixup LoadDoubleLiteral(uint32_t location, DRegister dd,
509 Size size = kLongOrFPLiteral1KiB) {
510 DCHECK(size == kLongOrFPLiteral1KiB || size == kLongOrFPLiteral256KiB ||
511 size == kLongOrFPLiteralFar);
512 return Fixup(kNoRegister, kNoRegister, kNoSRegister, dd,
513 AL, kLoadFPLiteralDouble, size, location);
514 }
515
Andreas Gampe7cffc3b2015-10-19 21:31:53 -0700516 static Fixup LoadLiteralAddress(uint32_t location, Register rt, Size size) {
517 DCHECK(size == kLiteralAddr1KiB || size == kLiteralAddr4KiB || size == kLiteralAddr64KiB ||
518 size == kLiteralAddrFar);
519 DCHECK(!IsHighRegister(rt) || size != kLiteralAddr1KiB);
520 return Fixup(rt, kNoRegister, kNoSRegister, kNoDRegister,
521 AL, kLoadLiteralAddr, size, location);
522 }
523
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000524 Type GetType() const {
525 return type_;
526 }
527
Vladimir Marko663c9342015-07-22 11:28:14 +0100528 bool IsLoadLiteral() const {
529 return GetType() >= kLoadLiteralNarrow;
530 }
531
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000532 Size GetOriginalSize() const {
533 return original_size_;
534 }
535
536 Size GetSize() const {
537 return size_;
538 }
539
540 uint32_t GetOriginalSizeInBytes() const;
541
542 uint32_t GetSizeInBytes() const;
543
544 uint32_t GetLocation() const {
545 return location_;
546 }
547
548 uint32_t GetAdjustment() const {
549 return adjustment_;
550 }
551
Vladimir Marko6b756b52015-07-14 11:58:38 +0100552 // Prepare the assembler->fixup_dependents_ and each Fixup's dependents_start_/count_.
553 static void PrepareDependents(Thumb2Assembler* assembler);
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000554
Vladimir Marko6b756b52015-07-14 11:58:38 +0100555 ArrayRef<FixupId> Dependents(const Thumb2Assembler& assembler) const {
556 return ArrayRef<FixupId>(assembler.fixup_dependents_.get() + dependents_start_,
557 dependents_count_);
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000558 }
559
560 // Resolve a branch when the target is known.
561 void Resolve(uint32_t target) {
562 DCHECK_EQ(target_, kUnresolved);
563 DCHECK_NE(target, kUnresolved);
564 target_ = target;
565 }
566
567 // Check if the current size is OK for current location_, target_ and adjustment_.
568 // If not, increase the size. Return the size increase, 0 if unchanged.
569 // If the target if after this Fixup, also add the difference to adjustment_,
570 // so that we don't need to consider forward Fixups as their own dependencies.
571 uint32_t AdjustSizeIfNeeded(uint32_t current_code_size);
572
573 // Increase adjustments. This is called for dependents of a Fixup when its size changes.
574 void IncreaseAdjustment(uint32_t increase) {
575 adjustment_ += increase;
576 }
577
578 // Finalize the branch with an adjustment to the location. Both location and target are updated.
579 void Finalize(uint32_t location_adjustment) {
580 DCHECK_NE(target_, kUnresolved);
581 location_ += location_adjustment;
582 target_ += location_adjustment;
583 }
584
585 // Emit the branch instruction into the assembler buffer. This does the
586 // encoding into the thumb instruction.
587 void Emit(AssemblerBuffer* buffer, uint32_t code_size) const;
588
589 private:
590 Fixup(Register rn, Register rt2, SRegister sd, DRegister dd,
591 Condition cond, Type type, Size size, uint32_t location)
592 : rn_(rn),
593 rt2_(rt2),
594 sd_(sd),
595 dd_(dd),
596 cond_(cond),
597 type_(type),
598 original_size_(size), size_(size),
599 location_(location),
600 target_(kUnresolved),
601 adjustment_(0u),
Vladimir Marko6b756b52015-07-14 11:58:38 +0100602 dependents_count_(0u),
603 dependents_start_(0u) {
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000604 }
605 static size_t SizeInBytes(Size size);
606
607 // The size of padding added before the literal pool.
608 static size_t LiteralPoolPaddingSize(uint32_t current_code_size);
609
610 // Returns the offset from the PC-using insn to the target.
611 int32_t GetOffset(uint32_t current_code_size) const;
612
613 size_t IncreaseSize(Size new_size);
614
615 int32_t LoadWideOrFpEncoding(Register rbase, int32_t offset) const;
616
617 static constexpr uint32_t kUnresolved = 0xffffffff; // Value for target_ for unresolved.
618
619 const Register rn_; // Rn for cbnz/cbz, Rt for literal loads.
620 Register rt2_; // For kLoadLiteralWide.
621 SRegister sd_; // For kLoadFPLiteralSingle.
622 DRegister dd_; // For kLoadFPLiteralDouble.
623 const Condition cond_;
624 const Type type_;
625 Size original_size_;
626 Size size_;
627 uint32_t location_; // Offset into assembler buffer in bytes.
628 uint32_t target_; // Offset into assembler buffer in bytes.
629 uint32_t adjustment_; // The number of extra bytes inserted between location_ and target_.
Vladimir Marko6b756b52015-07-14 11:58:38 +0100630 // Fixups that require adjustment when current size changes are stored in a single
631 // array in the assembler and we store only the start index and count here.
632 uint32_t dependents_count_;
633 uint32_t dependents_start_;
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000634 };
635
Dave Allison65fcc2c2014-04-28 13:45:27 -0700636 // Emit a single 32 or 16 bit data processing instruction.
637 void EmitDataProcessing(Condition cond,
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700638 Opcode opcode,
Vladimir Marko73cf0fb2015-07-30 15:07:22 +0100639 SetCc set_cc,
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700640 Register rn,
641 Register rd,
642 const ShifterOperand& so);
Dave Allison65fcc2c2014-04-28 13:45:27 -0700643
644 // Must the instruction be 32 bits or can it possibly be encoded
645 // in 16 bits?
646 bool Is32BitDataProcessing(Condition cond,
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700647 Opcode opcode,
Vladimir Marko73cf0fb2015-07-30 15:07:22 +0100648 SetCc set_cc,
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700649 Register rn,
650 Register rd,
651 const ShifterOperand& so);
Dave Allison65fcc2c2014-04-28 13:45:27 -0700652
653 // Emit a 32 bit data processing instruction.
654 void Emit32BitDataProcessing(Condition cond,
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700655 Opcode opcode,
Vladimir Marko73cf0fb2015-07-30 15:07:22 +0100656 SetCc set_cc,
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700657 Register rn,
658 Register rd,
659 const ShifterOperand& so);
Dave Allison65fcc2c2014-04-28 13:45:27 -0700660
661 // Emit a 16 bit data processing instruction.
662 void Emit16BitDataProcessing(Condition cond,
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700663 Opcode opcode,
Vladimir Marko73cf0fb2015-07-30 15:07:22 +0100664 SetCc set_cc,
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700665 Register rn,
666 Register rd,
667 const ShifterOperand& so);
Dave Allison65fcc2c2014-04-28 13:45:27 -0700668
669 void Emit16BitAddSub(Condition cond,
670 Opcode opcode,
Vladimir Marko73cf0fb2015-07-30 15:07:22 +0100671 SetCc set_cc,
Dave Allison65fcc2c2014-04-28 13:45:27 -0700672 Register rn,
673 Register rd,
674 const ShifterOperand& so);
675
676 uint16_t EmitCompareAndBranch(Register rn, uint16_t prev, bool n);
677
678 void EmitLoadStore(Condition cond,
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700679 bool load,
680 bool byte,
681 bool half,
682 bool is_signed,
683 Register rd,
684 const Address& ad);
Dave Allison65fcc2c2014-04-28 13:45:27 -0700685
686 void EmitMemOpAddressMode3(Condition cond,
687 int32_t mode,
688 Register rd,
689 const Address& ad);
690
691 void EmitMultiMemOp(Condition cond,
692 BlockAddressMode am,
693 bool load,
694 Register base,
695 RegList regs);
696
697 void EmitMulOp(Condition cond,
698 int32_t opcode,
699 Register rd,
700 Register rn,
701 Register rm,
702 Register rs);
703
704 void EmitVFPsss(Condition cond,
705 int32_t opcode,
706 SRegister sd,
707 SRegister sn,
708 SRegister sm);
709
710 void EmitVFPddd(Condition cond,
711 int32_t opcode,
712 DRegister dd,
713 DRegister dn,
714 DRegister dm);
715
716 void EmitVFPsd(Condition cond,
717 int32_t opcode,
718 SRegister sd,
719 DRegister dm);
720
721 void EmitVFPds(Condition cond,
722 int32_t opcode,
723 DRegister dd,
724 SRegister sm);
725
726 void EmitVPushPop(uint32_t reg, int nregs, bool push, bool dbl, Condition cond);
727
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000728 void EmitBranch(Condition cond, Label* label, bool link, bool x);
Dave Allison65fcc2c2014-04-28 13:45:27 -0700729 static int32_t EncodeBranchOffset(int32_t offset, int32_t inst);
730 static int DecodeBranchOffset(int32_t inst);
731 int32_t EncodeTstOffset(int offset, int32_t inst);
732 int DecodeTstOffset(int32_t inst);
Vladimir Marko73cf0fb2015-07-30 15:07:22 +0100733 void EmitShift(Register rd, Register rm, Shift shift, uint8_t amount,
734 Condition cond = AL, SetCc set_cc = kCcDontCare);
735 void EmitShift(Register rd, Register rn, Shift shift, Register rm,
736 Condition cond = AL, SetCc set_cc = kCcDontCare);
Dave Allison65fcc2c2014-04-28 13:45:27 -0700737
Nicolas Geoffrayd126ba12015-05-20 11:25:27 +0100738 // Whether the assembler can relocate branches. If false, unresolved branches will be
739 // emitted on 32bits.
740 bool can_relocate_branches_;
741
742 // Force the assembler to use 32 bit thumb2 instructions.
743 bool force_32bit_;
Dave Allison65fcc2c2014-04-28 13:45:27 -0700744
745 // IfThen conditions. Used to check that conditional instructions match the preceding IT.
746 Condition it_conditions_[4];
747 uint8_t it_cond_index_;
748 Condition next_condition_;
749
750 void SetItCondition(ItState s, Condition cond, uint8_t index);
751
752 void CheckCondition(Condition cond) {
753 CHECK_EQ(cond, next_condition_);
754
755 // Move to the next condition if there is one.
756 if (it_cond_index_ < 3) {
757 ++it_cond_index_;
758 next_condition_ = it_conditions_[it_cond_index_];
759 } else {
760 next_condition_ = AL;
761 }
762 }
763
764 void CheckConditionLastIt(Condition cond) {
765 if (it_cond_index_ < 3) {
766 // Check that the next condition is AL. This means that the
767 // current condition is the last in the IT block.
768 CHECK_EQ(it_conditions_[it_cond_index_ + 1], AL);
769 }
770 CheckCondition(cond);
771 }
772
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000773 FixupId AddFixup(Fixup fixup) {
774 FixupId fixup_id = static_cast<FixupId>(fixups_.size());
775 fixups_.push_back(fixup);
776 // For iterating using FixupId, we need the next id to be representable.
777 DCHECK_EQ(static_cast<size_t>(static_cast<FixupId>(fixups_.size())), fixups_.size());
778 return fixup_id;
Dave Allison65fcc2c2014-04-28 13:45:27 -0700779 }
780
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000781 Fixup* GetFixup(FixupId fixup_id) {
782 DCHECK_LT(fixup_id, fixups_.size());
783 return &fixups_[fixup_id];
Dave Allison65fcc2c2014-04-28 13:45:27 -0700784 }
785
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000786 void BindLabel(Label* label, uint32_t bound_pc);
Andreas Gampe7cffc3b2015-10-19 21:31:53 -0700787 uint32_t BindLiterals();
788 void BindJumpTables(uint32_t code_size);
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000789 void AdjustFixupIfNeeded(Fixup* fixup, uint32_t* current_code_size,
790 std::deque<FixupId>* fixups_to_recalculate);
791 uint32_t AdjustFixups();
792 void EmitFixups(uint32_t adjusted_code_size);
793 void EmitLiterals();
Andreas Gampe7cffc3b2015-10-19 21:31:53 -0700794 void EmitJumpTables();
Dave Allison65fcc2c2014-04-28 13:45:27 -0700795
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000796 static int16_t BEncoding16(int32_t offset, Condition cond);
797 static int32_t BEncoding32(int32_t offset, Condition cond);
798 static int16_t CbxzEncoding16(Register rn, int32_t offset, Condition cond);
799 static int16_t CmpRnImm8Encoding16(Register rn, int32_t value);
800 static int16_t AddRdnRmEncoding16(Register rdn, Register rm);
801 static int32_t MovwEncoding32(Register rd, int32_t value);
802 static int32_t MovtEncoding32(Register rd, int32_t value);
803 static int32_t MovModImmEncoding32(Register rd, int32_t value);
804 static int16_t LdrLitEncoding16(Register rt, int32_t offset);
805 static int32_t LdrLitEncoding32(Register rt, int32_t offset);
806 static int32_t LdrdEncoding32(Register rt, Register rt2, Register rn, int32_t offset);
807 static int32_t VldrsEncoding32(SRegister sd, Register rn, int32_t offset);
808 static int32_t VldrdEncoding32(DRegister dd, Register rn, int32_t offset);
809 static int16_t LdrRtRnImm5Encoding16(Register rt, Register rn, int32_t offset);
810 static int32_t LdrRtRnImm12Encoding(Register rt, Register rn, int32_t offset);
Andreas Gampe7cffc3b2015-10-19 21:31:53 -0700811 static int16_t AdrEncoding16(Register rd, int32_t offset);
812 static int32_t AdrEncoding32(Register rd, int32_t offset);
Dave Allison65fcc2c2014-04-28 13:45:27 -0700813
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000814 std::vector<Fixup> fixups_;
Vladimir Marko6b756b52015-07-14 11:58:38 +0100815 std::unique_ptr<FixupId[]> fixup_dependents_;
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000816
817 // Use std::deque<> for literal labels to allow insertions at the end
818 // without invalidating pointers and references to existing elements.
819 std::deque<Literal> literals_;
820
Andreas Gampe7cffc3b2015-10-19 21:31:53 -0700821 // Jump table list.
822 std::deque<JumpTable> jump_tables_;
823
Vladimir Markocf93a5c2015-06-16 11:33:24 +0000824 // Data for AdjustedPosition(), see the description there.
825 uint32_t last_position_adjustment_;
826 uint32_t last_old_position_;
827 FixupId last_fixup_id_;
Dave Allison65fcc2c2014-04-28 13:45:27 -0700828};
829
830} // namespace arm
831} // namespace art
832
833#endif // ART_COMPILER_UTILS_ARM_ASSEMBLER_THUMB2_H_