mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
IRBuilder: Add overload for intrinsics without args
llvm-svn: 333443
This commit is contained in:
parent
27a95e7d2c
commit
885ae3077d
@ -632,6 +632,11 @@ public:
|
||||
Value *LHS, Value *RHS,
|
||||
const Twine &Name = "");
|
||||
|
||||
/// Create a call to intrinsic \p ID with no operands.
|
||||
CallInst *CreateIntrinsic(Intrinsic::ID ID,
|
||||
Instruction *FMFSource = nullptr,
|
||||
const Twine &Name = "");
|
||||
|
||||
/// Create a call to intrinsic \p ID with 1 or more operands assuming the
|
||||
/// intrinsic and all operands have the same type. If \p FMFSource is
|
||||
/// provided, copy fast-math-flags from that instruction to the intrinsic.
|
||||
|
@ -668,6 +668,14 @@ CallInst *IRBuilderBase::CreateBinaryIntrinsic(Intrinsic::ID ID,
|
||||
return createCallHelper(Fn, { LHS, RHS }, this, Name);
|
||||
}
|
||||
|
||||
CallInst *IRBuilderBase::CreateIntrinsic(Intrinsic::ID ID,
|
||||
Instruction *FMFSource,
|
||||
const Twine &Name) {
|
||||
Module *M = BB->getModule();
|
||||
Function *Fn = Intrinsic::getDeclaration(M, ID);
|
||||
return createCallHelper(Fn, {}, this, Name);
|
||||
}
|
||||
|
||||
CallInst *IRBuilderBase::CreateIntrinsic(Intrinsic::ID ID,
|
||||
ArrayRef<Value *> Args,
|
||||
Instruction *FMFSource,
|
||||
|
@ -63,6 +63,10 @@ TEST_F(IRBuilderTest, Intrinsics) {
|
||||
Call = Builder.CreateMaxNum(V, V);
|
||||
II = cast<IntrinsicInst>(Call);
|
||||
EXPECT_EQ(II->getIntrinsicID(), Intrinsic::maxnum);
|
||||
|
||||
Call = Builder.CreateIntrinsic(Intrinsic::readcyclecounter);
|
||||
II = cast<IntrinsicInst>(Call);
|
||||
EXPECT_EQ(II->getIntrinsicID(), Intrinsic::readcyclecounter);
|
||||
}
|
||||
|
||||
TEST_F(IRBuilderTest, Lifetime) {
|
||||
|
Loading…
Reference in New Issue
Block a user