Index: src/compiler/machine-operator.h |
diff --git a/src/compiler/machine-operator.h b/src/compiler/machine-operator.h |
index 568d3eb2b89acc163584aea605375772ccfed1f0..eff2d9fe12ac3c01bdef7b53fdc3caa6001f271a 100644 |
--- a/src/compiler/machine-operator.h |
+++ b/src/compiler/machine-operator.h |
@@ -5,6 +5,7 @@ |
#ifndef V8_COMPILER_MACHINE_OPERATOR_H_ |
#define V8_COMPILER_MACHINE_OPERATOR_H_ |
+#include "src/base/flags.h" |
#include "src/compiler/machine-type.h" |
namespace v8 { |
@@ -51,13 +52,24 @@ std::ostream& operator<<(std::ostream&, StoreRepresentation); |
StoreRepresentation const& StoreRepresentationOf(Operator const*); |
- |
// Interface for building machine-level operators. These operators are |
// machine-level but machine-independent and thus define a language suitable |
// for generating code to run on architectures such as ia32, x64, arm, etc. |
class MachineOperatorBuilder FINAL { |
public: |
- explicit MachineOperatorBuilder(MachineType word = kMachPtr); |
+ // Flags that specify which operations are available. This is useful |
+ // for operations that are unsupported by some back-ends. |
+ enum Flag : unsigned int { |
Benedikt Meurer
2014/10/23 11:04:57
enum class Flag : unsigned {...}
sigurds
2014/10/23 11:15:56
Done. Had to intro a static_cast in flags.h.
|
+ kNoFlags = 0, |
+ kFloat64Floor = 1 << 0, |
+ kFloat64Ceil = 1 << 1, |
+ kFloat64Truncate = 1 << 2, |
+ kFloat64RoundTiesAway = 1 << 3 |
+ }; |
+ typedef base::Flags<Flag, unsigned int> Flags; |
Benedikt Meurer
2014/10/23 11:04:57
s,unsigned int,unsigned,
sigurds
2014/10/23 11:15:56
Done.
|
+ |
+ explicit MachineOperatorBuilder(MachineType word = kMachPtr, |
+ Flags supportedOperators = kNoFlags); |
const Operator* Word32And(); |
const Operator* Word32Or(); |
@@ -135,6 +147,16 @@ class MachineOperatorBuilder FINAL { |
const Operator* Float64LessThan(); |
const Operator* Float64LessThanOrEqual(); |
+ // Floating point rounding. |
+ const Operator* Float64Floor(); |
+ const Operator* Float64Ceil(); |
+ const Operator* Float64RoundTruncate(); |
+ const Operator* Float64RoundTiesAway(); |
+ bool HasFloat64Floor() { return flags_ & kFloat64Floor; } |
+ bool HasFloat64Ceil() { return flags_ & kFloat64Ceil; } |
+ bool HasFloat64RoundTruncate() { return flags_ & kFloat64Truncate; } |
+ bool HasFloat64RoundTiesAway() { return flags_ & kFloat64RoundTiesAway; } |
+ |
// load [base + index] |
const Operator* Load(LoadRepresentation rep); |
@@ -181,8 +203,11 @@ class MachineOperatorBuilder FINAL { |
private: |
const MachineOperatorBuilderImpl& impl_; |
const MachineType word_; |
+ const Flags flags_; |
}; |
+DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) |
+ |
} // namespace compiler |
} // namespace internal |
} // namespace v8 |