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

Side by Side Diff: src/IceAssemblerARM32.cpp

Issue 1407263005: Subzero: Fix MINIMAL build issues. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Missed one file Created 5 years, 2 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
« no previous file with comments | « no previous file | tests_lit/assembler/arm32/add.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceAssemblerARM32.cpp - Assembler for ARM32 --*- C++ -*-===// 1 //===- subzero/src/IceAssemblerARM32.cpp - Assembler for ARM32 --*- C++ -*-===//
2 // 2 //
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
4 // for details. All rights reserved. Use of this source code is governed by a 4 // for details. All rights reserved. Use of this source code is governed by a
5 // BSD-style license that can be found in the LICENSE file. 5 // BSD-style license that can be found in the LICENSE file.
6 // 6 //
7 // Modified by the Subzero authors. 7 // Modified by the Subzero authors.
8 // 8 //
9 //===----------------------------------------------------------------------===// 9 //===----------------------------------------------------------------------===//
10 // 10 //
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 DecodedResult decodeOperand(const Operand *Opnd, uint32_t &Value) { 121 DecodedResult decodeOperand(const Operand *Opnd, uint32_t &Value) {
122 if (const auto *Var = llvm::dyn_cast<Variable>(Opnd)) { 122 if (const auto *Var = llvm::dyn_cast<Variable>(Opnd)) {
123 if (Var->hasReg()) { 123 if (Var->hasReg()) {
124 Value = Var->getRegNum(); 124 Value = Var->getRegNum();
125 return DecodedAsRegister; 125 return DecodedAsRegister;
126 } 126 }
127 } else if (const auto *FlexImm = llvm::dyn_cast<OperandARM32FlexImm>(Opnd)) { 127 } else if (const auto *FlexImm = llvm::dyn_cast<OperandARM32FlexImm>(Opnd)) {
128 const uint32_t Immed8 = FlexImm->getImm(); 128 const uint32_t Immed8 = FlexImm->getImm();
129 const uint32_t Rotate = FlexImm->getRotateAmt(); 129 const uint32_t Rotate = FlexImm->getRotateAmt();
130 assert((Rotate < (1 << kRotateBits)) && (Immed8 < (1 << kImmed8Bits))); 130 assert((Rotate < (1 << kRotateBits)) && (Immed8 < (1 << kImmed8Bits)));
131 // TODO(kschimpf): Remove void casts when MINIMAL build allows.
132 (void) kRotateBits;
133 (void) kImmed8Bits;
131 Value = (Rotate << kRotateShift) | (Immed8 << kImmed8Shift); 134 Value = (Rotate << kRotateShift) | (Immed8 << kImmed8Shift);
132 return DecodedAsRotatedImm8; 135 return DecodedAsRotatedImm8;
133 } 136 }
134 return CantDecode; 137 return CantDecode;
135 } 138 }
136 139
137 uint32_t decodeImmRegOffset(RegARM32::GPRRegister Reg, int32_t Offset, 140 uint32_t decodeImmRegOffset(RegARM32::GPRRegister Reg, int32_t Offset,
138 OperandARM32Mem::AddrMode Mode) { 141 OperandARM32Mem::AddrMode Mode) {
139 uint32_t Value = Mode | (encodeGPRRegister(Reg) << kRnShift); 142 uint32_t Value = Mode | (encodeGPRRegister(Reg) << kRnShift);
140 if (Offset < 0) { 143 if (Offset < 0) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 label->setPosition(next); 198 label->setPosition(next);
196 } 199 }
197 // TODO(kschimpf) Decide if we have near jumps. 200 // TODO(kschimpf) Decide if we have near jumps.
198 label->bindTo(bound); 201 label->bindTo(bound);
199 } 202 }
200 203
201 void ARM32::AssemblerARM32::emitType01(CondARM32::Cond Cond, uint32_t Type, 204 void ARM32::AssemblerARM32::emitType01(CondARM32::Cond Cond, uint32_t Type,
202 uint32_t Opcode, bool SetCc, uint32_t Rn, 205 uint32_t Opcode, bool SetCc, uint32_t Rn,
203 uint32_t Rd, uint32_t Imm12) { 206 uint32_t Rd, uint32_t Imm12) {
204 assert(isGPRRegisterDefined(Rd)); 207 assert(isGPRRegisterDefined(Rd));
208 // TODO(kschimpf): Remove void cast when MINIMAL build allows.
209 (void) isGPRRegisterDefined(Rd);
205 assert(Cond != CondARM32::kNone); 210 assert(Cond != CondARM32::kNone);
206 AssemblerBuffer::EnsureCapacity ensured(&Buffer); 211 AssemblerBuffer::EnsureCapacity ensured(&Buffer);
207 const uint32_t Encoding = (encodeCondition(Cond) << kConditionShift) | 212 const uint32_t Encoding = (encodeCondition(Cond) << kConditionShift) |
208 (Type << kTypeShift) | (Opcode << kOpcodeShift) | 213 (Type << kTypeShift) | (Opcode << kOpcodeShift) |
209 (encodeBool(SetCc) << kSShift) | (Rn << kRnShift) | 214 (encodeBool(SetCc) << kSShift) | (Rn << kRnShift) |
210 (Rd << kRdShift) | Imm12; 215 (Rd << kRdShift) | Imm12;
211 emitInst(Encoding); 216 emitInst(Encoding);
212 } 217 }
213 218
214 void ARM32::AssemblerARM32::emitMemOp(CondARM32::Cond Cond, uint32_t InstType, 219 void ARM32::AssemblerARM32::emitMemOp(CondARM32::Cond Cond, uint32_t InstType,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 AssemblerBuffer::EnsureCapacity ensured(&Buffer); 262 AssemblerBuffer::EnsureCapacity ensured(&Buffer);
258 const uint32_t Encoding = (CondARM32::AL << kConditionShift) | B24 | B21 | 263 const uint32_t Encoding = (CondARM32::AL << kConditionShift) | B24 | B21 |
259 ((imm16 >> 4) << 8) | B6 | B5 | B4 | (imm16 & 0xf); 264 ((imm16 >> 4) << 8) | B6 | B5 | B4 | (imm16 & 0xf);
260 emitInst(Encoding); 265 emitInst(Encoding);
261 } 266 }
262 267
263 void ARM32::AssemblerARM32::bx(RegARM32::GPRRegister Rm, CondARM32::Cond Cond) { 268 void ARM32::AssemblerARM32::bx(RegARM32::GPRRegister Rm, CondARM32::Cond Cond) {
264 // cccc000100101111111111110001mmmm where mmmm=rm and cccc=Cond. 269 // cccc000100101111111111110001mmmm where mmmm=rm and cccc=Cond.
265 // (ARM section A8.8.27, encoding A1). 270 // (ARM section A8.8.27, encoding A1).
266 assert(isGPRRegisterDefined(Rm)); 271 assert(isGPRRegisterDefined(Rm));
272 // TODO(kschimpf): Remove void cast when MINIMAL build allows.
273 (void) isGPRRegisterDefined(Rm);
267 assert(isConditionDefined(Cond)); 274 assert(isConditionDefined(Cond));
268 AssemblerBuffer::EnsureCapacity ensured(&Buffer); 275 AssemblerBuffer::EnsureCapacity ensured(&Buffer);
269 const uint32_t Encoding = (encodeCondition(Cond) << kConditionShift) | B24 | 276 const uint32_t Encoding = (encodeCondition(Cond) << kConditionShift) | B24 |
270 B21 | (0xfff << 8) | B4 | 277 B21 | (0xfff << 8) | B4 |
271 (encodeGPRRegister(Rm) << kRmShift); 278 (encodeGPRRegister(Rm) << kRmShift);
272 emitInst(Encoding); 279 emitInst(Encoding);
273 } 280 }
274 281
275 void ARM32::AssemblerARM32::ldr(const Operand *OpRt, const Operand *OpAddress, 282 void ARM32::AssemblerARM32::ldr(const Operand *OpRt, const Operand *OpAddress,
276 CondARM32::Cond Cond) { 283 CondARM32::Cond Cond) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 constexpr uint32_t Add = B1; // 0010 393 constexpr uint32_t Add = B1; // 0010
387 constexpr uint32_t InstType = 1; 394 constexpr uint32_t InstType = 1;
388 emitType01(Cond, InstType, Add, SetFlags, Rn, Rd, Src1Value); 395 emitType01(Cond, InstType, Add, SetFlags, Rn, Rd, Src1Value);
389 return; 396 return;
390 } 397 }
391 } while (0); 398 } while (0);
392 UnimplementedError(Ctx->getFlags()); 399 UnimplementedError(Ctx->getFlags());
393 } 400 }
394 401
395 } // end of namespace Ice 402 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | tests_lit/assembler/arm32/add.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698