# HG changeset patch # User Josef Eisl # Date 1432201838 -7200 # Node ID 0ad4c6aa80638901ef6864f921037564436651ba # Parent 4563ed9308c0d5b5f9a757689812eff74fe9a552 LIRKind: add merge(Iterable). diff -r 4563ed9308c0 -r 0ad4c6aa8063 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LIRKind.java --- 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 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 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;