Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LowLevelPhase.java @ 19226:9c47b23fb0a2
LowLevelPhase: add support for custom name.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Mon, 09 Feb 2015 15:10:13 +0100 |
parents | edd93c34d015 |
children | 6340d851894b |
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LowLevelPhase.java Mon Feb 09 14:19:03 2015 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LowLevelPhase.java Mon Feb 09 15:10:13 2015 +0100 @@ -23,6 +23,7 @@ package com.oracle.graal.lir.phases; import java.util.*; +import java.util.regex.*; import com.oracle.graal.api.code.*; import com.oracle.graal.compiler.common.cfg.*; @@ -53,9 +54,23 @@ */ private final DebugMemUseTracker memUseTracker; + private static final Pattern NAME_PATTERN = Pattern.compile("[A-Z][A-Za-z0-9]+"); + + private static boolean checkName(String name) { + assert name == null || NAME_PATTERN.matcher(name).matches() : "illegal phase name: " + name; + return true; + } + public LowLevelPhase() { - timer = Debug.timer("LowLevelPhaseTime_%s", getName()); - memUseTracker = Debug.memUseTracker("LowLevelPhaseMemUse_%s", getName()); + timer = Debug.timer("LowLevelPhaseTime_%s", getClass()); + memUseTracker = Debug.memUseTracker("LowLevelPhaseMemUse_%s", getClass()); + } + + protected LowLevelPhase(String name) { + assert checkName(name); + this.name = name; + timer = Debug.timer("LowLevelPhaseTime_%s", getClass()); + memUseTracker = Debug.memUseTracker("LowLevelPhaseMemUse_%s", getClass()); } public final void apply(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, C context) {