|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
|
2 * vim: set ts=8 sts=4 et sw=4 tw=99: |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #ifndef jit_x86_LIR_x86_h |
|
8 #define jit_x86_LIR_x86_h |
|
9 |
|
10 namespace js { |
|
11 namespace jit { |
|
12 |
|
13 class LBox : public LInstructionHelper<2, 1, 0> |
|
14 { |
|
15 MIRType type_; |
|
16 |
|
17 public: |
|
18 LIR_HEADER(Box); |
|
19 |
|
20 LBox(const LAllocation &in_payload, MIRType type) |
|
21 : type_(type) |
|
22 { |
|
23 setOperand(0, in_payload); |
|
24 } |
|
25 |
|
26 MIRType type() const { |
|
27 return type_; |
|
28 } |
|
29 const char *extraName() const { |
|
30 return StringFromMIRType(type_); |
|
31 } |
|
32 }; |
|
33 |
|
34 class LBoxFloatingPoint : public LInstructionHelper<2, 1, 1> |
|
35 { |
|
36 MIRType type_; |
|
37 |
|
38 public: |
|
39 LIR_HEADER(BoxFloatingPoint); |
|
40 |
|
41 LBoxFloatingPoint(const LAllocation &in, const LDefinition &temp, MIRType type) |
|
42 : type_(type) |
|
43 { |
|
44 JS_ASSERT(IsFloatingPointType(type)); |
|
45 setOperand(0, in); |
|
46 setTemp(0, temp); |
|
47 } |
|
48 |
|
49 MIRType type() const { |
|
50 return type_; |
|
51 } |
|
52 const char *extraName() const { |
|
53 return StringFromMIRType(type_); |
|
54 } |
|
55 }; |
|
56 |
|
57 class LUnbox : public LInstructionHelper<1, 2, 0> |
|
58 { |
|
59 public: |
|
60 LIR_HEADER(Unbox); |
|
61 |
|
62 MUnbox *mir() const { |
|
63 return mir_->toUnbox(); |
|
64 } |
|
65 const LAllocation *payload() { |
|
66 return getOperand(0); |
|
67 } |
|
68 const LAllocation *type() { |
|
69 return getOperand(1); |
|
70 } |
|
71 const char *extraName() const { |
|
72 return StringFromMIRType(mir()->type()); |
|
73 } |
|
74 }; |
|
75 |
|
76 class LUnboxFloatingPoint : public LInstructionHelper<1, 2, 0> |
|
77 { |
|
78 MIRType type_; |
|
79 |
|
80 public: |
|
81 LIR_HEADER(UnboxFloatingPoint); |
|
82 |
|
83 static const size_t Input = 0; |
|
84 |
|
85 LUnboxFloatingPoint(MIRType type) |
|
86 : type_(type) |
|
87 { } |
|
88 |
|
89 MUnbox *mir() const { |
|
90 return mir_->toUnbox(); |
|
91 } |
|
92 |
|
93 MIRType type() const { |
|
94 return type_; |
|
95 } |
|
96 const char *extraName() const { |
|
97 return StringFromMIRType(type_); |
|
98 } |
|
99 }; |
|
100 |
|
101 // Convert a 32-bit unsigned integer to a double. |
|
102 class LAsmJSUInt32ToDouble : public LInstructionHelper<1, 1, 1> |
|
103 { |
|
104 public: |
|
105 LIR_HEADER(AsmJSUInt32ToDouble) |
|
106 |
|
107 LAsmJSUInt32ToDouble(const LAllocation &input, const LDefinition &temp) { |
|
108 setOperand(0, input); |
|
109 setTemp(0, temp); |
|
110 } |
|
111 const LDefinition *temp() { |
|
112 return getTemp(0); |
|
113 } |
|
114 }; |
|
115 |
|
116 // Convert a 32-bit unsigned integer to a float32. |
|
117 class LAsmJSUInt32ToFloat32: public LInstructionHelper<1, 1, 1> |
|
118 { |
|
119 public: |
|
120 LIR_HEADER(AsmJSUInt32ToFloat32) |
|
121 |
|
122 LAsmJSUInt32ToFloat32(const LAllocation &input, const LDefinition &temp) { |
|
123 setOperand(0, input); |
|
124 setTemp(0, temp); |
|
125 } |
|
126 const LDefinition *temp() { |
|
127 return getTemp(0); |
|
128 } |
|
129 }; |
|
130 |
|
131 class LAsmJSLoadFuncPtr : public LInstructionHelper<1, 1, 0> |
|
132 { |
|
133 public: |
|
134 LIR_HEADER(AsmJSLoadFuncPtr); |
|
135 LAsmJSLoadFuncPtr(const LAllocation &index) { |
|
136 setOperand(0, index); |
|
137 } |
|
138 MAsmJSLoadFuncPtr *mir() const { |
|
139 return mir_->toAsmJSLoadFuncPtr(); |
|
140 } |
|
141 const LAllocation *index() { |
|
142 return getOperand(0); |
|
143 } |
|
144 }; |
|
145 |
|
146 } // namespace jit |
|
147 } // namespace js |
|
148 |
|
149 #endif /* jit_x86_LIR_x86_h */ |