OLD | NEW |
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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 void assignVarStackSlots(VarList &SortedSpilledVariables, | 454 void assignVarStackSlots(VarList &SortedSpilledVariables, |
455 size_t SpillAreaPaddingBytes, | 455 size_t SpillAreaPaddingBytes, |
456 size_t SpillAreaSizeBytes, | 456 size_t SpillAreaSizeBytes, |
457 size_t GlobalsAndSubsequentPaddingSize, | 457 size_t GlobalsAndSubsequentPaddingSize, |
458 bool UsesFramePointer); | 458 bool UsesFramePointer); |
459 | 459 |
460 /// Sort the variables in Source based on required alignment. The variables | 460 /// Sort the variables in Source based on required alignment. The variables |
461 /// with the largest alignment need are placed in the front of the Dest list. | 461 /// with the largest alignment need are placed in the front of the Dest list. |
462 void sortVarsByAlignment(VarList &Dest, const VarList &Source) const; | 462 void sortVarsByAlignment(VarList &Dest, const VarList &Source) const; |
463 | 463 |
464 /// Make a call to an external helper function. | 464 InstCall *makeHelperCall(RuntimeHelper FuncID, Variable *Dest, SizeT MaxSrcs); |
465 InstCall *makeHelperCall(const IceString &Name, Variable *Dest, | |
466 SizeT MaxSrcs); | |
467 | 465 |
468 void _set_dest_redefined() { Context.getLastInserted()->setDestRedefined(); } | 466 void _set_dest_redefined() { Context.getLastInserted()->setDestRedefined(); } |
469 | 467 |
470 bool shouldOptimizeMemIntrins(); | 468 bool shouldOptimizeMemIntrins(); |
471 | 469 |
472 void scalarizeArithmetic(InstArithmetic::OpKind K, Variable *Dest, | 470 void scalarizeArithmetic(InstArithmetic::OpKind K, Variable *Dest, |
473 Operand *Src0, Operand *Src1); | 471 Operand *Src0, Operand *Src1); |
474 | 472 |
475 /// Generalizes scalarizeArithmetic to support other instruction types. | 473 /// Generalizes scalarizeArithmetic to support other instruction types. |
476 /// | 474 /// |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 | 560 |
563 Cfg *Func; | 561 Cfg *Func; |
564 GlobalContext *Ctx; | 562 GlobalContext *Ctx; |
565 bool HasComputedFrame = false; | 563 bool HasComputedFrame = false; |
566 bool CallsReturnsTwice = false; | 564 bool CallsReturnsTwice = false; |
567 SizeT NextLabelNumber = 0; | 565 SizeT NextLabelNumber = 0; |
568 SizeT NextJumpTableNumber = 0; | 566 SizeT NextJumpTableNumber = 0; |
569 LoweringContext Context; | 567 LoweringContext Context; |
570 const SandboxType SandboxingType = ST_None; | 568 const SandboxType SandboxingType = ST_None; |
571 | 569 |
572 // Runtime helper function names | |
573 const static constexpr char *H_bitcast_16xi1_i16 = "__Sz_bitcast_16xi1_i16"; | |
574 const static constexpr char *H_bitcast_8xi1_i8 = "__Sz_bitcast_8xi1_i8"; | |
575 const static constexpr char *H_bitcast_i16_16xi1 = "__Sz_bitcast_i16_16xi1"; | |
576 const static constexpr char *H_bitcast_i8_8xi1 = "__Sz_bitcast_i8_8xi1"; | |
577 const static constexpr char *H_call_ctpop_i32 = "__popcountsi2"; | |
578 const static constexpr char *H_call_ctpop_i64 = "__popcountdi2"; | |
579 const static constexpr char *H_call_longjmp = "longjmp"; | |
580 const static constexpr char *H_call_memcpy = "memcpy"; | |
581 const static constexpr char *H_call_memmove = "memmove"; | |
582 const static constexpr char *H_call_memset = "memset"; | |
583 const static constexpr char *H_call_read_tp = "__nacl_read_tp"; | |
584 const static constexpr char *H_call_setjmp = "setjmp"; | |
585 const static constexpr char *H_fptosi_f32_i64 = "__Sz_fptosi_f32_i64"; | |
586 const static constexpr char *H_fptosi_f64_i64 = "__Sz_fptosi_f64_i64"; | |
587 const static constexpr char *H_fptoui_4xi32_f32 = "__Sz_fptoui_4xi32_f32"; | |
588 const static constexpr char *H_fptoui_f32_i32 = "__Sz_fptoui_f32_i32"; | |
589 const static constexpr char *H_fptoui_f32_i64 = "__Sz_fptoui_f32_i64"; | |
590 const static constexpr char *H_fptoui_f64_i32 = "__Sz_fptoui_f64_i32"; | |
591 const static constexpr char *H_fptoui_f64_i64 = "__Sz_fptoui_f64_i64"; | |
592 const static constexpr char *H_frem_f32 = "fmodf"; | |
593 const static constexpr char *H_frem_f64 = "fmod"; | |
594 const static constexpr char *H_getIP_prefix = "__Sz_getIP_"; | 570 const static constexpr char *H_getIP_prefix = "__Sz_getIP_"; |
595 const static constexpr char *H_sdiv_i32 = "__divsi3"; | |
596 const static constexpr char *H_sdiv_i64 = "__divdi3"; | |
597 const static constexpr char *H_sitofp_i64_f32 = "__Sz_sitofp_i64_f32"; | |
598 const static constexpr char *H_sitofp_i64_f64 = "__Sz_sitofp_i64_f64"; | |
599 const static constexpr char *H_srem_i32 = "__modsi3"; | |
600 const static constexpr char *H_srem_i64 = "__moddi3"; | |
601 const static constexpr char *H_udiv_i32 = "__udivsi3"; | |
602 const static constexpr char *H_udiv_i64 = "__udivdi3"; | |
603 const static constexpr char *H_uitofp_4xi32_4xf32 = "__Sz_uitofp_4xi32_4xf32"; | |
604 const static constexpr char *H_uitofp_i32_f32 = "__Sz_uitofp_i32_f32"; | |
605 const static constexpr char *H_uitofp_i32_f64 = "__Sz_uitofp_i32_f64"; | |
606 const static constexpr char *H_uitofp_i64_f32 = "__Sz_uitofp_i64_f32"; | |
607 const static constexpr char *H_uitofp_i64_f64 = "__Sz_uitofp_i64_f64"; | |
608 const static constexpr char *H_urem_i32 = "__umodsi3"; | |
609 const static constexpr char *H_urem_i64 = "__umoddi3"; | |
610 }; | 571 }; |
611 | 572 |
612 /// TargetDataLowering is used for "lowering" data including initializers for | 573 /// TargetDataLowering is used for "lowering" data including initializers for |
613 /// global variables, and the internal constant pools. It is separated out from | 574 /// global variables, and the internal constant pools. It is separated out from |
614 /// TargetLowering because it does not require a Cfg. | 575 /// TargetLowering because it does not require a Cfg. |
615 class TargetDataLowering { | 576 class TargetDataLowering { |
616 TargetDataLowering() = delete; | 577 TargetDataLowering() = delete; |
617 TargetDataLowering(const TargetDataLowering &) = delete; | 578 TargetDataLowering(const TargetDataLowering &) = delete; |
618 TargetDataLowering &operator=(const TargetDataLowering &) = delete; | 579 TargetDataLowering &operator=(const TargetDataLowering &) = delete; |
619 | 580 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 virtual void lower() {} | 616 virtual void lower() {} |
656 | 617 |
657 protected: | 618 protected: |
658 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {} | 619 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {} |
659 GlobalContext *Ctx; | 620 GlobalContext *Ctx; |
660 }; | 621 }; |
661 | 622 |
662 } // end of namespace Ice | 623 } // end of namespace Ice |
663 | 624 |
664 #endif // SUBZERO_SRC_ICETARGETLOWERING_H | 625 #endif // SUBZERO_SRC_ICETARGETLOWERING_H |
OLD | NEW |