6 #include <gtest/gtest.h>
13 #include <llvm/IR/DerivedTypes.h>
14 #include <llvm/IR/LLVMContext.h>
16 TEST(TypeConverterTests, LlvmIntegerTypeConversion)
21 llvm::LLVMContext context;
24 const auto i1 = ::llvm::IntegerType::get(context, 1);
25 const auto i2 = ::llvm::IntegerType::get(context, 2);
26 const auto i4 = ::llvm::IntegerType::get(context, 4);
27 const auto i8 = ::llvm::IntegerType::get(context, 8);
28 const auto i16 = ::llvm::IntegerType::get(context, 16);
29 const auto i32 = ::llvm::IntegerType::get(context, 32);
30 const auto i64 = ::llvm::IntegerType::get(context, 64);
33 const auto i1BitType =
34 std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(typeConverter.
ConvertLlvmType(*i1));
35 const auto i2BitType =
36 std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(typeConverter.
ConvertLlvmType(*i2));
37 const auto i4BitType =
38 std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(typeConverter.
ConvertLlvmType(*i4));
39 const auto i8BitType =
40 std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(typeConverter.
ConvertLlvmType(*i8));
41 const auto i16BitType =
42 std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(typeConverter.
ConvertLlvmType(*i16));
43 const auto i32BitType =
44 std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(typeConverter.
ConvertLlvmType(*i32));
45 const auto i64BitType =
46 std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(typeConverter.
ConvertLlvmType(*i64));
49 EXPECT_TRUE(i1BitType && i1BitType->nbits() == 1);
50 EXPECT_TRUE(i2BitType && i2BitType->nbits() == 2);
51 EXPECT_TRUE(i4BitType && i4BitType->nbits() == 4);
52 EXPECT_TRUE(i8BitType && i8BitType->nbits() == 8);
53 EXPECT_TRUE(i16BitType && i16BitType->nbits() == 16);
54 EXPECT_TRUE(i32BitType && i32BitType->nbits() == 32);
55 EXPECT_TRUE(i64BitType && i64BitType->nbits() == 64);
58 TEST(TypeConverterTests, LlvmPointerTypeConversion)
63 llvm::LLVMContext context;
66 const auto pointerTypeLlvm = ::llvm::PointerType::get(context, 0);
69 const auto pointerTypeJlm =
70 std::dynamic_pointer_cast<const PointerType>(typeConverter.
ConvertLlvmType(*pointerTypeLlvm));
73 EXPECT_NE(pointerTypeJlm,
nullptr);
76 TEST(TypeConverterTests, LlvmFunctionTypeConversion)
82 llvm::LLVMContext context;
85 const auto voidType = ::llvm::Type::getVoidTy(context);
86 auto i32Type = ::llvm::Type::getInt32Ty(context);
87 const auto functionType1Llvm = ::llvm::FunctionType::get(voidType, { i32Type, i32Type },
false);
88 const auto functionType2Llvm = ::llvm::FunctionType::get(i32Type, {},
false);
89 const auto functionType3Llvm = ::llvm::FunctionType::get(i32Type, { i32Type, i32Type },
true);
92 const auto functionType1Jlm = std::dynamic_pointer_cast<const FunctionType>(
94 const auto functionType2Jlm = std::dynamic_pointer_cast<const FunctionType>(
96 const auto functionType3Jlm = std::dynamic_pointer_cast<const FunctionType>(
100 EXPECT_NE(functionType1Jlm,
nullptr);
101 EXPECT_EQ(functionType1Jlm->NumArguments(), 4u);
102 EXPECT_EQ(functionType1Jlm->NumResults(), 2u);
103 auto arguments = functionType1Jlm->Arguments();
104 EXPECT_TRUE(is<BitType>(arguments[0]));
105 EXPECT_TRUE(is<BitType>(arguments[1]));
106 EXPECT_TRUE(is<IOStateType>(arguments[2]));
107 EXPECT_TRUE(is<MemoryStateType>(arguments[3]));
108 auto results = functionType1Jlm->Results();
109 EXPECT_TRUE(is<IOStateType>(results[0]));
110 EXPECT_TRUE(is<MemoryStateType>(results[1]));
112 EXPECT_NE(functionType2Jlm,
nullptr);
113 EXPECT_EQ(functionType2Jlm->NumArguments(), 2u);
114 EXPECT_EQ(functionType2Jlm->NumResults(), 3u);
115 arguments = functionType2Jlm->Arguments();
116 EXPECT_TRUE(is<IOStateType>(arguments[0]));
117 EXPECT_TRUE(is<MemoryStateType>(arguments[1]));
118 results = functionType2Jlm->Results();
119 EXPECT_TRUE(is<BitType>(results[0]));
120 EXPECT_TRUE(is<IOStateType>(results[1]));
121 EXPECT_TRUE(is<MemoryStateType>(results[2]));
123 EXPECT_NE(functionType3Jlm,
nullptr);
124 EXPECT_EQ(functionType3Jlm->NumArguments(), 5u);
125 EXPECT_EQ(functionType3Jlm->NumResults(), 3u);
126 arguments = functionType3Jlm->Arguments();
127 EXPECT_TRUE(is<BitType>(arguments[0]));
128 EXPECT_TRUE(is<BitType>(arguments[1]));
129 EXPECT_TRUE(is<VariableArgumentType>(arguments[2]));
130 EXPECT_TRUE(is<IOStateType>(arguments[3]));
131 EXPECT_TRUE(is<MemoryStateType>(arguments[4]));
132 results = functionType3Jlm->Results();
133 EXPECT_TRUE(is<BitType>(results[0]));
134 EXPECT_TRUE(is<IOStateType>(results[1]));
135 EXPECT_TRUE(is<MemoryStateType>(results[2]));
138 TEST(TypeConverterTests, LlvmFloatingPointTypeConversion)
143 llvm::LLVMContext context;
146 const auto halfTypeLlvm = ::llvm::Type::getHalfTy(context);
147 const auto floatTypeLlvm = ::llvm::Type::getFloatTy(context);
148 const auto doubleTypeLlvm = ::llvm::Type::getDoubleTy(context);
149 const auto x86fp80TypeLlvm = ::llvm::Type::getX86_FP80Ty(context);
150 const auto fp128TypeLlvm = ::llvm::Type::getFP128Ty(context);
153 const auto halfTypeJlm = std::dynamic_pointer_cast<const FloatingPointType>(
155 const auto floatTypeJlm = std::dynamic_pointer_cast<const FloatingPointType>(
157 const auto doubleTypeJlm = std::dynamic_pointer_cast<const FloatingPointType>(
159 const auto x86fp80TypeJlm = std::dynamic_pointer_cast<const FloatingPointType>(
161 const auto fp128TypeJlm = std::dynamic_pointer_cast<const FloatingPointType>(
165 EXPECT_TRUE(halfTypeJlm && halfTypeJlm->size() ==
fpsize::half);
166 EXPECT_TRUE(floatTypeJlm && floatTypeJlm->size() ==
fpsize::flt);
167 EXPECT_TRUE(doubleTypeJlm && doubleTypeJlm->size() ==
fpsize::dbl);
168 EXPECT_TRUE(x86fp80TypeJlm && x86fp80TypeJlm->size() ==
fpsize::x86fp80);
172 TEST(TypeConverterTests, LlvmStructTypeConversion)
177 llvm::LLVMContext context;
180 auto i32Type = ::llvm::Type::getInt32Ty(context);
181 const auto halfType = ::llvm::Type::getHalfTy(context);
182 const auto structType1Llvm = ::llvm::StructType::get(context, { i32Type, halfType },
false);
184 const auto structType2Llvm =
185 ::llvm::StructType::get(context, { i32Type, i32Type, i32Type },
true);
186 const auto structType3Llvm = ::llvm::StructType::create(context, { i32Type },
"myStruct",
true);
187 const auto structType4Llvm = ::llvm::StructType::create(context, { i32Type });
190 const auto structType1Jlm =
191 std::dynamic_pointer_cast<const StructType>(typeConverter.
ConvertLlvmType(*structType1Llvm));
192 const auto structType2Jlm =
193 std::dynamic_pointer_cast<const StructType>(typeConverter.
ConvertLlvmType(*structType2Llvm));
194 const auto structType3Jlm =
195 std::dynamic_pointer_cast<const StructType>(typeConverter.
ConvertLlvmType(*structType3Llvm));
196 const auto structType4Jlm =
197 std::dynamic_pointer_cast<const StructType>(typeConverter.
ConvertLlvmType(*structType4Llvm));
199 const auto structType5Jlm =
200 std::dynamic_pointer_cast<const StructType>(typeConverter.
ConvertLlvmType(*structType1Llvm));
203 EXPECT_NE(structType1Jlm,
nullptr);
204 EXPECT_EQ(structType1Jlm->numElements(), 2u);
205 EXPECT_FALSE(structType1Jlm->IsPacked());
206 EXPECT_TRUE(structType1Jlm->IsLiteral());
207 EXPECT_FALSE(structType1Jlm->HasName());
209 EXPECT_NE(structType2Jlm,
nullptr);
210 EXPECT_EQ(structType2Jlm->numElements(), 3u);
211 EXPECT_TRUE(structType2Jlm->IsPacked());
212 EXPECT_TRUE(structType2Jlm->IsLiteral());
213 EXPECT_FALSE(structType2Jlm->HasName());
215 EXPECT_NE(structType3Jlm,
nullptr);
216 EXPECT_EQ(structType3Jlm->numElements(), 1u);
217 EXPECT_TRUE(structType3Jlm->IsPacked());
218 EXPECT_FALSE(structType3Jlm->IsLiteral());
219 EXPECT_TRUE(structType3Jlm->HasName() && structType3Jlm->GetName() ==
"myStruct");
221 EXPECT_NE(structType4Jlm,
nullptr);
222 EXPECT_EQ(structType4Jlm->numElements(), 1u);
223 EXPECT_FALSE(structType4Jlm->IsPacked());
224 EXPECT_FALSE(structType4Jlm->IsLiteral());
225 EXPECT_FALSE(structType4Jlm->HasName());
227 EXPECT_NE(structType1Jlm.get(), structType2Jlm.get());
228 EXPECT_NE(structType1Jlm.get(), structType3Jlm.get());
229 EXPECT_EQ(structType1Jlm.get(), structType5Jlm.get());
230 EXPECT_NE(structType2Jlm.get(), structType3Jlm.get());
233 TEST(TypeConverterTests, LlvmArrayTypeConversion)
239 llvm::LLVMContext context;
242 const auto i32Type = ::llvm::Type::getInt32Ty(context);
243 const auto halfType = ::llvm::Type::getHalfTy(context);
244 const auto arrayType1Llvm = ::llvm::ArrayType::get(i32Type, 4);
245 const auto arrayType2Llvm = ::llvm::ArrayType::get(halfType, 9);
248 const auto arrayType1Jlm =
249 std::dynamic_pointer_cast<const ArrayType>(typeConverter.
ConvertLlvmType(*arrayType1Llvm));
250 const auto arrayType2Jlm =
251 std::dynamic_pointer_cast<const ArrayType>(typeConverter.
ConvertLlvmType(*arrayType2Llvm));
254 EXPECT_NE(arrayType1Jlm,
nullptr);
255 EXPECT_TRUE(is<BitType>(arrayType1Jlm->element_type()));
256 EXPECT_EQ(arrayType1Jlm->nelements(), 4u);
258 EXPECT_NE(arrayType2Jlm,
nullptr);
259 EXPECT_TRUE(is<FloatingPointType>(arrayType2Jlm->element_type()));
260 EXPECT_EQ(arrayType2Jlm->nelements(), 9u);
263 TEST(TypeConverterTests, LlvmVectorTypeConversion)
269 llvm::LLVMContext context;
272 const auto i32Type = ::llvm::Type::getInt32Ty(context);
273 const auto halfType = ::llvm::Type::getHalfTy(context);
274 const auto vectorType1Llvm = ::llvm::VectorType::get(i32Type, 4,
false);
275 const auto vectorType2Llvm = ::llvm::VectorType::get(halfType, 9,
true);
278 const auto vectorType1Jlm = std::dynamic_pointer_cast<const FixedVectorType>(
280 const auto vectorType2Jlm = std::dynamic_pointer_cast<const ScalableVectorType>(
284 EXPECT_NE(vectorType1Jlm,
nullptr);
285 EXPECT_TRUE(is<BitType>(vectorType1Jlm->type()));
286 EXPECT_EQ(vectorType1Jlm->size(), 4u);
288 EXPECT_NE(vectorType2Jlm,
nullptr);
289 EXPECT_TRUE(is<FloatingPointType>(vectorType2Jlm->type()));
290 EXPECT_EQ(vectorType2Jlm->size(), 9u);
293 TEST(TypeConverterTests, JLmBitTypeConversion)
298 llvm::LLVMContext context;
319 EXPECT_EQ(i1Type->getTypeID(), llvm::Type::IntegerTyID);
320 EXPECT_EQ(i1Type->getIntegerBitWidth(), 1u);
322 EXPECT_EQ(i2Type->getTypeID(), llvm::Type::IntegerTyID);
323 EXPECT_EQ(i2Type->getIntegerBitWidth(), 2u);
325 EXPECT_EQ(i4Type->getTypeID(), llvm::Type::IntegerTyID);
326 EXPECT_EQ(i4Type->getIntegerBitWidth(), 4u);
328 EXPECT_EQ(i8Type->getTypeID(), llvm::Type::IntegerTyID);
329 EXPECT_EQ(i8Type->getIntegerBitWidth(), 8u);
331 EXPECT_EQ(i16Type->getTypeID(), llvm::Type::IntegerTyID);
332 EXPECT_EQ(i16Type->getIntegerBitWidth(), 16u);
334 EXPECT_EQ(i32Type->getTypeID(), llvm::Type::IntegerTyID);
335 EXPECT_EQ(i32Type->getIntegerBitWidth(), 32u);
337 EXPECT_EQ(i64Type->getTypeID(), llvm::Type::IntegerTyID);
338 EXPECT_EQ(i64Type->getIntegerBitWidth(), 64u);
341 TEST(TypeConverterTests, JlmFunctionTypeConversion)
347 llvm::LLVMContext context;
350 auto bit32Type = BitType::Create(32);
354 const auto functionType1Jlm = FunctionType::Create(
355 { bit32Type, bit32Type, ioStateType, memoryStateType },
356 { memoryStateType, ioStateType });
357 const auto functionType2Jlm = FunctionType::Create(
358 { ioStateType, memoryStateType },
359 { bit32Type, memoryStateType, ioStateType });
360 const auto functionType3Jlm = FunctionType::Create(
361 { bit32Type, bit32Type, varArgType, ioStateType, memoryStateType },
362 { bit32Type, memoryStateType, ioStateType });
365 const auto functionType1Llvm =
366 llvm::dyn_cast<llvm::FunctionType>(typeConverter.
ConvertJlmType(*functionType1Jlm, context));
367 const auto functionType2Llvm =
368 llvm::dyn_cast<llvm::FunctionType>(typeConverter.
ConvertJlmType(*functionType2Jlm, context));
369 const auto functionType3Llvm =
370 llvm::dyn_cast<llvm::FunctionType>(typeConverter.
ConvertJlmType(*functionType3Jlm, context));
373 EXPECT_NE(functionType1Llvm,
nullptr);
374 EXPECT_EQ(functionType1Llvm->getNumParams(), 2u);
375 EXPECT_EQ(functionType1Llvm->getParamType(0)->getTypeID(), llvm::Type::IntegerTyID);
376 EXPECT_EQ(functionType1Llvm->getParamType(1)->getTypeID(), llvm::Type::IntegerTyID);
377 EXPECT_EQ(functionType1Llvm->getReturnType()->getTypeID(), llvm::Type::VoidTyID);
378 EXPECT_FALSE(functionType1Llvm->isVarArg());
380 EXPECT_NE(functionType2Llvm,
nullptr);
381 EXPECT_EQ(functionType2Llvm->getNumParams(), 0u);
382 EXPECT_EQ(functionType2Llvm->getReturnType()->getTypeID(), llvm::Type::IntegerTyID);
383 EXPECT_FALSE(functionType2Llvm->isVarArg());
385 EXPECT_NE(functionType3Llvm,
nullptr);
386 EXPECT_EQ(functionType3Llvm->getNumParams(), 2u);
387 EXPECT_EQ(functionType3Llvm->getParamType(0)->getTypeID(), llvm::Type::IntegerTyID);
388 EXPECT_EQ(functionType3Llvm->getParamType(1)->getTypeID(), llvm::Type::IntegerTyID);
389 EXPECT_EQ(functionType3Llvm->getReturnType()->getTypeID(), llvm::Type::IntegerTyID);
390 EXPECT_TRUE(functionType3Llvm->isVarArg());
393 TEST(TypeConverterTests, JlmPointerTypeConversion)
398 llvm::LLVMContext context;
404 const auto pointerTypeLlvm =
405 llvm::dyn_cast<llvm::PointerType>(typeConverter.
ConvertJlmType(*pointerTypeJlm, context));
408 EXPECT_NE(pointerTypeLlvm,
nullptr);
409 EXPECT_EQ(pointerTypeLlvm->getAddressSpace(), 0u);
412 TEST(TypeConverterTests, JlmArrayTypeConversion)
418 llvm::LLVMContext context;
421 const auto bit32Type = BitType::Create(32);
427 const auto arrayType1Llvm = typeConverter.
ConvertJlmType(*arrayType1Jlm, context);
428 const auto arrayType2Llvm = typeConverter.
ConvertJlmType(*arrayType2Jlm, context);
431 EXPECT_TRUE(arrayType1Llvm->isArrayTy());
432 EXPECT_EQ(arrayType1Llvm->getArrayNumElements(), 4u);
433 EXPECT_EQ(arrayType1Llvm->getArrayElementType()->getTypeID(), llvm::Type::IntegerTyID);
435 EXPECT_TRUE(arrayType2Llvm->isArrayTy());
436 EXPECT_EQ(arrayType2Llvm->getArrayNumElements(), 9u);
437 EXPECT_EQ(arrayType2Llvm->getArrayElementType()->getTypeID(), llvm::Type::HalfTyID);
440 TEST(TypeConverterTests, JlmControlTypeConversion)
445 llvm::LLVMContext context;
452 const auto integerType1Llvm = typeConverter.
ConvertJlmType(*controlType1, context);
453 const auto integerType2Llvm = typeConverter.
ConvertJlmType(*controlType10, context);
456 EXPECT_EQ(integerType1Llvm->getTypeID(), llvm::Type::IntegerTyID);
457 EXPECT_EQ(integerType1Llvm->getIntegerBitWidth(), 1u);
459 EXPECT_EQ(integerType2Llvm->getTypeID(), llvm::Type::IntegerTyID);
460 EXPECT_EQ(integerType2Llvm->getIntegerBitWidth(), 32u);
463 TEST(TypeConverterTests, JlmFloatingPointTypeConversion)
468 llvm::LLVMContext context;
478 const auto halfTypeLlvm = typeConverter.
ConvertJlmType(*halfTypeJlm, context);
479 const auto floatTypeLlvm = typeConverter.
ConvertJlmType(*floatTypeJlm, context);
480 const auto doubleTypeLlvm = typeConverter.
ConvertJlmType(*doubleTypeJlm, context);
481 const auto x86fp80TypeLlvm = typeConverter.
ConvertJlmType(*x86fp80TypeJlm, context);
482 const auto fp128TypeLlvm = typeConverter.
ConvertJlmType(*fp128TypeJlm, context);
485 EXPECT_EQ(halfTypeLlvm->getTypeID(), llvm::Type::HalfTyID);
486 EXPECT_EQ(floatTypeLlvm->getTypeID(), llvm::Type::FloatTyID);
487 EXPECT_EQ(doubleTypeLlvm->getTypeID(), llvm::Type::DoubleTyID);
488 EXPECT_EQ(x86fp80TypeLlvm->getTypeID(), llvm::Type::X86_FP80TyID);
489 EXPECT_EQ(fp128TypeLlvm->getTypeID(), llvm::Type::FP128TyID);
492 TEST(TypeConverterTests, JlmStructTypeConversion)
497 llvm::LLVMContext context;
504 const auto structType2Jlm =
509 const auto structType1Llvm = typeConverter.
ConvertJlmType(*structType1Jlm, context);
510 const auto structType2Llvm = typeConverter.
ConvertJlmType(*structType2Jlm, context);
511 const auto structType3Llvm = typeConverter.
ConvertJlmType(*structType3Jlm, context);
513 const auto structType4Llvm = typeConverter.
ConvertJlmType(*structType1Jlm, context);
516 EXPECT_EQ(structType1Llvm->getTypeID(), llvm::Type::StructTyID);
517 EXPECT_EQ(structType1Llvm->getStructNumElements(), 2u);
518 EXPECT_EQ(structType1Llvm->getStructElementType(0)->getTypeID(), llvm::Type::IntegerTyID);
519 EXPECT_EQ(structType1Llvm->getStructElementType(1)->getTypeID(), llvm::Type::HalfTyID);
520 EXPECT_FALSE(llvm::dyn_cast<llvm::StructType>(structType1Llvm)->isLiteral());
521 EXPECT_FALSE(llvm::dyn_cast<llvm::StructType>(structType1Llvm)->isPacked());
523 EXPECT_EQ(structType2Llvm->getTypeID(), llvm::Type::StructTyID);
524 EXPECT_EQ(structType2Llvm->getStructNumElements(), 3u);
525 EXPECT_EQ(structType2Llvm->getStructElementType(0)->getTypeID(), llvm::Type::IntegerTyID);
526 EXPECT_EQ(structType2Llvm->getStructElementType(1)->getTypeID(), llvm::Type::IntegerTyID);
527 EXPECT_EQ(structType2Llvm->getStructElementType(2)->getTypeID(), llvm::Type::IntegerTyID);
528 EXPECT_FALSE(llvm::dyn_cast<llvm::StructType>(structType2Llvm)->isLiteral());
529 EXPECT_FALSE(llvm::dyn_cast<llvm::StructType>(structType2Llvm)->isPacked());
531 EXPECT_EQ(structType3Llvm->getTypeID(), llvm::Type::StructTyID);
532 EXPECT_EQ(structType3Llvm->getStructNumElements(), 1u);
533 EXPECT_EQ(structType3Llvm->getStructElementType(0)->getTypeID(), llvm::Type::IntegerTyID);
534 EXPECT_EQ(structType3Llvm->getStructName(),
"myStruct");
535 EXPECT_FALSE(llvm::dyn_cast<llvm::StructType>(structType3Llvm)->isLiteral());
536 EXPECT_TRUE(llvm::dyn_cast<llvm::StructType>(structType3Llvm)->isPacked());
538 EXPECT_EQ(structType4Llvm, structType1Llvm);
541 TEST(TypeConverterTests, JlmFixedVectorTypeConversion)
547 llvm::LLVMContext context;
550 const auto bit32Type = BitType::Create(32);
555 const auto vectorType1 =
556 llvm::dyn_cast<llvm::VectorType>(typeConverter.
ConvertJlmType(*fixedVectorType1, context));
557 const auto vectorType2 =
558 llvm::dyn_cast<llvm::VectorType>(typeConverter.
ConvertJlmType(*fixedVectorType2, context));
561 EXPECT_EQ(vectorType1->getTypeID(), llvm::Type::FixedVectorTyID);
562 EXPECT_EQ(vectorType1->getElementType()->getTypeID(), llvm::Type::IntegerTyID);
563 EXPECT_EQ(vectorType1->getElementCount().getFixedValue(), 2u);
565 EXPECT_EQ(vectorType2->getTypeID(), llvm::Type::FixedVectorTyID);
566 EXPECT_EQ(vectorType2->getElementType()->getTypeID(), llvm::Type::IntegerTyID);
567 EXPECT_EQ(vectorType2->getElementCount().getFixedValue(), 4u);
570 TEST(TypeConverterTests, JlmScalableVectorTypeConversion)
576 llvm::LLVMContext context;
579 const auto bit32Type = BitType::Create(32);
584 const auto vectorType1 =
585 llvm::dyn_cast<llvm::VectorType>(typeConverter.
ConvertJlmType(*scalableVectorType1, context));
586 const auto vectorType2 =
587 llvm::dyn_cast<llvm::VectorType>(typeConverter.
ConvertJlmType(*scalableVectorType2, context));
590 EXPECT_EQ(vectorType1->getTypeID(), llvm::Type::ScalableVectorTyID);
591 EXPECT_EQ(vectorType1->getElementType()->getTypeID(), llvm::Type::IntegerTyID);
592 EXPECT_EQ(vectorType1->getElementCount().getKnownMinValue(), 2u);
594 EXPECT_EQ(vectorType2->getTypeID(), llvm::Type::ScalableVectorTyID);
595 EXPECT_EQ(vectorType2->getElementType()->getTypeID(), llvm::Type::IntegerTyID);
596 EXPECT_EQ(vectorType2->getElementCount().getKnownMinValue(), 4u);
TEST(TypeConverterTests, LlvmIntegerTypeConversion)
static std::shared_ptr< const ArrayType > Create(std::shared_ptr< const Type > type, size_t nelements)
static std::shared_ptr< const FixedVectorType > Create(std::shared_ptr< const rvsdg::Type > type, size_t size)
static std::shared_ptr< const FloatingPointType > Create(fpsize size)
static std::shared_ptr< const IOStateType > Create()
static std::shared_ptr< const MemoryStateType > Create()
static std::shared_ptr< const PointerType > Create()
static std::shared_ptr< const ScalableVectorType > Create(std::shared_ptr< const rvsdg::Type > type, size_t size)
static std::shared_ptr< const StructType > CreateIdentified(const std::string &name, std::vector< std::shared_ptr< const Type >> types, bool isPacked)
std::shared_ptr< const rvsdg::Type > ConvertLlvmType(::llvm::Type &type)
::llvm::Type * ConvertJlmType(const rvsdg::Type &type, ::llvm::LLVMContext &context)
static std::shared_ptr< const VariableArgumentType > Create()
static std::shared_ptr< const BitType > Create(std::size_t nbits)
Creates bit type of specified width.
static std::shared_ptr< const ControlType > Create(std::size_t nalternatives)
Instantiates control type.
Global memory state passed between functions.