Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java @ 9188:fb676e23ba51
Rename BasicConfiguration to BasicCompilerConfiguration.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Thu, 18 Apr 2013 13:16:39 +0200 |
parents | e178e4598f85 |
children | 3df022b2eebe |
rev | line source |
---|---|
9001 | 1 /* |
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
9122
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
23 package com.oracle.graal.phases.tiers; |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
24 |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
25 import java.util.*; |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
26 |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
27 import com.oracle.graal.graph.*; |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
28 import com.oracle.graal.phases.*; |
9001 | 29 |
9122
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
30 public final class Suites { |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
31 |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
32 public static final Suites DEFAULT; |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
33 |
9142
e178e4598f85
Remove public fields.
Roland Schatz <roland.schatz@oracle.com>
parents:
9137
diff
changeset
|
34 private final PhaseSuite<HighTierContext> highTier; |
e178e4598f85
Remove public fields.
Roland Schatz <roland.schatz@oracle.com>
parents:
9137
diff
changeset
|
35 private final PhaseSuite<MidTierContext> midTier; |
e178e4598f85
Remove public fields.
Roland Schatz <roland.schatz@oracle.com>
parents:
9137
diff
changeset
|
36 |
9122
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
37 private static final Map<String, CompilerConfiguration> configurations; |
9001 | 38 |
9142
e178e4598f85
Remove public fields.
Roland Schatz <roland.schatz@oracle.com>
parents:
9137
diff
changeset
|
39 public PhaseSuite<HighTierContext> getHighTier() { |
e178e4598f85
Remove public fields.
Roland Schatz <roland.schatz@oracle.com>
parents:
9137
diff
changeset
|
40 return highTier; |
e178e4598f85
Remove public fields.
Roland Schatz <roland.schatz@oracle.com>
parents:
9137
diff
changeset
|
41 } |
e178e4598f85
Remove public fields.
Roland Schatz <roland.schatz@oracle.com>
parents:
9137
diff
changeset
|
42 |
e178e4598f85
Remove public fields.
Roland Schatz <roland.schatz@oracle.com>
parents:
9137
diff
changeset
|
43 public PhaseSuite<MidTierContext> getMidTier() { |
e178e4598f85
Remove public fields.
Roland Schatz <roland.schatz@oracle.com>
parents:
9137
diff
changeset
|
44 return midTier; |
e178e4598f85
Remove public fields.
Roland Schatz <roland.schatz@oracle.com>
parents:
9137
diff
changeset
|
45 } |
e178e4598f85
Remove public fields.
Roland Schatz <roland.schatz@oracle.com>
parents:
9137
diff
changeset
|
46 |
9122
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
47 static { |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
48 configurations = new HashMap<>(); |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
49 for (CompilerConfiguration config : ServiceLoader.loadInstalled(CompilerConfiguration.class)) { |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
50 String name = config.getClass().getSimpleName(); |
9188
fb676e23ba51
Rename BasicConfiguration to BasicCompilerConfiguration.
Roland Schatz <roland.schatz@oracle.com>
parents:
9142
diff
changeset
|
51 if (name.endsWith("CompilerConfiguration")) { |
fb676e23ba51
Rename BasicConfiguration to BasicCompilerConfiguration.
Roland Schatz <roland.schatz@oracle.com>
parents:
9142
diff
changeset
|
52 name = name.substring(0, name.length() - "CompilerConfiguration".length()); |
9122
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
53 } |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
54 configurations.put(name.toLowerCase(), config); |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
55 } |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
56 |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
57 DEFAULT = createDefaultSuites(); |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
58 } |
9001 | 59 |
9122
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
60 private Suites(CompilerConfiguration config) { |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
61 highTier = config.createHighTier(); |
9137
f5c6a9b0262f
MidTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
9122
diff
changeset
|
62 midTier = config.createMidTier(); |
9122
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
63 } |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
64 |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
65 public static Suites createDefaultSuites() { |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
66 return createSuites(GraalOptions.CompilerConfiguration); |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
67 } |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
68 |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
69 public static Suites createSuites(String name) { |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
70 CompilerConfiguration config = configurations.get(name); |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
71 if (config == null) { |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
72 throw new GraalInternalError("unknown compiler configuration: " + name); |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
73 } |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
74 return new Suites(config); |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
75 } |
dedfff70763f
Compiler configurations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9121
diff
changeset
|
76 |
9001 | 77 } |