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

Side by Side Diff: src/IceTargetLowering.h

Issue 1506653002: Subzero: Add Non-SFI support for x86-32. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 4 years, 11 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/IceOperand.cpp ('k') | src/IceTargetLowering.cpp » ('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/IceTargetLowering.h - Lowering interface -----*- C++ -*-===// 1 //===- subzero/src/IceTargetLowering.h - Lowering interface -----*- 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 /// 145 ///
146 /// namespace X8632 { 146 /// namespace X8632 {
147 /// void createTargetLowering(Cfg *Func); 147 /// void createTargetLowering(Cfg *Func);
148 /// } 148 /// }
149 class TargetLowering { 149 class TargetLowering {
150 TargetLowering() = delete; 150 TargetLowering() = delete;
151 TargetLowering(const TargetLowering &) = delete; 151 TargetLowering(const TargetLowering &) = delete;
152 TargetLowering &operator=(const TargetLowering &) = delete; 152 TargetLowering &operator=(const TargetLowering &) = delete;
153 153
154 public: 154 public:
155 static void staticInit(TargetArch Target); 155 static void staticInit(const ClFlags &Flags);
156 // Each target must define a public static method:
157 // static void staticInit(const ClFlags &Flags);
156 158
157 static std::unique_ptr<TargetLowering> createLowering(TargetArch Target, 159 static std::unique_ptr<TargetLowering> createLowering(TargetArch Target,
158 Cfg *Func); 160 Cfg *Func);
159 161
160 virtual std::unique_ptr<Assembler> createAssembler() const = 0; 162 virtual std::unique_ptr<Assembler> createAssembler() const = 0;
161 163
162 void translate() { 164 void translate() {
163 switch (Ctx->getFlags().getOptLevel()) { 165 switch (Ctx->getFlags().getOptLevel()) {
164 case Opt_m1: 166 case Opt_m1:
165 translateOm1(); 167 translateOm1();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 virtual bool shouldSplitToVariable64On32(Type Ty) const = 0; 237 virtual bool shouldSplitToVariable64On32(Type Ty) const = 0;
236 238
237 bool hasComputedFrame() const { return HasComputedFrame; } 239 bool hasComputedFrame() const { return HasComputedFrame; }
238 /// Returns true if this function calls a function that has the "returns 240 /// Returns true if this function calls a function that has the "returns
239 /// twice" attribute. 241 /// twice" attribute.
240 bool callsReturnsTwice() const { return CallsReturnsTwice; } 242 bool callsReturnsTwice() const { return CallsReturnsTwice; }
241 void setCallsReturnsTwice(bool RetTwice) { CallsReturnsTwice = RetTwice; } 243 void setCallsReturnsTwice(bool RetTwice) { CallsReturnsTwice = RetTwice; }
242 SizeT makeNextLabelNumber() { return NextLabelNumber++; } 244 SizeT makeNextLabelNumber() { return NextLabelNumber++; }
243 SizeT makeNextJumpTableNumber() { return NextJumpTableNumber++; } 245 SizeT makeNextJumpTableNumber() { return NextJumpTableNumber++; }
244 LoweringContext &getContext() { return Context; } 246 LoweringContext &getContext() { return Context; }
247 Cfg *getFunc() const { return Func; }
248 GlobalContext *getGlobalContext() const { return Ctx; }
245 249
246 enum RegSet { 250 enum RegSet {
247 RegSet_None = 0, 251 RegSet_None = 0,
248 RegSet_CallerSave = 1 << 0, 252 RegSet_CallerSave = 1 << 0,
249 RegSet_CalleeSave = 1 << 1, 253 RegSet_CalleeSave = 1 << 1,
250 RegSet_StackPointer = 1 << 2, 254 RegSet_StackPointer = 1 << 2,
251 RegSet_FramePointer = 1 << 3, 255 RegSet_FramePointer = 1 << 3,
252 RegSet_All = ~RegSet_None 256 RegSet_All = ~RegSet_None
253 }; 257 };
254 using RegSetMask = uint32_t; 258 using RegSetMask = uint32_t;
(...skipping 12 matching lines...) Expand all
267 uint64_t Salt) const = 0; 271 uint64_t Salt) const = 0;
268 272
269 /// Get the minimum number of clusters required for a jump table to be 273 /// Get the minimum number of clusters required for a jump table to be
270 /// considered. 274 /// considered.
271 virtual SizeT getMinJumpTableSize() const = 0; 275 virtual SizeT getMinJumpTableSize() const = 0;
272 virtual void emitJumpTable(const Cfg *Func, 276 virtual void emitJumpTable(const Cfg *Func,
273 const InstJumpTable *JumpTable) const = 0; 277 const InstJumpTable *JumpTable) const = 0;
274 278
275 virtual void emitVariable(const Variable *Var) const = 0; 279 virtual void emitVariable(const Variable *Var) const = 0;
276 280
277 void emitWithoutPrefix(const ConstantRelocatable *CR) const; 281 void emitWithoutPrefix(const ConstantRelocatable *CR,
278 void emit(const ConstantRelocatable *CR) const; 282 const char *Suffix = "") const;
279 virtual const char *getConstantPrefix() const = 0;
280 283
281 virtual void emit(const ConstantUndef *C) const = 0;
282 virtual void emit(const ConstantInteger32 *C) const = 0; 284 virtual void emit(const ConstantInteger32 *C) const = 0;
283 virtual void emit(const ConstantInteger64 *C) const = 0; 285 virtual void emit(const ConstantInteger64 *C) const = 0;
284 virtual void emit(const ConstantFloat *C) const = 0; 286 virtual void emit(const ConstantFloat *C) const = 0;
285 virtual void emit(const ConstantDouble *C) const = 0; 287 virtual void emit(const ConstantDouble *C) const = 0;
288 virtual void emit(const ConstantUndef *C) const = 0;
289 virtual void emit(const ConstantRelocatable *CR) const = 0;
286 290
287 /// Performs target-specific argument lowering. 291 /// Performs target-specific argument lowering.
288 virtual void lowerArguments() = 0; 292 virtual void lowerArguments() = 0;
289 293
290 virtual void initNodeForLowering(CfgNode *) {} 294 virtual void initNodeForLowering(CfgNode *) {}
291 virtual void addProlog(CfgNode *Node) = 0; 295 virtual void addProlog(CfgNode *Node) = 0;
292 virtual void addEpilog(CfgNode *Node) = 0; 296 virtual void addEpilog(CfgNode *Node) = 0;
293 297
294 virtual ~TargetLowering() = default; 298 virtual ~TargetLowering() = default;
295 299
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 const static constexpr char *H_call_setjmp = "setjmp"; 420 const static constexpr char *H_call_setjmp = "setjmp";
417 const static constexpr char *H_fptosi_f32_i64 = "__Sz_fptosi_f32_i64"; 421 const static constexpr char *H_fptosi_f32_i64 = "__Sz_fptosi_f32_i64";
418 const static constexpr char *H_fptosi_f64_i64 = "__Sz_fptosi_f64_i64"; 422 const static constexpr char *H_fptosi_f64_i64 = "__Sz_fptosi_f64_i64";
419 const static constexpr char *H_fptoui_4xi32_f32 = "__Sz_fptoui_4xi32_f32"; 423 const static constexpr char *H_fptoui_4xi32_f32 = "__Sz_fptoui_4xi32_f32";
420 const static constexpr char *H_fptoui_f32_i32 = "__Sz_fptoui_f32_i32"; 424 const static constexpr char *H_fptoui_f32_i32 = "__Sz_fptoui_f32_i32";
421 const static constexpr char *H_fptoui_f32_i64 = "__Sz_fptoui_f32_i64"; 425 const static constexpr char *H_fptoui_f32_i64 = "__Sz_fptoui_f32_i64";
422 const static constexpr char *H_fptoui_f64_i32 = "__Sz_fptoui_f64_i32"; 426 const static constexpr char *H_fptoui_f64_i32 = "__Sz_fptoui_f64_i32";
423 const static constexpr char *H_fptoui_f64_i64 = "__Sz_fptoui_f64_i64"; 427 const static constexpr char *H_fptoui_f64_i64 = "__Sz_fptoui_f64_i64";
424 const static constexpr char *H_frem_f32 = "fmodf"; 428 const static constexpr char *H_frem_f32 = "fmodf";
425 const static constexpr char *H_frem_f64 = "fmod"; 429 const static constexpr char *H_frem_f64 = "fmod";
430 const static constexpr char *H_getIP_prefix = "__Sz_getIP_";
426 const static constexpr char *H_sdiv_i32 = "__divsi3"; 431 const static constexpr char *H_sdiv_i32 = "__divsi3";
427 const static constexpr char *H_sdiv_i64 = "__divdi3"; 432 const static constexpr char *H_sdiv_i64 = "__divdi3";
428 const static constexpr char *H_sitofp_i64_f32 = "__Sz_sitofp_i64_f32"; 433 const static constexpr char *H_sitofp_i64_f32 = "__Sz_sitofp_i64_f32";
429 const static constexpr char *H_sitofp_i64_f64 = "__Sz_sitofp_i64_f64"; 434 const static constexpr char *H_sitofp_i64_f64 = "__Sz_sitofp_i64_f64";
430 const static constexpr char *H_srem_i32 = "__modsi3"; 435 const static constexpr char *H_srem_i32 = "__modsi3";
431 const static constexpr char *H_srem_i64 = "__moddi3"; 436 const static constexpr char *H_srem_i64 = "__moddi3";
432 const static constexpr char *H_udiv_i32 = "__udivsi3"; 437 const static constexpr char *H_udiv_i32 = "__udivsi3";
433 const static constexpr char *H_udiv_i64 = "__udivdi3"; 438 const static constexpr char *H_udiv_i64 = "__udivdi3";
434 const static constexpr char *H_uitofp_4xi32_4xf32 = "__Sz_uitofp_4xi32_4xf32"; 439 const static constexpr char *H_uitofp_4xi32_4xf32 = "__Sz_uitofp_4xi32_4xf32";
435 const static constexpr char *H_uitofp_i32_f32 = "__Sz_uitofp_i32_f32"; 440 const static constexpr char *H_uitofp_i32_f32 = "__Sz_uitofp_i32_f32";
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 virtual void lower() {} 491 virtual void lower() {}
487 492
488 protected: 493 protected:
489 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {} 494 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {}
490 GlobalContext *Ctx; 495 GlobalContext *Ctx;
491 }; 496 };
492 497
493 } // end of namespace Ice 498 } // end of namespace Ice
494 499
495 #endif // SUBZERO_SRC_ICETARGETLOWERING_H 500 #endif // SUBZERO_SRC_ICETARGETLOWERING_H
OLDNEW
« no previous file with comments | « src/IceOperand.cpp ('k') | src/IceTargetLowering.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698