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

Side by Side Diff: src/IceTargetLoweringX8632.h

Issue 605123002: Subzero: Use 'override' as appropriate for C++11. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Insert InstHighLevel into the Inst hierarchy Created 6 years, 2 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
« src/IceInst.h ('K') | « src/IceOperand.h ('k') | no next file » | 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/IceTargetLoweringX8632.h - x86-32 lowering ---*- C++ -*-===// 1 //===- subzero/src/IceTargetLoweringX8632.h - x86-32 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 // This file declares the TargetLoweringX8632 class, which 10 // This file declares the TargetLoweringX8632 class, which
(...skipping 10 matching lines...) Expand all
21 #include "assembler_ia32.h" 21 #include "assembler_ia32.h"
22 #include "IceInstX8632.h" 22 #include "IceInstX8632.h"
23 #include "IceRegistersX8632.h" 23 #include "IceRegistersX8632.h"
24 24
25 namespace Ice { 25 namespace Ice {
26 26
27 class TargetX8632 : public TargetLowering { 27 class TargetX8632 : public TargetLowering {
28 public: 28 public:
29 static TargetX8632 *create(Cfg *Func) { return new TargetX8632(Func); } 29 static TargetX8632 *create(Cfg *Func) { return new TargetX8632(Func); }
30 30
31 virtual void translateOm1(); 31 void translateOm1() override;
32 virtual void translateO2(); 32 void translateO2() override;
33 virtual bool doBranchOpt(Inst *I, const CfgNode *NextNode); 33 bool doBranchOpt(Inst *I, const CfgNode *NextNode) override;
34 34
35 virtual Variable *getPhysicalRegister(SizeT RegNum); 35 Variable *getPhysicalRegister(SizeT RegNum) override;
36 virtual IceString getRegName(SizeT RegNum, Type Ty) const; 36 IceString getRegName(SizeT RegNum, Type Ty) const override;
37 virtual llvm::SmallBitVector getRegisterSet(RegSetMask Include, 37 llvm::SmallBitVector getRegisterSet(RegSetMask Include,
38 RegSetMask Exclude) const; 38 RegSetMask Exclude) const override;
39 virtual const llvm::SmallBitVector &getRegisterSetForType(Type Ty) const { 39 const llvm::SmallBitVector &getRegisterSetForType(Type Ty) const override {
40 return TypeToRegisterSet[Ty]; 40 return TypeToRegisterSet[Ty];
41 } 41 }
42 virtual bool hasFramePointer() const { return IsEbpBasedFrame; } 42 bool hasFramePointer() const override { return IsEbpBasedFrame; }
43 virtual SizeT getFrameOrStackReg() const { 43 SizeT getFrameOrStackReg() const override {
44 return IsEbpBasedFrame ? RegX8632::Reg_ebp : RegX8632::Reg_esp; 44 return IsEbpBasedFrame ? RegX8632::Reg_ebp : RegX8632::Reg_esp;
45 } 45 }
46 virtual size_t typeWidthInBytesOnStack(Type Ty) const { 46 size_t typeWidthInBytesOnStack(Type Ty) const override {
47 // Round up to the next multiple of 4 bytes. In particular, i1, 47 // Round up to the next multiple of 4 bytes. In particular, i1,
48 // i8, and i16 are rounded up to 4 bytes. 48 // i8, and i16 are rounded up to 4 bytes.
49 return (typeWidthInBytes(Ty) + 3) & ~3; 49 return (typeWidthInBytes(Ty) + 3) & ~3;
50 } 50 }
51 virtual SizeT getBundleAlignLog2Bytes() const { return 5; } 51 SizeT getBundleAlignLog2Bytes() const override { return 5; }
52 virtual llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const { 52 llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const override {
53 static const uint8_t Padding[] = { 0xF4 }; 53 static const uint8_t Padding[] = { 0xF4 };
54 return llvm::ArrayRef<uint8_t>(Padding, 1); 54 return llvm::ArrayRef<uint8_t>(Padding, 1);
55 } 55 }
56 virtual void emitVariable(const Variable *Var) const; 56 void emitVariable(const Variable *Var) const override;
57 virtual void lowerArguments(); 57 void lowerArguments() override;
58 virtual void addProlog(CfgNode *Node); 58 void addProlog(CfgNode *Node) override;
59 virtual void addEpilog(CfgNode *Node); 59 void addEpilog(CfgNode *Node) override;
60 virtual void emitConstants() const; 60 void emitConstants() const override;
61 SizeT makeNextLabelNumber() { return NextLabelNumber++; } 61 SizeT makeNextLabelNumber() { return NextLabelNumber++; }
62 // Ensure that a 64-bit Variable has been split into 2 32-bit 62 // Ensure that a 64-bit Variable has been split into 2 32-bit
63 // Variables, creating them if necessary. This is needed for all 63 // Variables, creating them if necessary. This is needed for all
64 // I64 operations, and it is needed for pushing F64 arguments for 64 // I64 operations, and it is needed for pushing F64 arguments for
65 // function calls using the 32-bit push instruction (though the 65 // function calls using the 32-bit push instruction (though the
66 // latter could be done by directly writing to the stack). 66 // latter could be done by directly writing to the stack).
67 void split64(Variable *Var); 67 void split64(Variable *Var);
68 void finishArgumentLowering(Variable *Arg, Variable *FramePtr, 68 void finishArgumentLowering(Variable *Arg, Variable *FramePtr,
69 size_t BasicFrameOffset, size_t &InArgsSizeBytes); 69 size_t BasicFrameOffset, size_t &InArgsSizeBytes);
70 Operand *loOperand(Operand *Operand); 70 Operand *loOperand(Operand *Operand);
71 Operand *hiOperand(Operand *Operand); 71 Operand *hiOperand(Operand *Operand);
72 x86::Address stackVarToAsmOperand(const Variable *Var) const; 72 x86::Address stackVarToAsmOperand(const Variable *Var) const;
73 73
74 enum X86InstructionSet { 74 enum X86InstructionSet {
75 // SSE2 is the PNaCl baseline instruction set. 75 // SSE2 is the PNaCl baseline instruction set.
76 SSE2, 76 SSE2,
77 SSE4_1 77 SSE4_1
78 }; 78 };
79 79
80 X86InstructionSet getInstructionSet() const { return InstructionSet; } 80 X86InstructionSet getInstructionSet() const { return InstructionSet; }
81 81
82 protected: 82 protected:
83 TargetX8632(Cfg *Func); 83 TargetX8632(Cfg *Func);
84 84
85 virtual void postLower(); 85 void postLower() override;
86 86
87 virtual void lowerAlloca(const InstAlloca *Inst); 87 void lowerAlloca(const InstAlloca *Inst) override;
88 virtual void lowerArithmetic(const InstArithmetic *Inst); 88 void lowerArithmetic(const InstArithmetic *Inst) override;
89 virtual void lowerAssign(const InstAssign *Inst); 89 void lowerAssign(const InstAssign *Inst) override;
90 virtual void lowerBr(const InstBr *Inst); 90 void lowerBr(const InstBr *Inst) override;
91 virtual void lowerCall(const InstCall *Inst); 91 void lowerCall(const InstCall *Inst) override;
92 virtual void lowerCast(const InstCast *Inst); 92 void lowerCast(const InstCast *Inst) override;
93 virtual void lowerExtractElement(const InstExtractElement *Inst); 93 void lowerExtractElement(const InstExtractElement *Inst) override;
94 virtual void lowerFcmp(const InstFcmp *Inst); 94 void lowerFcmp(const InstFcmp *Inst) override;
95 virtual void lowerIcmp(const InstIcmp *Inst); 95 void lowerIcmp(const InstIcmp *Inst) override;
96 virtual void lowerIntrinsicCall(const InstIntrinsicCall *Inst); 96 void lowerIntrinsicCall(const InstIntrinsicCall *Inst) override;
97 virtual void lowerInsertElement(const InstInsertElement *Inst); 97 void lowerInsertElement(const InstInsertElement *Inst) override;
98 virtual void lowerLoad(const InstLoad *Inst); 98 void lowerLoad(const InstLoad *Inst) override;
99 virtual void lowerPhi(const InstPhi *Inst); 99 void lowerPhi(const InstPhi *Inst) override;
100 virtual void lowerRet(const InstRet *Inst); 100 void lowerRet(const InstRet *Inst) override;
101 virtual void lowerSelect(const InstSelect *Inst); 101 void lowerSelect(const InstSelect *Inst) override;
102 virtual void lowerStore(const InstStore *Inst); 102 void lowerStore(const InstStore *Inst) override;
103 virtual void lowerSwitch(const InstSwitch *Inst); 103 void lowerSwitch(const InstSwitch *Inst) override;
104 virtual void lowerUnreachable(const InstUnreachable *Inst); 104 void lowerUnreachable(const InstUnreachable *Inst) override;
105 virtual void doAddressOptLoad(); 105 void doAddressOptLoad() override;
106 virtual void doAddressOptStore(); 106 void doAddressOptStore() override;
107 virtual void randomlyInsertNop(float Probability); 107 void randomlyInsertNop(float Probability) override;
108 108
109 // Naive lowering of cmpxchg. 109 // Naive lowering of cmpxchg.
110 void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected, 110 void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected,
111 Operand *Desired); 111 Operand *Desired);
112 // Attempt a more optimized lowering of cmpxchg. Returns true if optimized. 112 // Attempt a more optimized lowering of cmpxchg. Returns true if optimized.
113 bool tryOptimizedCmpxchgCmpBr(Variable *DestPrev, Operand *Ptr, 113 bool tryOptimizedCmpxchgCmpBr(Variable *DestPrev, Operand *Ptr,
114 Operand *Expected, Operand *Desired); 114 Operand *Expected, Operand *Desired);
115 void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr, 115 void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr,
116 Operand *Val); 116 Operand *Val);
117 void lowerCountZeros(bool Cttz, Type Ty, Variable *Dest, Operand *FirstVal, 117 void lowerCountZeros(bool Cttz, Type Ty, Variable *Dest, Operand *FirstVal,
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 llvm::SmallBitVector ScratchRegs; 470 llvm::SmallBitVector ScratchRegs;
471 llvm::SmallBitVector RegsUsed; 471 llvm::SmallBitVector RegsUsed;
472 SizeT NextLabelNumber; 472 SizeT NextLabelNumber;
473 bool ComputedLiveRanges; 473 bool ComputedLiveRanges;
474 VarList PhysicalRegisters; 474 VarList PhysicalRegisters;
475 static IceString RegNames[]; 475 static IceString RegNames[];
476 476
477 private: 477 private:
478 TargetX8632(const TargetX8632 &) LLVM_DELETED_FUNCTION; 478 TargetX8632(const TargetX8632 &) LLVM_DELETED_FUNCTION;
479 TargetX8632 &operator=(const TargetX8632 &) LLVM_DELETED_FUNCTION; 479 TargetX8632 &operator=(const TargetX8632 &) LLVM_DELETED_FUNCTION;
480 virtual ~TargetX8632() {} 480 ~TargetX8632() override {}
481 template <typename T> void emitConstantPool() const; 481 template <typename T> void emitConstantPool() const;
482 }; 482 };
483 483
484 class TargetGlobalInitX8632 : public TargetGlobalInitLowering { 484 class TargetGlobalInitX8632 : public TargetGlobalInitLowering {
485 public: 485 public:
486 static TargetGlobalInitLowering *create(GlobalContext *Ctx) { 486 static TargetGlobalInitLowering *create(GlobalContext *Ctx) {
487 return new TargetGlobalInitX8632(Ctx); 487 return new TargetGlobalInitX8632(Ctx);
488 } 488 }
489 virtual void lower(const IceString &Name, SizeT Align, bool IsInternal, 489 void lower(const IceString &Name, SizeT Align, bool IsInternal, bool IsConst,
490 bool IsConst, bool IsZeroInitializer, SizeT Size, 490 bool IsZeroInitializer, SizeT Size, const char *Data,
491 const char *Data, bool DisableTranslation); 491 bool DisableTranslation) override;
492 492
493 protected: 493 protected:
494 TargetGlobalInitX8632(GlobalContext *Ctx); 494 TargetGlobalInitX8632(GlobalContext *Ctx);
495 495
496 private: 496 private:
497 TargetGlobalInitX8632(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION; 497 TargetGlobalInitX8632(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION;
498 TargetGlobalInitX8632 & 498 TargetGlobalInitX8632 &
499 operator=(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION; 499 operator=(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION;
500 virtual ~TargetGlobalInitX8632() {} 500 ~TargetGlobalInitX8632() override {}
501 }; 501 };
502 502
503 template <> void ConstantInteger32::emit(GlobalContext *Ctx) const; 503 template <> void ConstantInteger32::emit(GlobalContext *Ctx) const;
504 template <> void ConstantInteger64::emit(GlobalContext *Ctx) const; 504 template <> void ConstantInteger64::emit(GlobalContext *Ctx) const;
505 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; 505 template <> void ConstantFloat::emit(GlobalContext *Ctx) const;
506 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; 506 template <> void ConstantDouble::emit(GlobalContext *Ctx) const;
507 507
508 } // end of namespace Ice 508 } // end of namespace Ice
509 509
510 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H 510 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H
OLDNEW
« src/IceInst.h ('K') | « src/IceOperand.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698