mirror of
https://github.com/Cisco-Talos/clamav.git
synced 2025-11-11 05:21:05 +00:00
LLVM 2.8 changed llvm.mem{cpy,move,set}.* to take 5 arguments.
Use AutoUpgrade to upgrade these calls. Intrinsic::getDeclaration can't be used because in 2.7 it needs 1 type, in 2.8 it needs 2/3, and there is no function to query how many it needs.
This commit is contained in:
parent
e3a5450335
commit
744c40d142
1 changed files with 12 additions and 0 deletions
|
|
@ -38,6 +38,7 @@
|
||||||
#include "llvm/Analysis/LoopInfo.h"
|
#include "llvm/Analysis/LoopInfo.h"
|
||||||
#include "llvm/Analysis/ScalarEvolution.h"
|
#include "llvm/Analysis/ScalarEvolution.h"
|
||||||
#include "llvm/Analysis/Verifier.h"
|
#include "llvm/Analysis/Verifier.h"
|
||||||
|
#include "llvm/AutoUpgrade.h"
|
||||||
#include "llvm/CallingConv.h"
|
#include "llvm/CallingConv.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/Function.h"
|
#include "llvm/Function.h"
|
||||||
|
|
@ -133,6 +134,14 @@ namespace {
|
||||||
|
|
||||||
static sys::ThreadLocal<const jmp_buf> ExceptionReturn;
|
static sys::ThreadLocal<const jmp_buf> ExceptionReturn;
|
||||||
|
|
||||||
|
static void UpgradeCall(CallInst *&C, Function *Intr)
|
||||||
|
{
|
||||||
|
Function *New;
|
||||||
|
if (!UpgradeIntrinsicFunction(Intr, New) || New == Intr)
|
||||||
|
return;
|
||||||
|
UpgradeIntrinsicCall(C, New);
|
||||||
|
}
|
||||||
|
|
||||||
void do_shutdown() {
|
void do_shutdown() {
|
||||||
llvm_shutdown();
|
llvm_shutdown();
|
||||||
}
|
}
|
||||||
|
|
@ -1288,6 +1297,7 @@ public:
|
||||||
ConstantInt::get(Type::getInt32Ty(Context), 1));
|
ConstantInt::get(Type::getInt32Ty(Context), 1));
|
||||||
c->setTailCall(true);
|
c->setTailCall(true);
|
||||||
c->setDoesNotThrow();
|
c->setDoesNotThrow();
|
||||||
|
UpgradeCall(c, CF->FMemset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OP_BC_MEMCPY:
|
case OP_BC_MEMCPY:
|
||||||
|
|
@ -1301,6 +1311,7 @@ public:
|
||||||
ConstantInt::get(Type::getInt32Ty(Context), 1));
|
ConstantInt::get(Type::getInt32Ty(Context), 1));
|
||||||
c->setTailCall(true);
|
c->setTailCall(true);
|
||||||
c->setDoesNotThrow();
|
c->setDoesNotThrow();
|
||||||
|
UpgradeCall(c, CF->FMemcpy);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OP_BC_MEMMOVE:
|
case OP_BC_MEMMOVE:
|
||||||
|
|
@ -1314,6 +1325,7 @@ public:
|
||||||
ConstantInt::get(Type::getInt32Ty(Context), 1));
|
ConstantInt::get(Type::getInt32Ty(Context), 1));
|
||||||
c->setTailCall(true);
|
c->setTailCall(true);
|
||||||
c->setDoesNotThrow();
|
c->setDoesNotThrow();
|
||||||
|
UpgradeCall(c, CF->FMemmove);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OP_BC_MEMCMP:
|
case OP_BC_MEMCMP:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue