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

Side by Side Diff: src/IceTargetLoweringX86Base.h

Issue 1234803007: Introduction of improved switch lowering. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Safer check for 0 size type Created 5 years, 5 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/IceTargetLoweringX8632.cpp ('k') | src/IceTargetLoweringX86BaseImpl.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/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
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected, 200 void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected,
198 Operand *Desired); 201 Operand *Desired);
199 /// Attempt a more optimized lowering of cmpxchg. Returns true if optimized. 202 /// Attempt a more optimized lowering of cmpxchg. Returns true if optimized.
200 bool tryOptimizedCmpxchgCmpBr(Variable *DestPrev, Operand *Ptr, 203 bool tryOptimizedCmpxchgCmpBr(Variable *DestPrev, Operand *Ptr,
201 Operand *Expected, Operand *Desired); 204 Operand *Expected, Operand *Desired);
202 void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr, 205 void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr,
203 Operand *Val); 206 Operand *Val);
204 void lowerCountZeros(bool Cttz, Type Ty, Variable *Dest, Operand *FirstVal, 207 void lowerCountZeros(bool Cttz, Type Ty, Variable *Dest, Operand *FirstVal,
205 Operand *SecondVal); 208 Operand *SecondVal);
206 209
210 /// Check the comparison is in [Min,Max]. The flags register will be modified
211 /// with:
212 /// - below equal, if in range
213 /// - above, set if not in range
214 /// The index into the range is returned.
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 Comparison.
220 void lowerCaseCluster(const CaseCluster &Case, Operand *Src0, bool DoneCmp,
221 CfgNode *DefaultLabel = nullptr);
222
207 typedef void (TargetX86Base::*LowerBinOp)(Variable *, Operand *); 223 typedef void (TargetX86Base::*LowerBinOp)(Variable *, Operand *);
208 void expandAtomicRMWAsCmpxchg(LowerBinOp op_lo, LowerBinOp op_hi, 224 void expandAtomicRMWAsCmpxchg(LowerBinOp op_lo, LowerBinOp op_hi,
209 Variable *Dest, Operand *Ptr, Operand *Val); 225 Variable *Dest, Operand *Ptr, Operand *Val);
210 226
211 void eliminateNextVectorSextInstruction(Variable *SignExtendedResult); 227 void eliminateNextVectorSextInstruction(Variable *SignExtendedResult);
212 228
213 void scalarizeArithmetic(InstArithmetic::OpKind K, Variable *Dest, 229 void scalarizeArithmetic(InstArithmetic::OpKind K, Variable *Dest,
214 Operand *Src0, Operand *Src1); 230 Operand *Src0, Operand *Src1);
215 231
216 /// 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
614 private: 630 private:
615 ~TargetX86Base() override {} 631 ~TargetX86Base() override {}
616 BoolFolding FoldingInfo; 632 BoolFolding FoldingInfo;
617 }; 633 };
618 } // end of namespace X86Internal 634 } // end of namespace X86Internal
619 } // end of namespace Ice 635 } // end of namespace Ice
620 636
621 #include "IceTargetLoweringX86BaseImpl.h" 637 #include "IceTargetLoweringX86BaseImpl.h"
622 638
623 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H 639 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | src/IceTargetLoweringX86BaseImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698