annotate graal/com.oracle.graal.amd64/src/com/oracle/graal/amd64/AMD64.java @ 9426:0f8683ac4009

Use register categories to determine spill slot size.
author Roland Schatz <roland.schatz@oracle.com>
date Tue, 30 Apr 2013 12:14:31 +0200
parents 3ec29630cfb4
children 334b014a70a3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
6580
d56d600819fe moved AMD64 into its own (new) project: com.oracle.graal.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6531
diff changeset
23 package com.oracle.graal.amd64;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
6498
6bc8aa568cb9 moved MemoryBarriers to com.oracle.graal.api.code
Doug Simon <doug.simon@oracle.com>
parents: 6497
diff changeset
25 import static com.oracle.graal.api.code.MemoryBarriers.*;
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
26 import static com.oracle.graal.api.code.Register.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
27
7700
627c284671b7 Use java.nio.ByteOrder instead of our own ByteOrder enumeration
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7514
diff changeset
28 import java.nio.*;
627c284671b7 Use java.nio.ByteOrder instead of our own ByteOrder enumeration
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7514
diff changeset
29
5510
426c605c9d3c Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
30 import com.oracle.graal.api.code.*;
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
31 import com.oracle.graal.api.code.Register.RegisterCategory;
9189
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
32 import com.oracle.graal.api.meta.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
34 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
35 * Represents the AMD64 architecture.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
36 */
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
37 public class AMD64 extends Architecture {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
38
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
39 public static final RegisterCategory CPU = new RegisterCategory("CPU");
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
40 public static final RegisterCategory XMM = new RegisterCategory("XMM");
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
41
7514
6bf569d50989 disabled auto-formatting of some code sections that use manual alignment
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
42 // @formatter:off
6bf569d50989 disabled auto-formatting of some code sections that use manual alignment
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
43
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
44 // General purpose CPU registers
9426
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
45 public static final Register rax = new Register(0, 0, "rax", CPU);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
46 public static final Register rcx = new Register(1, 1, "rcx", CPU);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
47 public static final Register rdx = new Register(2, 2, "rdx", CPU);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
48 public static final Register rbx = new Register(3, 3, "rbx", CPU);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
49 public static final Register rsp = new Register(4, 4, "rsp", CPU);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
50 public static final Register rbp = new Register(5, 5, "rbp", CPU);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
51 public static final Register rsi = new Register(6, 6, "rsi", CPU);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
52 public static final Register rdi = new Register(7, 7, "rdi", CPU);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
53
9426
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
54 public static final Register r8 = new Register(8, 8, "r8", CPU);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
55 public static final Register r9 = new Register(9, 9, "r9", CPU);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
56 public static final Register r10 = new Register(10, 10, "r10", CPU);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
57 public static final Register r11 = new Register(11, 11, "r11", CPU);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
58 public static final Register r12 = new Register(12, 12, "r12", CPU);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
59 public static final Register r13 = new Register(13, 13, "r13", CPU);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
60 public static final Register r14 = new Register(14, 14, "r14", CPU);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
61 public static final Register r15 = new Register(15, 15, "r15", CPU);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
63 public static final Register[] cpuRegisters = {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
64 rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
65 r8, r9, r10, r11, r12, r13, r14, r15
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
66 };
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
67
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
68 // XMM registers
9426
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
69 public static final Register xmm0 = new Register(16, 0, "xmm0", XMM);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
70 public static final Register xmm1 = new Register(17, 1, "xmm1", XMM);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
71 public static final Register xmm2 = new Register(18, 2, "xmm2", XMM);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
72 public static final Register xmm3 = new Register(19, 3, "xmm3", XMM);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
73 public static final Register xmm4 = new Register(20, 4, "xmm4", XMM);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
74 public static final Register xmm5 = new Register(21, 5, "xmm5", XMM);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
75 public static final Register xmm6 = new Register(22, 6, "xmm6", XMM);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
76 public static final Register xmm7 = new Register(23, 7, "xmm7", XMM);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
77
9426
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
78 public static final Register xmm8 = new Register(24, 8, "xmm8", XMM);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
79 public static final Register xmm9 = new Register(25, 9, "xmm9", XMM);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
80 public static final Register xmm10 = new Register(26, 10, "xmm10", XMM);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
81 public static final Register xmm11 = new Register(27, 11, "xmm11", XMM);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
82 public static final Register xmm12 = new Register(28, 12, "xmm12", XMM);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
83 public static final Register xmm13 = new Register(29, 13, "xmm13", XMM);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
84 public static final Register xmm14 = new Register(30, 14, "xmm14", XMM);
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
85 public static final Register xmm15 = new Register(31, 15, "xmm15", XMM);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
86
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
87 public static final Register[] xmmRegisters = {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
88 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
89 xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
90 };
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
91
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
92 public static final Register[] cpuxmmRegisters = {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
93 rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
94 r8, r9, r10, r11, r12, r13, r14, r15,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
95 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
96 xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
97 };
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
98
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
99 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
100 * Register used to construct an instruction-relative address.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
101 */
9426
0f8683ac4009 Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
102 public static final Register rip = new Register(32, -1, "rip", SPECIAL);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
103
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
104 public static final Register[] allRegisters = {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
105 rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
106 r8, r9, r10, r11, r12, r13, r14, r15,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
107 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
108 xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
109 rip
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
110 };
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
111
9190
50d87c79f831 Better names for useSSE and useAVX variables.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
112 private final int supportedSSEVersion;
50d87c79f831 Better names for useSSE and useAVX variables.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
113 private final int supportedAVXVersion;
9189
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
114
9190
50d87c79f831 Better names for useSSE and useAVX variables.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
115 public AMD64(int supportedSSEVersion, int supportedAVXVersion) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
116 super("AMD64",
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
117 8,
7700
627c284671b7 Use java.nio.ByteOrder instead of our own ByteOrder enumeration
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7514
diff changeset
118 ByteOrder.LITTLE_ENDIAN,
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
119 allRegisters,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
120 LOAD_STORE | STORE_STORE,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
121 1,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
122 r15.encoding + 1,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
123 8);
9190
50d87c79f831 Better names for useSSE and useAVX variables.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
124 assert supportedSSEVersion >= 2;
50d87c79f831 Better names for useSSE and useAVX variables.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
125 this.supportedSSEVersion = supportedSSEVersion;
50d87c79f831 Better names for useSSE and useAVX variables.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
126 this.supportedAVXVersion = supportedAVXVersion;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
127 }
7514
6bf569d50989 disabled auto-formatting of some code sections that use manual alignment
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
128 // @formatter:on
9189
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
129
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
130 @Override
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
131 public int getMaxVectorLength(Kind kind) {
9190
50d87c79f831 Better names for useSSE and useAVX variables.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
132 if (supportedAVXVersion > 0) {
9189
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
133 switch (kind) {
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
134 case Boolean:
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
135 return 32;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
136 case Byte:
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
137 return 32;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
138 case Short:
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
139 return 16;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
140 case Char:
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
141 return 16;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
142 case Int:
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
143 return 8;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
144 case Float:
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
145 return 8;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
146 case Long:
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
147 return 4;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
148 case Double:
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
149 return 4;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
150 case Object:
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
151 return 4;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
152 }
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
153 } else {
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
154 switch (kind) {
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
155 case Boolean:
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
156 return 16;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
157 case Byte:
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
158 return 16;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
159 case Short:
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
160 return 8;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
161 case Char:
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
162 return 8;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
163 case Int:
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
164 return 4;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
165 case Float:
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
166 return 4;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
167 case Long:
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
168 return 2;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
169 case Double:
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
170 return 2;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
171 case Object:
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
172 return 2;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
173 }
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
174 }
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
175 return 1;
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
176 }
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
177
9190
50d87c79f831 Better names for useSSE and useAVX variables.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
178 public int getSupportedSSEVersion() {
50d87c79f831 Better names for useSSE and useAVX variables.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
179 return supportedSSEVersion;
9189
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
180 }
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
181
9190
50d87c79f831 Better names for useSSE and useAVX variables.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
182 public int getSupportedAVXVersion() {
50d87c79f831 Better names for useSSE and useAVX variables.
Roland Schatz <roland.schatz@oracle.com>
parents: 9189
diff changeset
183 return supportedAVXVersion;
9189
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 8167
diff changeset
184 }
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
185
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
186 @Override
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
187 public boolean canStoreValue(RegisterCategory category, PlatformKind platformKind) {
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
188 if (!(platformKind instanceof Kind)) {
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
189 return false;
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
190 }
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
191
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
192 Kind kind = (Kind) platformKind;
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
193 if (category == CPU) {
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
194 switch (kind) {
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
195 case Boolean:
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
196 case Byte:
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
197 case Char:
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
198 case Short:
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
199 case Int:
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
200 case Long:
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
201 case Object:
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
202 return true;
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
203 }
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
204 } else if (category == XMM) {
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
205 switch (kind) {
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
206 case Float:
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
207 case Double:
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
208 return true;
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
209 }
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
210 }
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
211
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
212 return false;
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
213 }
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
214
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
215 @Override
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
216 public PlatformKind getLargestStorableKind(RegisterCategory category) {
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
217 if (category == CPU) {
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
218 return Kind.Long;
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
219 } else if (category == XMM) {
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
220 return Kind.Double;
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
221 } else {
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
222 return Kind.Illegal;
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
223 }
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9190
diff changeset
224 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
225 }