forked from OSchip/llvm-project
Promote arguments of frameaddr / returnaddr builtins to i32 type, when needed.
This is needed for the platforms, where bitwidth of "int" is not 32 bits (e.g. 16 on msp430). llvm-svn: 92176
This commit is contained in:
parent
1e26278b3b
commit
73d50b9141
|
@ -340,12 +340,20 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
|
||||||
return RValue::get(Address);
|
return RValue::get(Address);
|
||||||
}
|
}
|
||||||
case Builtin::BI__builtin_return_address: {
|
case Builtin::BI__builtin_return_address: {
|
||||||
|
Value *Depth = EmitScalarExpr(E->getArg(0));
|
||||||
|
Depth = Builder.CreateIntCast(Depth,
|
||||||
|
llvm::Type::getInt32Ty(VMContext),
|
||||||
|
false, "tmp");
|
||||||
Value *F = CGM.getIntrinsic(Intrinsic::returnaddress, 0, 0);
|
Value *F = CGM.getIntrinsic(Intrinsic::returnaddress, 0, 0);
|
||||||
return RValue::get(Builder.CreateCall(F, EmitScalarExpr(E->getArg(0))));
|
return RValue::get(Builder.CreateCall(F, Depth));
|
||||||
}
|
}
|
||||||
case Builtin::BI__builtin_frame_address: {
|
case Builtin::BI__builtin_frame_address: {
|
||||||
|
Value *Depth = EmitScalarExpr(E->getArg(0));
|
||||||
|
Depth = Builder.CreateIntCast(Depth,
|
||||||
|
llvm::Type::getInt32Ty(VMContext),
|
||||||
|
false, "tmp");
|
||||||
Value *F = CGM.getIntrinsic(Intrinsic::frameaddress, 0, 0);
|
Value *F = CGM.getIntrinsic(Intrinsic::frameaddress, 0, 0);
|
||||||
return RValue::get(Builder.CreateCall(F, EmitScalarExpr(E->getArg(0))));
|
return RValue::get(Builder.CreateCall(F, Depth));
|
||||||
}
|
}
|
||||||
case Builtin::BI__builtin_extract_return_addr: {
|
case Builtin::BI__builtin_extract_return_addr: {
|
||||||
// FIXME: There should be a target hook for this
|
// FIXME: There should be a target hook for this
|
||||||
|
|
Loading…
Reference in New Issue