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

Side by Side Diff: src/IceTargetLoweringX8632Traits.h

Issue 1548363002: Subzero. Code organization. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: 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
OLDNEW
1 //===- subzero/src/IceTargetLoweringX8632Traits.h - x86-32 traits -*- C++ -*-=// 1 //===- subzero/src/IceTargetLoweringX8632Traits.h - x86-32 traits -*- 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 12 matching lines...) Expand all
23 #include "IceOperand.h" 23 #include "IceOperand.h"
24 #include "IceRegistersX8632.h" 24 #include "IceRegistersX8632.h"
25 #include "IceTargetLowering.h" 25 #include "IceTargetLowering.h"
26 #include "IceTargetLoweringX8632.def" 26 #include "IceTargetLoweringX8632.def"
27 #include "IceTargetLoweringX86RegClass.h" 27 #include "IceTargetLoweringX86RegClass.h"
28 28
29 #include <array> 29 #include <array>
30 30
31 namespace Ice { 31 namespace Ice {
32 32
33 namespace X8632 {
34 using namespace ::Ice::X86;
35
36 template <class Machine> struct Insts;
37 template <class Machine> class TargetX86Base;
38 template <class Machine> class AssemblerX86Base;
39
33 class TargetX8632; 40 class TargetX8632;
34 41
35 namespace X8632 { 42 struct TargetX8632Traits {
36 class AssemblerX8632;
37 } // end of namespace X8632
38
39 namespace X86Internal {
40
41 template <class Machine> struct Insts;
42 template <class Machine> struct MachineTraits;
43 template <class Machine> class TargetX86Base;
44
45 template <> struct MachineTraits<TargetX8632> {
46 //---------------------------------------------------------------------------- 43 //----------------------------------------------------------------------------
47 // ______ ______ __ __ 44 // ______ ______ __ __
48 // /\ __ \/\ ___\/\ "-./ \ 45 // /\ __ \/\ ___\/\ "-./ \
49 // \ \ __ \ \___ \ \ \-./\ \ 46 // \ \ __ \ \___ \ \ \-./\ \
50 // \ \_\ \_\/\_____\ \_\ \ \_\ 47 // \ \_\ \_\/\_____\ \_\ \ \_\
51 // \/_/\/_/\/_____/\/_/ \/_/ 48 // \/_/\/_/\/_____/\/_/ \/_/
52 // 49 //
53 //---------------------------------------------------------------------------- 50 //----------------------------------------------------------------------------
51 static constexpr ::Ice::Assembler::AssemblerKind AsmKind =
52 ::Ice::Assembler::Asm_X8632;
53
54 static constexpr bool Is64Bit = false; 54 static constexpr bool Is64Bit = false;
55 static constexpr bool HasPopa = true; 55 static constexpr bool HasPopa = true;
56 static constexpr bool HasPusha = true; 56 static constexpr bool HasPusha = true;
57 static constexpr bool UsesX87 = true; 57 static constexpr bool UsesX87 = true;
58 static constexpr ::Ice::RegX8632::GPRRegister Last8BitGPR = 58 static constexpr ::Ice::RegX8632::GPRRegister Last8BitGPR =
59 ::Ice::RegX8632::GPRRegister::Encoded_Reg_ebx; 59 ::Ice::RegX8632::GPRRegister::Encoded_Reg_ebx;
60 60
61 enum ScaleFactor { TIMES_1 = 0, TIMES_2 = 1, TIMES_4 = 2, TIMES_8 = 3 }; 61 enum ScaleFactor { TIMES_1 = 0, TIMES_2 = 1, TIMES_4 = 2, TIMES_8 = 3 };
62 62
63 using GPRRegister = ::Ice::RegX8632::GPRRegister; 63 using GPRRegister = ::Ice::RegX8632::GPRRegister;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 /// Returns whether or not this operand is really the given register in 165 /// Returns whether or not this operand is really the given register in
166 /// disguise. Used from the assembler to generate better encodings. 166 /// disguise. Used from the assembler to generate better encodings.
167 bool IsRegister(GPRRegister reg) const { 167 bool IsRegister(GPRRegister reg) const {
168 return ((encoding_[0] & 0xF8) == 168 return ((encoding_[0] & 0xF8) ==
169 0xC0) // Addressing mode is register only. 169 0xC0) // Addressing mode is register only.
170 && 170 &&
171 ((encoding_[0] & 0x07) == reg); // Register codes match. 171 ((encoding_[0] & 0x07) == reg); // Register codes match.
172 } 172 }
173 173
174 template <class> friend class AssemblerX86Base; 174 friend class AssemblerX86Base<TargetX8632Traits>;
175 }; 175 };
176 176
177 class Address : public Operand { 177 class Address : public Operand {
178 Address() = delete; 178 Address() = delete;
179 179
180 public: 180 public:
181 Address(const Address &other) : Operand(other) {} 181 Address(const Address &other) : Operand(other) {}
182 182
183 Address &operator=(const Address &other) { 183 Address &operator=(const Address &other) {
184 Operand::operator=(other); 184 Operand::operator=(other);
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 static const size_t TableTypeX8632AttributesSize; 745 static const size_t TableTypeX8632AttributesSize;
746 746
747 //---------------------------------------------------------------------------- 747 //----------------------------------------------------------------------------
748 // __ __ __ ______ ______ 748 // __ __ __ ______ ______
749 // /\ \/\ "-.\ \/\ ___\/\__ _\ 749 // /\ \/\ "-.\ \/\ ___\/\__ _\
750 // \ \ \ \ \-. \ \___ \/_/\ \/ 750 // \ \ \ \ \-. \ \___ \/_/\ \/
751 // \ \_\ \_\\"\_\/\_____\ \ \_\ 751 // \ \_\ \_\\"\_\/\_____\ \ \_\
752 // \/_/\/_/ \/_/\/_____/ \/_/ 752 // \/_/\/_/ \/_/\/_____/ \/_/
753 // 753 //
754 //---------------------------------------------------------------------------- 754 //----------------------------------------------------------------------------
755 using Insts = ::Ice::X86Internal::Insts<TargetX8632>; 755 using Traits = TargetX8632Traits;
756 using Insts = ::Ice::X8632::Insts<Traits>;
756 757
757 using TargetLowering = ::Ice::X86Internal::TargetX86Base<TargetX8632>; 758 using TargetLowering = ::Ice::X8632::TargetX86Base<Traits>;
758 using Assembler = X8632::AssemblerX8632; 759 using ConcreteTarget = ::Ice::X8632::TargetX8632;
760 using Assembler = ::Ice::X8632::AssemblerX86Base<Traits>;
759 761
760 /// X86Operand extends the Operand hierarchy. Its subclasses are X86OperandMem 762 /// X86Operand extends the Operand hierarchy. Its subclasses are X86OperandMem
761 /// and VariableSplit. 763 /// and VariableSplit.
762 class X86Operand : public ::Ice::Operand { 764 class X86Operand : public ::Ice::Operand {
763 X86Operand() = delete; 765 X86Operand() = delete;
764 X86Operand(const X86Operand &) = delete; 766 X86Operand(const X86Operand &) = delete;
765 X86Operand &operator=(const X86Operand &) = delete; 767 X86Operand &operator=(const X86Operand &) = delete;
766 768
767 public: 769 public:
768 enum OperandKindX8632 { k__Start = ::Ice::Operand::kTarget, kMem, kSplit }; 770 enum OperandKindX8632 { k__Start = ::Ice::Operand::kTarget, kMem, kSplit };
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 const char *PackString; // b, w, d, or <blank> 927 const char *PackString; // b, w, d, or <blank>
926 const char *WidthString; // b, w, l, q, or <blank> 928 const char *WidthString; // b, w, l, q, or <blank>
927 const char *FldString; // s, l, or <blank> 929 const char *FldString; // s, l, or <blank>
928 } TypeAttributes[]; 930 } TypeAttributes[];
929 931
930 static const char *InstSegmentRegNames[]; 932 static const char *InstSegmentRegNames[];
931 933
932 static uint8_t InstSegmentPrefixes[]; 934 static uint8_t InstSegmentPrefixes[];
933 }; 935 };
934 936
935 } // end of namespace X86Internal 937 using Traits = ::Ice::X8632::TargetX8632Traits;
936
937 namespace X8632 {
938 using Traits = ::Ice::X86Internal::MachineTraits<TargetX8632>;
939 } // end of namespace X8632 938 } // end of namespace X8632
940 939
941 } // end of namespace Ice 940 } // end of namespace Ice
942 941
943 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632TRAITS_H 942 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632TRAITS_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698