[llvm-experiment] Resolve representation skew after rebase
diff --git a/llvm-codegen/src/llvm_codegen.cc b/llvm-codegen/src/llvm_codegen.cc
index 37cdf69..a877169 100644
--- a/llvm-codegen/src/llvm_codegen.cc
+++ b/llvm-codegen/src/llvm_codegen.cc
@@ -275,7 +275,7 @@
}
auto call = builder.CreateCall(GetFunctionByID(function_id), {forward_args});
call->setTailCallKind(llvm::CallInst::TailCallKind::TCK_Tail);
-
+
builder.CreateRet(call);
optional_param_trampoline_cache_.emplace(
@@ -1891,6 +1891,16 @@
return builder_.CreatePHI(phi_ty, num_income_values);
}
+const char* RepresentationName(Representation rep) {
+ switch (rep) {
+#define DEFINE_CASE(Name) case Representation::Name: return #Name;
+ REPRESENTATIONS_LIST(DEFINE_CASE)
+#undef DEFINE_CASE
+ default:
+ return "<?>";
+ }
+}
+
llvm::Value* CodegenFunction::EmitUnboxedConstant(InstructionInputExtractor I) {
auto representation = I.NextInputAsEnum<Representation>();
if (representation == Representation::kUnboxedInt32 ||
@@ -1898,6 +1908,7 @@
auto val = I.NextInputAsInt64();
return GetConstantInt(val);
} else {
+ std::cerr << "Unsupported representation: " << RepresentationName(representation) << std::endl;
// TODO(sarkin): Other representations
assert(false);
}
diff --git a/runtime/vm/compiler/backend/llvm_common_defs.h b/runtime/vm/compiler/backend/llvm_common_defs.h
index a3e9bfe..93ef00b 100644
--- a/runtime/vm/compiler/backend/llvm_common_defs.h
+++ b/runtime/vm/compiler/backend/llvm_common_defs.h
@@ -76,18 +76,25 @@
namespace dart_llvm {
+#define REPRESENTATIONS_LIST(V) \
+ V(kNoRepresentation) \
+ V(kTagged) \
+ V(kUntagged) \
+ V(kUnboxedDouble) \
+ V(kUnboxedFloat) \
+ V(kUnboxedInt32) \
+ V(kUnboxedUint32) \
+ V(kUnboxedInt64) \
+ V(kUnboxedFloat32x4) \
+ V(kUnboxedInt32x4) \
+ V(kUnboxedFloat64x2) \
+ V(kPairOfTagged) \
+
+
enum Representation {
- kNoRepresentation,
- kTagged,
- kUntagged,
- kUnboxedDouble,
- kUnboxedInt32,
- kUnboxedUint32,
- kUnboxedInt64,
- kUnboxedFloat32x4,
- kUnboxedInt32x4,
- kUnboxedFloat64x2,
- kPairOfTagged,
+#define DECLARE_REPRESENTATION(Name) Name,
+ REPRESENTATIONS_LIST(DECLARE_REPRESENTATION)
+#undef DECLARE_REPRESENTATION
kNumRepresentations
};