Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceTargetLoweringARM32.h - ARM32 lowering ----*- C++ -*-===// | 1 //===- subzero/src/IceTargetLoweringARM32.h - ARM32 lowering ----*- 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 bool doBranchOpt(Inst *I, const CfgNode *NextNode) override; | 78 bool doBranchOpt(Inst *I, const CfgNode *NextNode) override; |
| 79 | 79 |
| 80 SizeT getNumRegisters() const override { return RegARM32::Reg_NUM; } | 80 SizeT getNumRegisters() const override { return RegARM32::Reg_NUM; } |
| 81 Variable *getPhysicalRegister(SizeT RegNum, Type Ty = IceType_void) override; | 81 Variable *getPhysicalRegister(SizeT RegNum, Type Ty = IceType_void) override; |
| 82 IceString getRegName(SizeT RegNum, Type Ty) const override; | 82 IceString getRegName(SizeT RegNum, Type Ty) const override; |
| 83 llvm::SmallBitVector getRegisterSet(RegSetMask Include, | 83 llvm::SmallBitVector getRegisterSet(RegSetMask Include, |
| 84 RegSetMask Exclude) const override; | 84 RegSetMask Exclude) const override; |
| 85 const llvm::SmallBitVector & | 85 const llvm::SmallBitVector & |
| 86 getRegistersForVariable(const Variable *Var) const override { | 86 getRegistersForVariable(const Variable *Var) const override { |
| 87 RegClass RC = Var->getRegClass(); | 87 RegClass RC = Var->getRegClass(); |
| 88 assert(RC < RC_Target); | 88 switch (RC) { |
| 89 return TypeToRegisterSet[RC]; | 89 default: |
| 90 assert(RC < RC_Target); | |
| 91 return TypeToRegisterSet[RC]; | |
| 92 case RegARM32::RCARM32_QtoS: | |
| 93 assert(RegARM32::RCARM32_QtoS < RegARM32::RCARM32_NUM); | |
|
Jim Stichnoth
2016/02/03 15:28:38
I think this assert is pretty much guaranteed to b
Eric Holk
2016/02/03 21:02:22
Done.
| |
| 94 return TypeToRegisterSet[RC]; | |
| 95 } | |
| 90 } | 96 } |
| 91 const llvm::SmallBitVector & | 97 const llvm::SmallBitVector & |
| 92 getAllRegistersForVariable(const Variable *Var) const override { | 98 getAllRegistersForVariable(const Variable *Var) const override { |
| 93 RegClass RC = Var->getRegClass(); | 99 RegClass RC = Var->getRegClass(); |
| 94 assert(RC < RC_Target); | 100 assert((RegARM32::RegClassARM32)RC < RegARM32::RCARM32_NUM); |
| 95 return TypeToRegisterSetUnfiltered[RC]; | 101 return TypeToRegisterSetUnfiltered[RC]; |
| 96 } | 102 } |
| 97 const llvm::SmallBitVector &getAliasesForRegister(SizeT Reg) const override { | 103 const llvm::SmallBitVector &getAliasesForRegister(SizeT Reg) const override { |
| 98 return RegisterAliases[Reg]; | 104 return RegisterAliases[Reg]; |
| 99 } | 105 } |
| 100 bool hasFramePointer() const override { return UsesFramePointer; } | 106 bool hasFramePointer() const override { return UsesFramePointer; } |
| 101 void setHasFramePointer() override { UsesFramePointer = true; } | 107 void setHasFramePointer() override { UsesFramePointer = true; } |
| 102 SizeT getStackReg() const override { return RegARM32::Reg_sp; } | 108 SizeT getStackReg() const override { return RegARM32::Reg_sp; } |
| 103 SizeT getFrameReg() const override { return RegARM32::Reg_fp; } | 109 SizeT getFrameReg() const override { return RegARM32::Reg_fp; } |
| 104 SizeT getFrameOrStackReg() const override { | 110 SizeT getFrameOrStackReg() const override { |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 auto *Instr = Context.insert<InstARM32Mov>(Dest, Src0, Pred); | 412 auto *Instr = Context.insert<InstARM32Mov>(Dest, Src0, Pred); |
| 407 Instr->setDestRedefined(); | 413 Instr->setDestRedefined(); |
| 408 if (Instr->isMultiDest()) { | 414 if (Instr->isMultiDest()) { |
| 409 // If Instr is multi-dest, then Dest must be a Variable64On32. We add a | 415 // If Instr is multi-dest, then Dest must be a Variable64On32. We add a |
| 410 // fake-def for Instr.DestHi here. | 416 // fake-def for Instr.DestHi here. |
| 411 assert(llvm::isa<Variable64On32>(Dest)); | 417 assert(llvm::isa<Variable64On32>(Dest)); |
| 412 Context.insert<InstFakeDef>(Instr->getDestHi()); | 418 Context.insert<InstFakeDef>(Instr->getDestHi()); |
| 413 } | 419 } |
| 414 } | 420 } |
| 415 | 421 |
| 422 // Generates a vmov instruction to extract the given index from a vector | |
| 423 // register. | |
| 424 void _extract(Variable *Dest, Variable *Src, uint32_t Index, | |
|
Jim Stichnoth
2016/02/03 15:28:38
I would probably rename Src to Src0 for consistenc
John
2016/02/03 16:06:52
It's been common practice (at least in the ARM32 b
Eric Holk
2016/02/03 21:02:22
Done.
Eric Holk
2016/02/03 21:02:22
Done.
| |
| 425 CondARM32::Cond Pred = CondARM32::AL) { | |
| 426 Context.insert<InstARM32Extract>(Dest, Src, Index, Pred); | |
| 427 } | |
| 428 | |
| 429 // Generates a vmov instruction to insert a value into the given index of a | |
| 430 // vector register. | |
| 431 void _insert(Variable *Dest, Variable *Val, uint32_t Index, | |
|
Jim Stichnoth
2016/02/03 15:28:38
I would probably rename Val to Src0 for consistenc
Eric Holk
2016/02/03 21:02:22
Done.
| |
| 432 CondARM32::Cond Pred = CondARM32::AL) { | |
| 433 Context.insert<InstARM32Insert>(Dest, Val, Index, Pred); | |
| 434 } | |
| 435 | |
| 416 // -------------------------------------------------------------------------- | 436 // -------------------------------------------------------------------------- |
| 417 // Begin bool folding machinery. | 437 // Begin bool folding machinery. |
| 418 // | 438 // |
| 419 // There are three types of boolean lowerings handled by this target: | 439 // There are three types of boolean lowerings handled by this target: |
| 420 // | 440 // |
| 421 // 1) Boolean expressions leading to a boolean Variable definition | 441 // 1) Boolean expressions leading to a boolean Variable definition |
| 422 // --------------------------------------------------------------- | 442 // --------------------------------------------------------------- |
| 423 // | 443 // |
| 424 // Whenever a i1 Variable is live out (i.e., its live range extends beyond | 444 // Whenever a i1 Variable is live out (i.e., its live range extends beyond |
| 425 // the defining basic block) we do not fold the operation. We instead | 445 // the defining basic block) we do not fold the operation. We instead |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1216 private: | 1236 private: |
| 1217 ~TargetHeaderARM32() = default; | 1237 ~TargetHeaderARM32() = default; |
| 1218 | 1238 |
| 1219 TargetARM32Features CPUFeatures; | 1239 TargetARM32Features CPUFeatures; |
| 1220 }; | 1240 }; |
| 1221 | 1241 |
| 1222 } // end of namespace ARM32 | 1242 } // end of namespace ARM32 |
| 1223 } // end of namespace Ice | 1243 } // end of namespace Ice |
| 1224 | 1244 |
| 1225 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H | 1245 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H |
| OLD | NEW |