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

Side by Side Diff: src/IceTargetLoweringX86Base.h

Issue 1838753002: Subzero: Remove IceString. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 4 years, 8 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/IceTargetLoweringX8664Traits.h ('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
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 using SegmentRegisters = typename Traits::X86OperandMem::SegmentRegisters; 72 using SegmentRegisters = typename Traits::X86OperandMem::SegmentRegisters;
73 using SpillVariable = typename Traits::SpillVariable; 73 using SpillVariable = typename Traits::SpillVariable;
74 74
75 using InstX86Br = typename Traits::Insts::Br; 75 using InstX86Br = typename Traits::Insts::Br;
76 using InstX86FakeRMW = typename Traits::Insts::FakeRMW; 76 using InstX86FakeRMW = typename Traits::Insts::FakeRMW;
77 using InstX86Label = typename Traits::Insts::Label; 77 using InstX86Label = typename Traits::Insts::Label;
78 78
79 ~TargetX86Base() override = default; 79 ~TargetX86Base() override = default;
80 80
81 static void staticInit(GlobalContext *Ctx); 81 static void staticInit(GlobalContext *Ctx);
82 static bool shouldBePooled(const Constant *C);
82 83
83 static FixupKind getPcRelFixup() { return PcRelFixup; } 84 static FixupKind getPcRelFixup() { return PcRelFixup; }
84 static FixupKind getAbsFixup() { return AbsFixup; } 85 static FixupKind getAbsFixup() { return AbsFixup; }
85 86
86 bool needSandboxing() const { return NeedSandboxing; } 87 bool needSandboxing() const { return NeedSandboxing; }
87 88
88 void translateOm1() override; 89 void translateOm1() override;
89 void translateO2() override; 90 void translateO2() override;
90 void doLoadOpt(); 91 void doLoadOpt();
91 bool doBranchOpt(Inst *I, const CfgNode *NextNode) override; 92 bool doBranchOpt(Inst *I, const CfgNode *NextNode) override;
92 93
93 SizeT getNumRegisters() const override { 94 SizeT getNumRegisters() const override {
94 return Traits::RegisterSet::Reg_NUM; 95 return Traits::RegisterSet::Reg_NUM;
95 } 96 }
96 Variable *getPhysicalRegister(RegNumT RegNum, 97 Variable *getPhysicalRegister(RegNumT RegNum,
97 Type Ty = IceType_void) override; 98 Type Ty = IceType_void) override;
98 IceString getRegName(RegNumT RegNum, Type Ty) const override; 99 const char *getRegName(RegNumT RegNum, Type Ty) const override;
99 static IceString getRegClassName(RegClass C) { 100 static const char *getRegClassName(RegClass C) {
100 auto ClassNum = static_cast<RegClassX86>(C); 101 auto ClassNum = static_cast<RegClassX86>(C);
101 assert(ClassNum < RCX86_NUM); 102 assert(ClassNum < RCX86_NUM);
102 switch (ClassNum) { 103 switch (ClassNum) {
103 default: 104 default:
104 assert(C < RC_Target); 105 assert(C < RC_Target);
105 return regClassString(C); 106 return regClassString(C);
106 case RCX86_Is64To8: 107 case RCX86_Is64To8:
107 return "i64to8"; // 64-bit GPR truncable to i8 108 return "i64to8"; // 64-bit GPR truncable to i8
108 case RCX86_Is32To8: 109 case RCX86_Is32To8:
109 return "i32to8"; // 32-bit GPR truncable to i8 110 return "i32to8"; // 32-bit GPR truncable to i8
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 virtual void updateMaxOutArgsSizeBytes(uint32_t Size) { 168 virtual void updateMaxOutArgsSizeBytes(uint32_t Size) {
168 MaxOutArgsSizeBytes = std::max(MaxOutArgsSizeBytes, Size); 169 MaxOutArgsSizeBytes = std::max(MaxOutArgsSizeBytes, Size);
169 } 170 }
170 171
171 bool shouldSplitToVariable64On32(Type Ty) const override { 172 bool shouldSplitToVariable64On32(Type Ty) const override {
172 return Traits::Is64Bit ? false : Ty == IceType_i64; 173 return Traits::Is64Bit ? false : Ty == IceType_i64;
173 } 174 }
174 175
175 ConstantRelocatable *createGetIPForRegister(const Variable *Dest) { 176 ConstantRelocatable *createGetIPForRegister(const Variable *Dest) {
176 assert(Dest->hasReg()); 177 assert(Dest->hasReg());
177 const IceString RegName = Traits::getRegName(Dest->getRegNum()); 178 const std::string RegName = Traits::getRegName(Dest->getRegNum());
178 return llvm::cast<ConstantRelocatable>( 179 return llvm::cast<ConstantRelocatable>(Ctx->getConstantExternSym(
179 Ctx->getConstantExternSym(H_getIP_prefix + RegName)); 180 Ctx->getGlobalString(H_getIP_prefix + RegName)));
180 } 181 }
181 182
182 SizeT getMinJumpTableSize() const override { return 4; } 183 SizeT getMinJumpTableSize() const override { return 4; }
183 184
184 void emitVariable(const Variable *Var) const override; 185 void emitVariable(const Variable *Var) const override;
185 186
186 void emit(const ConstantInteger32 *C) const final; 187 void emit(const ConstantInteger32 *C) const final;
187 void emit(const ConstantInteger64 *C) const final; 188 void emit(const ConstantInteger64 *C) const final;
188 void emit(const ConstantFloat *C) const final; 189 void emit(const ConstantFloat *C) const final;
189 void emit(const ConstantDouble *C) const final; 190 void emit(const ConstantDouble *C) const final;
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 TargetDataX86 &operator=(const TargetDataX86 &) = delete; 1091 TargetDataX86 &operator=(const TargetDataX86 &) = delete;
1091 1092
1092 public: 1093 public:
1093 ~TargetDataX86() override = default; 1094 ~TargetDataX86() override = default;
1094 1095
1095 static std::unique_ptr<TargetDataLowering> create(GlobalContext *Ctx) { 1096 static std::unique_ptr<TargetDataLowering> create(GlobalContext *Ctx) {
1096 return makeUnique<TargetDataX86>(Ctx); 1097 return makeUnique<TargetDataX86>(Ctx);
1097 } 1098 }
1098 1099
1099 void lowerGlobals(const VariableDeclarationList &Vars, 1100 void lowerGlobals(const VariableDeclarationList &Vars,
1100 const IceString &SectionSuffix) override; 1101 const std::string &SectionSuffix) override;
1101 void lowerConstants() override; 1102 void lowerConstants() override;
1102 void lowerJumpTables() override; 1103 void lowerJumpTables() override;
1103 1104
1104 private: 1105 private:
1105 ENABLE_MAKE_UNIQUE; 1106 ENABLE_MAKE_UNIQUE;
1106 1107
1107 explicit TargetDataX86(GlobalContext *Ctx) : TargetDataLowering(Ctx){}; 1108 explicit TargetDataX86(GlobalContext *Ctx) : TargetDataLowering(Ctx){};
1108 template <typename T> static void emitConstantPool(GlobalContext *Ctx); 1109 template <typename T> static void emitConstantPool(GlobalContext *Ctx);
1109 }; 1110 };
1110 1111
(...skipping 14 matching lines...) Expand all
1125 1126
1126 explicit TargetHeaderX86(GlobalContext *Ctx) : TargetHeaderLowering(Ctx) {} 1127 explicit TargetHeaderX86(GlobalContext *Ctx) : TargetHeaderLowering(Ctx) {}
1127 }; 1128 };
1128 1129
1129 } // end of namespace X86NAMESPACE 1130 } // end of namespace X86NAMESPACE
1130 } // end of namespace Ice 1131 } // end of namespace Ice
1131 1132
1132 #include "IceTargetLoweringX86BaseImpl.h" 1133 #include "IceTargetLoweringX86BaseImpl.h"
1133 1134
1134 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H 1135 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX8664Traits.h ('k') | src/IceTargetLoweringX86BaseImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698