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

Side by Side Diff: src/IceInstARM32.h

Issue 1669973002: Fix ARM assembler to pop registers in reverse order of pushes. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | src/IceInstARM32.cpp » ('j') | src/IceInstARM32.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceInstARM32.h - ARM32 machine instructions --*- C++ -*-===// 1 //===- subzero/src/IceInstARM32.h - ARM32 machine instructions --*- C++ -*-===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 virtual const char *getGPROpcode() const = 0; 1095 virtual const char *getGPROpcode() const = 0;
1096 virtual const char *getSRegOpcode() const = 0; 1096 virtual const char *getSRegOpcode() const = 0;
1097 virtual Variable *getStackReg(SizeT Index) const = 0; 1097 virtual Variable *getStackReg(SizeT Index) const = 0;
1098 virtual SizeT getNumStackRegs() const = 0; 1098 virtual SizeT getNumStackRegs() const = 0;
1099 virtual void emitSingleGPR(const Cfg *Func, const EmitForm Form, 1099 virtual void emitSingleGPR(const Cfg *Func, const EmitForm Form,
1100 const Variable *Reg) const = 0; 1100 const Variable *Reg) const = 0;
1101 virtual void emitMultipleGPRs(const Cfg *Func, const EmitForm Form, 1101 virtual void emitMultipleGPRs(const Cfg *Func, const EmitForm Form,
1102 IValueT Registers) const = 0; 1102 IValueT Registers) const = 0;
1103 virtual void emitSRegs(const Cfg *Func, const EmitForm Form, 1103 virtual void emitSRegs(const Cfg *Func, const EmitForm Form,
1104 const Variable *BaseReg, SizeT RegCount) const = 0; 1104 const Variable *BaseReg, SizeT RegCount) const = 0;
1105 // The following are for accessing S registers, which must be popped in
1106 // the reverse order they are pushed.
1107 virtual bool isAssignedConsecutiveRegisters(const Variable *Before,
1108 const Variable *After) const = 0;
1109 virtual Variable *getStackSReg(SizeT Index, SizeT Size) const = 0;
1110 virtual const Variable *updateBaseReg(const Variable *BaseReg,
1111 const Variable *NextReg) const = 0;
1105 }; 1112 };
1106 1113
1107 /// Pops a list of registers. It may be a list of GPRs, or a list of VFP "s" 1114 /// Pops a list of registers. It may be a list of GPRs, or a list of VFP "s"
1108 /// regs, but not both. In any case, the list must be sorted. 1115 /// regs, but not both. In any case, the list must be sorted.
1109 class InstARM32Pop : public InstARM32RegisterStackOp { 1116 class InstARM32Pop : public InstARM32RegisterStackOp {
1110 InstARM32Pop() = delete; 1117 InstARM32Pop() = delete;
1111 InstARM32Pop(const InstARM32Pop &) = delete; 1118 InstARM32Pop(const InstARM32Pop &) = delete;
1112 InstARM32Pop &operator=(const InstARM32Pop &) = delete; 1119 InstARM32Pop &operator=(const InstARM32Pop &) = delete;
1113 1120
1114 public: 1121 public:
1115 static InstARM32Pop *create(Cfg *Func, const VarList &Dests) { 1122 static InstARM32Pop *create(Cfg *Func, const VarList &Dests) {
1116 return new (Func->allocate<InstARM32Pop>()) InstARM32Pop(Func, Dests); 1123 return new (Func->allocate<InstARM32Pop>()) InstARM32Pop(Func, Dests);
1117 } 1124 }
1118 static bool classof(const Inst *Inst) { return isClassof(Inst, Pop); } 1125 static bool classof(const Inst *Inst) { return isClassof(Inst, Pop); }
1119 1126
1120 private: 1127 private:
1121 InstARM32Pop(Cfg *Func, const VarList &Dests); 1128 InstARM32Pop(Cfg *Func, const VarList &Dests);
1122 virtual const char *getGPROpcode() const final; 1129 virtual const char *getGPROpcode() const final;
1123 virtual const char *getSRegOpcode() const final; 1130 virtual const char *getSRegOpcode() const final;
1124 Variable *getStackReg(SizeT Index) const final; 1131 Variable *getStackReg(SizeT Index) const final;
1125 SizeT getNumStackRegs() const final; 1132 SizeT getNumStackRegs() const final;
1126 void emitSingleGPR(const Cfg *Func, const EmitForm Form, 1133 void emitSingleGPR(const Cfg *Func, const EmitForm Form,
1127 const Variable *Reg) const final; 1134 const Variable *Reg) const final;
1128 void emitMultipleGPRs(const Cfg *Func, const EmitForm Form, 1135 void emitMultipleGPRs(const Cfg *Func, const EmitForm Form,
1129 IValueT Registers) const final; 1136 IValueT Registers) const final;
1130 void emitSRegs(const Cfg *Func, const EmitForm Form, const Variable *BaseReg, 1137 void emitSRegs(const Cfg *Func, const EmitForm Form, const Variable *BaseReg,
1131 SizeT RegCount) const final; 1138 SizeT RegCount) const final;
1132 1139 bool isAssignedConsecutiveRegisters(const Variable *Before,
1140 const Variable *After) const final;
1141 Variable *getStackSReg(SizeT Index, SizeT Size) const final;
1142 const Variable *updateBaseReg(const Variable *BaseReg,
1143 const Variable *NextReg) const final;
1133 VarList Dests; 1144 VarList Dests;
John 2016/02/05 01:46:25 For future reference: you could have marked the cl
Karl 2016/02/05 17:00:05 Acknowledged.
1134 }; 1145 };
1135 1146
1136 /// Pushes a list of registers. Just like Pop (see above), the list may be of 1147 /// Pushes a list of registers. Just like Pop (see above), the list may be of
1137 /// GPRs, or VFP "s" registers, but not both. 1148 /// GPRs, or VFP "s" registers, but not both.
1138 class InstARM32Push : public InstARM32RegisterStackOp { 1149 class InstARM32Push : public InstARM32RegisterStackOp {
1139 InstARM32Push() = delete; 1150 InstARM32Push() = delete;
1140 InstARM32Push(const InstARM32Push &) = delete; 1151 InstARM32Push(const InstARM32Push &) = delete;
1141 InstARM32Push &operator=(const InstARM32Push &) = delete; 1152 InstARM32Push &operator=(const InstARM32Push &) = delete;
1142 1153
1143 public: 1154 public:
1144 static InstARM32Push *create(Cfg *Func, const VarList &Srcs) { 1155 static InstARM32Push *create(Cfg *Func, const VarList &Srcs) {
1145 return new (Func->allocate<InstARM32Push>()) InstARM32Push(Func, Srcs); 1156 return new (Func->allocate<InstARM32Push>()) InstARM32Push(Func, Srcs);
1146 } 1157 }
1147 static bool classof(const Inst *Inst) { return isClassof(Inst, Push); } 1158 static bool classof(const Inst *Inst) { return isClassof(Inst, Push); }
1148 1159
1149 private: 1160 private:
1150 InstARM32Push(Cfg *Func, const VarList &Srcs); 1161 InstARM32Push(Cfg *Func, const VarList &Srcs);
1151 const char *getGPROpcode() const final; 1162 const char *getGPROpcode() const final;
1152 const char *getSRegOpcode() const final; 1163 const char *getSRegOpcode() const final;
1153 Variable *getStackReg(SizeT Index) const final; 1164 Variable *getStackReg(SizeT Index) const final;
1154 SizeT getNumStackRegs() const final; 1165 SizeT getNumStackRegs() const final;
1155 void emitSingleGPR(const Cfg *Func, const EmitForm Form, 1166 void emitSingleGPR(const Cfg *Func, const EmitForm Form,
1156 const Variable *Reg) const final; 1167 const Variable *Reg) const final;
1157 void emitMultipleGPRs(const Cfg *Func, const EmitForm Form, 1168 void emitMultipleGPRs(const Cfg *Func, const EmitForm Form,
1158 IValueT Registers) const final; 1169 IValueT Registers) const final;
1159 void emitSRegs(const Cfg *Func, const EmitForm Form, const Variable *BaseReg, 1170 void emitSRegs(const Cfg *Func, const EmitForm Form, const Variable *BaseReg,
1160 SizeT RegCount) const final; 1171 SizeT RegCount) const final;
1172 bool isAssignedConsecutiveRegisters(const Variable *Before,
1173 const Variable *After) const final;
1174 Variable *getStackSReg(SizeT Index, SizeT Size) const final;
1175 const Variable *updateBaseReg(const Variable *BaseReg,
1176 const Variable *NextReg) const final;
1161 }; 1177 };
1162 1178
1163 /// Ret pseudo-instruction. This is actually a "bx" instruction with an "lr" 1179 /// Ret pseudo-instruction. This is actually a "bx" instruction with an "lr"
1164 /// register operand, but epilogue lowering will search for a Ret instead of a 1180 /// register operand, but epilogue lowering will search for a Ret instead of a
1165 /// generic "bx". This instruction also takes a Source operand (for non-void 1181 /// generic "bx". This instruction also takes a Source operand (for non-void
1166 /// returning functions) for liveness analysis, though a FakeUse before the ret 1182 /// returning functions) for liveness analysis, though a FakeUse before the ret
1167 /// would do just as well. 1183 /// would do just as well.
1168 /// 1184 ///
1169 /// NOTE: Even though "bx" can be predicated, for now leave out the predication 1185 /// NOTE: Even though "bx" can be predicated, for now leave out the predication
1170 /// since it's not yet known to be useful for Ret. That may complicate finding 1186 /// since it's not yet known to be useful for Ret. That may complicate finding
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 // violations and link errors. 1460 // violations and link errors.
1445 1461
1446 template <> void InstARM32Ldr::emit(const Cfg *Func) const; 1462 template <> void InstARM32Ldr::emit(const Cfg *Func) const;
1447 template <> void InstARM32Movw::emit(const Cfg *Func) const; 1463 template <> void InstARM32Movw::emit(const Cfg *Func) const;
1448 template <> void InstARM32Movt::emit(const Cfg *Func) const; 1464 template <> void InstARM32Movt::emit(const Cfg *Func) const;
1449 1465
1450 } // end of namespace ARM32 1466 } // end of namespace ARM32
1451 } // end of namespace Ice 1467 } // end of namespace Ice
1452 1468
1453 #endif // SUBZERO_SRC_ICEINSTARM32_H 1469 #endif // SUBZERO_SRC_ICEINSTARM32_H
OLDNEW
« no previous file with comments | « no previous file | src/IceInstARM32.cpp » ('j') | src/IceInstARM32.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698