Mercurial > hg > graal-compiler
changeset 21444:0ad4c6aa8063
LIRKind: add merge(Iterable<LIRKind>).
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Thu, 21 May 2015 11:50:38 +0200 |
parents | 4563ed9308c0 |
children | 567fd5394b80 |
files | graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LIRKind.java |
diffstat | 1 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LIRKind.java Mon May 18 15:38:22 2015 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LIRKind.java Thu May 21 11:50:38 2015 +0200 @@ -22,6 +22,8 @@ */ package com.oracle.graal.api.meta; +import java.util.*; + /** * Represents the type of values in the LIR. It is composed of a {@link PlatformKind} that gives the * low level representation of the value, and a {@link #referenceMask} that describes the location @@ -133,10 +135,20 @@ */ public static LIRKind merge(Value... inputs) { assert inputs.length > 0; + ArrayList<LIRKind> kinds = new ArrayList<>(inputs.length); + for (int i = 0; i < inputs.length; i++) { + kinds.add(inputs[i].getLIRKind()); + } + return merge(kinds); + } + + /** + * @see #merge(Value...) + */ + public static LIRKind merge(Iterable<LIRKind> kinds) { LIRKind mergeKind = null; - for (Value input : inputs) { - LIRKind kind = input.getLIRKind(); + for (LIRKind kind : kinds) { assert mergeKind == null || verifyMoveKinds(mergeKind, kind) : String.format("Input kinds do not match %s vs. %s", mergeKind, kind); @@ -173,6 +185,7 @@ } } + assert mergeKind != null; // all inputs are values or references, just return one of them return mergeKind;