Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceTargetLoweringX86Base.h - x86 lowering ----*- C++ -*-===// | 1 //===- subzero/src/IceTargetLoweringX86Base.h - x86 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 |
| 11 /// This file declares the TargetLoweringX86 template class, which | 11 /// This file declares the TargetLoweringX86 template class, which |
| 12 /// implements the TargetLowering base interface for the x86 | 12 /// implements the TargetLowering base interface for the x86 |
| 13 /// architecture. | 13 /// architecture. |
| 14 /// | 14 /// |
| 15 //===----------------------------------------------------------------------===// | 15 //===----------------------------------------------------------------------===// |
| 16 | 16 |
| 17 #ifndef SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H | 17 #ifndef SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H |
| 18 #define SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H | 18 #define SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H |
| 19 | 19 |
| 20 #include "IceDefs.h" | 20 #include "IceDefs.h" |
| 21 #include "IceInst.h" | 21 #include "IceInst.h" |
| 22 #include "IceSwitchLowering.h" | |
| 22 #include "IceTargetLowering.h" | 23 #include "IceTargetLowering.h" |
| 23 | 24 |
| 24 #include <type_traits> | 25 #include <type_traits> |
| 25 #include <unordered_map> | 26 #include <unordered_map> |
| 26 | 27 |
| 27 namespace Ice { | 28 namespace Ice { |
| 28 namespace X86Internal { | 29 namespace X86Internal { |
| 29 | 30 |
| 30 template <class MachineTraits> class BoolFolding; | 31 template <class MachineTraits> class BoolFolding; |
| 31 | 32 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 SizeT getFrameOrStackReg() const override { | 124 SizeT getFrameOrStackReg() const override { |
| 124 return IsEbpBasedFrame ? Traits::RegisterSet::Reg_ebp | 125 return IsEbpBasedFrame ? Traits::RegisterSet::Reg_ebp |
| 125 : Traits::RegisterSet::Reg_esp; | 126 : Traits::RegisterSet::Reg_esp; |
| 126 } | 127 } |
| 127 size_t typeWidthInBytesOnStack(Type Ty) const override { | 128 size_t typeWidthInBytesOnStack(Type Ty) const override { |
| 128 // Round up to the next multiple of 4 bytes. In particular, i1, | 129 // Round up to the next multiple of 4 bytes. In particular, i1, |
| 129 // i8, and i16 are rounded up to 4 bytes. | 130 // i8, and i16 are rounded up to 4 bytes. |
| 130 return (typeWidthInBytes(Ty) + 3) & ~3; | 131 return (typeWidthInBytes(Ty) + 3) & ~3; |
| 131 } | 132 } |
| 132 | 133 |
| 134 SizeT getMinJumpTableSize() const override { return 4; } | |
| 135 | |
| 133 void emitVariable(const Variable *Var) const override; | 136 void emitVariable(const Variable *Var) const override; |
| 134 | 137 |
| 135 const char *getConstantPrefix() const final { return "$"; } | 138 const char *getConstantPrefix() const final { return "$"; } |
| 136 void emit(const ConstantUndef *C) const final; | 139 void emit(const ConstantUndef *C) const final; |
| 137 void emit(const ConstantInteger32 *C) const final; | 140 void emit(const ConstantInteger32 *C) const final; |
| 138 void emit(const ConstantInteger64 *C) const final; | 141 void emit(const ConstantInteger64 *C) const final; |
| 139 void emit(const ConstantFloat *C) const final; | 142 void emit(const ConstantFloat *C) const final; |
| 140 void emit(const ConstantDouble *C) const final; | 143 void emit(const ConstantDouble *C) const final; |
| 141 | 144 |
| 142 void lowerArguments() override; | 145 void lowerArguments() override; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected, | 199 void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected, |
| 197 Operand *Desired); | 200 Operand *Desired); |
| 198 /// Attempt a more optimized lowering of cmpxchg. Returns true if optimized. | 201 /// Attempt a more optimized lowering of cmpxchg. Returns true if optimized. |
| 199 bool tryOptimizedCmpxchgCmpBr(Variable *DestPrev, Operand *Ptr, | 202 bool tryOptimizedCmpxchgCmpBr(Variable *DestPrev, Operand *Ptr, |
| 200 Operand *Expected, Operand *Desired); | 203 Operand *Expected, Operand *Desired); |
| 201 void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr, | 204 void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr, |
| 202 Operand *Val); | 205 Operand *Val); |
| 203 void lowerCountZeros(bool Cttz, Type Ty, Variable *Dest, Operand *FirstVal, | 206 void lowerCountZeros(bool Cttz, Type Ty, Variable *Dest, Operand *FirstVal, |
| 204 Operand *SecondVal); | 207 Operand *SecondVal); |
| 205 | 208 |
| 209 /// Check the comparison is in [Min,Max]. The flags register will be modified | |
| 210 /// with: | |
| 211 /// - below equal, if in range | |
| 212 /// - above, set if not in range | |
| 213 /// The index into the range is returned. DoneCmp should be true if the flags | |
| 214 /// contain the result of a comparison with the Compaison. | |
|
jvoung (off chromium)
2015/07/16 22:27:49
Compaison -> Comparison
ascull
2015/07/16 22:55:43
Done.
| |
| 215 Operand *lowerCmpRange(Operand *Comparison, uint64_t Min, uint64_t Max); | |
| 216 /// Lowering of a cluster of switch cases. If the case is not matched control | |
| 217 /// will pass to the default label provided. If the default label is nullptr | |
| 218 /// then control will fall through to the next instruction. DoneCmp should be | |
| 219 /// true if the flags contain the result of a comparison with the Compaison. | |
|
jvoung (off chromium)
2015/07/16 22:27:49
Comparison
ascull
2015/07/16 22:55:44
Done.
| |
| 220 void lowerCaseCluster(const CaseCluster &Case, Operand *Src0, bool DoneCmp, | |
| 221 CfgNode *DefaultLabel = nullptr); | |
| 222 | |
| 206 typedef void (TargetX86Base::*LowerBinOp)(Variable *, Operand *); | 223 typedef void (TargetX86Base::*LowerBinOp)(Variable *, Operand *); |
| 207 void expandAtomicRMWAsCmpxchg(LowerBinOp op_lo, LowerBinOp op_hi, | 224 void expandAtomicRMWAsCmpxchg(LowerBinOp op_lo, LowerBinOp op_hi, |
| 208 Variable *Dest, Operand *Ptr, Operand *Val); | 225 Variable *Dest, Operand *Ptr, Operand *Val); |
| 209 | 226 |
| 210 void eliminateNextVectorSextInstruction(Variable *SignExtendedResult); | 227 void eliminateNextVectorSextInstruction(Variable *SignExtendedResult); |
| 211 | 228 |
| 212 void scalarizeArithmetic(InstArithmetic::OpKind K, Variable *Dest, | 229 void scalarizeArithmetic(InstArithmetic::OpKind K, Variable *Dest, |
| 213 Operand *Src0, Operand *Src1); | 230 Operand *Src0, Operand *Src1); |
| 214 | 231 |
| 215 /// Operand legalization helpers. To deal with address mode | 232 /// Operand legalization helpers. To deal with address mode |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 613 private: | 630 private: |
| 614 ~TargetX86Base() override {} | 631 ~TargetX86Base() override {} |
| 615 BoolFolding FoldingInfo; | 632 BoolFolding FoldingInfo; |
| 616 }; | 633 }; |
| 617 } // end of namespace X86Internal | 634 } // end of namespace X86Internal |
| 618 } // end of namespace Ice | 635 } // end of namespace Ice |
| 619 | 636 |
| 620 #include "IceTargetLoweringX86BaseImpl.h" | 637 #include "IceTargetLoweringX86BaseImpl.h" |
| 621 | 638 |
| 622 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H | 639 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H |
| OLD | NEW |