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

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: 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
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
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]. If not in the range, above will be
210 /// set, if in the range below equal will be set. The index into the range is
jvoung (off chromium) 2015/07/15 18:32:01 For "above will be set" and "below equal will be..
ascull 2015/07/16 19:38:45 Done.
211 /// returned.
212 Operand *lowerCmpRange(Operand *Comparison, uint64_t Min, uint64_t Max);
213 /// Lowering of a cluster of switch cases. If the case is not matched control
214 /// will pass to the default label provided. If the default label is nullptr
215 /// then control will fall through to the next instruction.
216 void lowerCaseCluster(const CaseCluster &Case, Operand *Src0,
217 CfgNode *DefaultLabel=nullptr);
218
206 typedef void (TargetX86Base::*LowerBinOp)(Variable *, Operand *); 219 typedef void (TargetX86Base::*LowerBinOp)(Variable *, Operand *);
207 void expandAtomicRMWAsCmpxchg(LowerBinOp op_lo, LowerBinOp op_hi, 220 void expandAtomicRMWAsCmpxchg(LowerBinOp op_lo, LowerBinOp op_hi,
208 Variable *Dest, Operand *Ptr, Operand *Val); 221 Variable *Dest, Operand *Ptr, Operand *Val);
209 222
210 void eliminateNextVectorSextInstruction(Variable *SignExtendedResult); 223 void eliminateNextVectorSextInstruction(Variable *SignExtendedResult);
211 224
212 void scalarizeArithmetic(InstArithmetic::OpKind K, Variable *Dest, 225 void scalarizeArithmetic(InstArithmetic::OpKind K, Variable *Dest,
213 Operand *Src0, Operand *Src1); 226 Operand *Src0, Operand *Src1);
214 227
215 /// Operand legalization helpers. To deal with address mode 228 /// Operand legalization helpers. To deal with address mode
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 private: 626 private:
614 ~TargetX86Base() override {} 627 ~TargetX86Base() override {}
615 BoolFolding FoldingInfo; 628 BoolFolding FoldingInfo;
616 }; 629 };
617 } // end of namespace X86Internal 630 } // end of namespace X86Internal
618 } // end of namespace Ice 631 } // end of namespace Ice
619 632
620 #include "IceTargetLoweringX86BaseImpl.h" 633 #include "IceTargetLoweringX86BaseImpl.h"
621 634
622 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H 635 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698