# HG changeset patch # User Josef Eisl # Date 1431347776 -7200 # Node ID 951ecb5473c379a7fe90a654c4b49653da703217 # Parent 90a951b20daf8161a6b69a07b6b630ac11bc4d58 LIRKind: add verifyMoveKinds. diff -r 90a951b20daf -r 951ecb5473c3 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 Tue May 12 09:31:56 2015 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LIRKind.java Mon May 11 14:36:16 2015 +0200 @@ -277,4 +277,21 @@ LIRKind other = (LIRKind) obj; return platformKind == other.platformKind && referenceMask == other.referenceMask; } + + public static boolean verifyMoveKinds(LIRKind dst, LIRKind src) { + if (src.equals(dst)) { + return true; + } + if (toStackKind(src.getPlatformKind()).equals(dst.getPlatformKind())) { + return !src.isDerivedReference() || dst.isDerivedReference(); + } + return false; + } + + private static PlatformKind toStackKind(PlatformKind platformKind) { + if (platformKind instanceof Kind) { + return ((Kind) platformKind).getStackKind(); + } + return platformKind; + } }