[vm/compiler] Remove EmitMoveConst

This function contains some questionable and possibly buggy code.

Instead of fixing it we simply delete it because it is currently never
called and thus any fixes to this function can't really be tested
except in isolation.

TEST=ffi suite on CI.

Change-Id: Ifdc7fcb1e9bf9cfa19e0831132b52798a9da3eab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227741
Auto-Submit: Slava Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler.cc b/runtime/vm/compiler/backend/flow_graph_compiler.cc
index a6d5418..aa1d703 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler.cc
@@ -3572,60 +3572,6 @@
   }
 }
 
-void FlowGraphCompiler::EmitMoveConst(const compiler::ffi::NativeLocation& dst,
-                                      Location src,
-                                      Representation src_type,
-                                      TemporaryRegisterAllocator* temp) {
-  ASSERT(src.IsConstant());
-  const auto& dst_type = dst.payload_type();
-  if (dst.IsExpressibleAsLocation() &&
-      dst_type.IsExpressibleAsRepresentation() &&
-      dst_type.AsRepresentationOverApprox(zone_) == src_type) {
-    // We can directly emit the const in the right place and representation.
-    const Location dst_loc = dst.AsLocation();
-    EmitMove(dst_loc, src, temp);
-  } else {
-    // We need an intermediate location.
-    Location intermediate;
-    if (dst_type.IsInt()) {
-      if (TMP == kNoRegister) {
-        Register scratch = temp->AllocateTemporary();
-        Location::RegisterLocation(scratch);
-      } else {
-        intermediate = Location::RegisterLocation(TMP);
-      }
-    } else {
-      ASSERT(dst_type.IsFloat());
-      intermediate = Location::FpuRegisterLocation(FpuTMP);
-    }
-
-    if (src.IsPairLocation()) {
-      for (intptr_t i : {0, 1}) {
-        const Representation src_type_split =
-            compiler::ffi::NativeType::FromUnboxedRepresentation(zone_,
-                                                                 src_type)
-                .Split(zone_, i)
-                .AsRepresentation();
-        const auto& intermediate_native =
-            compiler::ffi::NativeLocation::FromLocation(zone_, intermediate,
-                                                        src_type_split);
-        EmitMove(intermediate, src.AsPairLocation()->At(i), temp);
-        EmitNativeMove(dst.Split(zone_, 2, i), intermediate_native, temp);
-      }
-    } else {
-      const auto& intermediate_native =
-          compiler::ffi::NativeLocation::FromLocation(zone_, intermediate,
-                                                      src_type);
-      EmitMove(intermediate, src, temp);
-      EmitNativeMove(dst, intermediate_native, temp);
-    }
-
-    if (dst_type.IsInt() && TMP == kNoRegister) {
-      temp->ReleaseTemporary();
-    }
-  }
-  return;
-}
 
 // The assignment to loading units here must match that in
 // AssignLoadingUnitsCodeVisitor, which runs after compilation is done.
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler.h b/runtime/vm/compiler/backend/flow_graph_compiler.h
index 975e431..f53e11f 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler.h
+++ b/runtime/vm/compiler/backend/flow_graph_compiler.h
@@ -613,12 +613,6 @@
                           const compiler::ffi::NativeLocation& src,
                           TemporaryRegisterAllocator* temp);
 
-  // Emits a Dart const to a native location.
-  void EmitMoveConst(const compiler::ffi::NativeLocation& dst,
-                     Location src,
-                     Representation src_type,
-                     TemporaryRegisterAllocator* temp);
-
   bool CheckAssertAssignableTypeTestingABILocations(
       const LocationSummary& locs);
 
diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc
index 878bcec..02daa82 100644
--- a/runtime/vm/compiler/backend/il.cc
+++ b/runtime/vm/compiler/backend/il.cc
@@ -6504,7 +6504,10 @@
 
       ConstantTemporaryAllocator temp_alloc(temp);
       if (origin.IsConstant()) {
-        compiler->EmitMoveConst(def_target, origin, origin_rep, &temp_alloc);
+        // Can't occur because we currently don't inline FFI trampolines (see
+        // http://dartbug.com/45055), which means all incomming arguments
+        // originate from parameters and thus are non-constant.
+        UNREACHABLE();
       } else {
         compiler->EmitMoveToNative(def_target, origin, origin_rep, &temp_alloc);
       }
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index cb4dcdf..4ed246d 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -8173,9 +8173,11 @@
   // being inlined (for now).
   if (ForceOptimize()) {
     if (IsFfiTrampoline()) {
-      // The CallSiteInliner::InlineCall asserts in PrepareGraphs that
-      // GraphEntryInstr::SuccessorCount() == 1, but FFI trampoline has two
-      // entries (a normal and a catch entry).
+      // We currently don't support inlining FFI trampolines. Some of them
+      // are naturally non-inlinable because they contain a try/catch block,
+      // but this condition is broader than strictly necessary.
+      // The work necessary for inlining FFI trampolines is tracked by
+      // http://dartbug.com/45055.
       return false;
     }
     return CompilerState::Current().is_aot();