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

Side by Side Diff: src/IceAssemblerARM32.cpp

Issue 1535233002: Refactor PUSH/POP in ARM assemblers. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix remaining issues. Created 4 years, 11 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 | « src/IceAssemblerARM32.h ('k') | src/IceInstARM32.h » ('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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 OpEncoding3, 185 OpEncoding3,
186 // Alternate encoding for memory operands for ldrex and strex, which only 186 // Alternate encoding for memory operands for ldrex and strex, which only
187 // actually expect a register. 187 // actually expect a register.
188 OpEncodingMemEx 188 OpEncodingMemEx
189 }; 189 };
190 190
191 IValueT getEncodedGPRegNum(const Variable *Var) { 191 IValueT getEncodedGPRegNum(const Variable *Var) {
192 assert(Var->hasReg()); 192 assert(Var->hasReg());
193 int32_t Reg = Var->getRegNum(); 193 int32_t Reg = Var->getRegNum();
194 return llvm::isa<Variable64On32>(Var) ? RegARM32::getI64PairFirstGPRNum(Reg) 194 return llvm::isa<Variable64On32>(Var) ? RegARM32::getI64PairFirstGPRNum(Reg)
195 : RegARM32::getEncodedGPReg(Reg); 195 : RegARM32::getEncodedGPR(Reg);
196 } 196 }
197 197
198 IValueT getEncodedSRegNum(const Variable *Var) { 198 IValueT getEncodedSRegNum(const Variable *Var) {
199 return RegARM32::getEncodedSReg(Var->getRegNum()); 199 return RegARM32::getEncodedSReg(Var->getRegNum());
200 } 200 }
201 201
202 IValueT getEncodedDRegNum(const Variable *Var) { 202 IValueT getEncodedDRegNum(const Variable *Var) {
203 return RegARM32::getEncodedDReg(Var->getRegNum()); 203 return RegARM32::getEncodedDReg(Var->getRegNum());
204 } 204 }
205 205
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1721 // orr{s}<c> <Rd>, <Rn>, #<RotatedImm8> 1721 // orr{s}<c> <Rd>, <Rn>, #<RotatedImm8>
1722 // 1722 //
1723 // cccc0001100snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, 1723 // cccc0001100snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn,
1724 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8. 1724 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8.
1725 constexpr const char *OrrName = "orr"; 1725 constexpr const char *OrrName = "orr";
1726 constexpr IValueT OrrOpcode = B3 | B2; // i.e. 1100 1726 constexpr IValueT OrrOpcode = B3 | B2; // i.e. 1100
1727 emitType01(Cond, OrrOpcode, OpRd, OpRn, OpSrc1, SetFlags, RdIsPcAndSetFlags, 1727 emitType01(Cond, OrrOpcode, OpRd, OpRn, OpSrc1, SetFlags, RdIsPcAndSetFlags,
1728 OrrName); 1728 OrrName);
1729 } 1729 }
1730 1730
1731 void AssemblerARM32::pop(const Operand *OpRt, CondARM32::Cond Cond) { 1731 void AssemblerARM32::pop(const Variable *OpRt, CondARM32::Cond Cond) {
1732 // POP - ARM section A8.8.132, encoding A2: 1732 // POP - ARM section A8.8.132, encoding A2:
1733 // pop<c> {Rt} 1733 // pop<c> {Rt}
1734 // 1734 //
1735 // cccc010010011101dddd000000000100 where dddd=Rt and cccc=Cond. 1735 // cccc010010011101dddd000000000100 where dddd=Rt and cccc=Cond.
1736 constexpr const char *Pop = "pop"; 1736 constexpr const char *Pop = "pop";
1737 IValueT Rt = encodeGPRegister(OpRt, "Rt", Pop); 1737 IValueT Rt = encodeGPRegister(OpRt, "Rt", Pop);
1738 verifyRegsNotEq(Rt, "Rt", RegARM32::Encoded_Reg_sp, "sp", Pop); 1738 verifyRegsNotEq(Rt, "Rt", RegARM32::Encoded_Reg_sp, "sp", Pop);
1739 // Same as load instruction. 1739 // Same as load instruction.
1740 constexpr bool IsLoad = true; 1740 constexpr bool IsLoad = true;
1741 constexpr bool IsByte = false; 1741 constexpr bool IsByte = false;
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
2250 // 2250 //
2251 // cccc11010D101101dddd1010iiiiiiii where cccc=Cond, ddddD=BaseReg, and 2251 // cccc11010D101101dddd1010iiiiiiii where cccc=Cond, ddddD=BaseReg, and
2252 // iiiiiiii=NumConsecRegs. 2252 // iiiiiiii=NumConsecRegs.
2253 constexpr IValueT VpushOpcode = 2253 constexpr IValueT VpushOpcode =
2254 B27 | B26 | B24 | B21 | B19 | B18 | B16 | B11 | B9; 2254 B27 | B26 | B24 | B21 | B19 | B18 | B16 | B11 | B9;
2255 emitVStackOp(Cond, VpushOpcode, OpBaseReg, NumConsecRegs); 2255 emitVStackOp(Cond, VpushOpcode, OpBaseReg, NumConsecRegs);
2256 } 2256 }
2257 2257
2258 } // end of namespace ARM32 2258 } // end of namespace ARM32
2259 } // end of namespace Ice 2259 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceAssemblerARM32.h ('k') | src/IceInstARM32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698