ASSERT_TRUE(Ty->isPointerTy());
PointerType *PT = cast<PointerType>(Ty);
- Ty = PT->getElementType();
+ Ty = PT->getPointerElementType();
ASSERT_TRUE(Ty->isIntegerTy());
ASSERT_TRUE(Ty->getPrimitiveSizeInBits() == 32);
ASSERT_TRUE(Ty->isPointerTy());
PT = cast<PointerType>(Ty);
- Ty = PT->getElementType();
+ Ty = PT->getPointerElementType();
ASSERT_TRUE(Ty->isPointerTy());
PT = cast<PointerType>(Ty);
- Ty = PT->getElementType();
+ Ty = PT->getPointerElementType();
ASSERT_TRUE(Ty->isIntegerTy());
ASSERT_TRUE(Ty->getPrimitiveSizeInBits() == 32);
ASSERT_TRUE(Read == 4);
PointerType *PT = cast<PointerType>(Ty);
- Ty = PT->getElementType();
+ Ty = PT->getPointerElementType();
ASSERT_TRUE(Ty->isIntegerTy());
ASSERT_TRUE(Ty->getPrimitiveSizeInBits() == 32);
ASSERT_TRUE(Read == 5);
PT = cast<PointerType>(Ty);
- Ty = PT->getElementType();
+ Ty = PT->getPointerElementType();
ASSERT_TRUE(Ty->isPointerTy());
PT = cast<PointerType>(Ty);
- Ty = PT->getElementType();
+ Ty = PT->getPointerElementType();
ASSERT_TRUE(Ty->isIntegerTy());
ASSERT_TRUE(Ty->getPrimitiveSizeInBits() == 32);
if (auto attr = op.getAttrOfType<FlatSymbolRefAttr>("callee"))
return builder.CreateCall(
moduleTranslation.lookupFunction(attr.getValue()), operandsRef);
- auto *calleePtrType =
- cast<llvm::PointerType>(operandsRef.front()->getType());
- auto *calleeType =
- cast<llvm::FunctionType>(calleePtrType->getElementType());
- return builder.CreateCall(calleeType, operandsRef.front(),
+ auto *calleeType = operandsRef.front()->getType();
+ auto *calleeFunctionType =
+ cast<llvm::FunctionType>(calleeType->getPointerElementType());
+ return builder.CreateCall(calleeFunctionType, operandsRef.front(),
operandsRef.drop_front());
};
moduleTranslation.lookupBlock(invOp.getSuccessor(0)),
moduleTranslation.lookupBlock(invOp.getSuccessor(1)), operandsRef);
} else {
- auto *calleePtrType =
- cast<llvm::PointerType>(operandsRef.front()->getType());
- auto *calleeType =
- cast<llvm::FunctionType>(calleePtrType->getElementType());
+ auto *calleeType = operandsRef.front()->getType();
+ auto *calleeFunctionType =
+ cast<llvm::FunctionType>(calleeType->getPointerElementType());
result = builder.CreateInvoke(
- calleeType, operandsRef.front(),
+ calleeFunctionType, operandsRef.front(),
moduleTranslation.lookupBlock(invOp.getSuccessor(0)),
moduleTranslation.lookupBlock(invOp.getSuccessor(1)),
operandsRef.drop_front());
/// Translates the given pointer type.
Type translate(llvm::PointerType *type) {
- return LLVM::LLVMPointerType::get(translateType(type->getElementType()),
- type->getAddressSpace());
+ return LLVM::LLVMPointerType::get(
+ translateType(type->getPointerElementType()), type->getAddressSpace());
}
/// Translates the given structure type.