summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes_x86.h
diff options
context:
space:
mode:
author Mark Mendell <mark.p.mendell@intel.com> 2015-09-18 14:10:29 -0400
committer Mark Mendell <mark.p.mendell@intel.com> 2015-10-14 09:54:31 -0400
commit805b3b56c6eb542298db33e0181f135dc9fed3d9 (patch)
tree664d3ca2039805aa326c9e5e02dfae703ba7e634 /compiler/optimizing/nodes_x86.h
parentdf3456007702b0dea01ffd1adfa74244857712af (diff)
X86 jump tables for PackedSwitch
Implement X86PackedSwitch using a jump table of offsets to blocks. The X86PackedSwitch version just adds an input to address the constant area. Change-Id: Id2752a1ee79222493040c6fd0e59aee9a544b76a Bug: 21119474 Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
Diffstat (limited to 'compiler/optimizing/nodes_x86.h')
-rw-r--r--compiler/optimizing/nodes_x86.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/compiler/optimizing/nodes_x86.h b/compiler/optimizing/nodes_x86.h
index f7cc872419..556217bf74 100644
--- a/compiler/optimizing/nodes_x86.h
+++ b/compiler/optimizing/nodes_x86.h
@@ -62,6 +62,45 @@ class HX86LoadFromConstantTable : public HExpression<2> {
DISALLOW_COPY_AND_ASSIGN(HX86LoadFromConstantTable);
};
+// X86 version of HPackedSwitch that holds a pointer to the base method address.
+class HX86PackedSwitch : public HTemplateInstruction<2> {
+ public:
+ HX86PackedSwitch(int32_t start_value,
+ int32_t num_entries,
+ HInstruction* input,
+ HX86ComputeBaseMethodAddress* method_base,
+ uint32_t dex_pc)
+ : HTemplateInstruction(SideEffects::None(), dex_pc),
+ start_value_(start_value),
+ num_entries_(num_entries) {
+ SetRawInputAt(0, input);
+ SetRawInputAt(1, method_base);
+ }
+
+ bool IsControlFlow() const OVERRIDE { return true; }
+
+ int32_t GetStartValue() const { return start_value_; }
+
+ int32_t GetNumEntries() const { return num_entries_; }
+
+ HX86ComputeBaseMethodAddress* GetBaseMethodAddress() const {
+ return InputAt(1)->AsX86ComputeBaseMethodAddress();
+ }
+
+ HBasicBlock* GetDefaultBlock() const {
+ // Last entry is the default block.
+ return GetBlock()->GetSuccessors()[num_entries_];
+ }
+
+ DECLARE_INSTRUCTION(X86PackedSwitch);
+
+ private:
+ const int32_t start_value_;
+ const int32_t num_entries_;
+
+ DISALLOW_COPY_AND_ASSIGN(HX86PackedSwitch);
+};
+
} // namespace art
#endif // ART_COMPILER_OPTIMIZING_NODES_X86_H_