mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 22:28:18 +00:00
Move OptChkCall off LibCallOptimization into StrCpyOpt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99418 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -49,13 +49,10 @@ protected:
|
|||||||
Function *Caller;
|
Function *Caller;
|
||||||
const TargetData *TD;
|
const TargetData *TD;
|
||||||
LLVMContext* Context;
|
LLVMContext* Context;
|
||||||
bool OptChkCall; // True if it's optimizing a *_chk libcall.
|
|
||||||
public:
|
public:
|
||||||
LibCallOptimization() : OptChkCall(false) { }
|
LibCallOptimization() { }
|
||||||
virtual ~LibCallOptimization() {}
|
virtual ~LibCallOptimization() {}
|
||||||
|
|
||||||
void setOptChkCall(bool c) { OptChkCall = c; }
|
|
||||||
|
|
||||||
/// CallOptimizer - This pure virtual method is implemented by base classes to
|
/// CallOptimizer - This pure virtual method is implemented by base classes to
|
||||||
/// do various optimizations. If this returns null then no transformation was
|
/// do various optimizations. If this returns null then no transformation was
|
||||||
/// performed. If it returns CI, then it transformed the call and CI is to be
|
/// performed. If it returns CI, then it transformed the call and CI is to be
|
||||||
@@ -353,6 +350,10 @@ struct StrNCmpOpt : public LibCallOptimization {
|
|||||||
// 'strcpy' Optimizations
|
// 'strcpy' Optimizations
|
||||||
|
|
||||||
struct StrCpyOpt : public LibCallOptimization {
|
struct StrCpyOpt : public LibCallOptimization {
|
||||||
|
bool OptChkCall; // True if it's optimizing a __strcpy_chk libcall.
|
||||||
|
|
||||||
|
StrCpyOpt(bool c) : OptChkCall(c) {}
|
||||||
|
|
||||||
virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
|
virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
|
||||||
// Verify the "strcpy" function prototype.
|
// Verify the "strcpy" function prototype.
|
||||||
unsigned NumParams = OptChkCall ? 3 : 2;
|
unsigned NumParams = OptChkCall ? 3 : 2;
|
||||||
@@ -1188,8 +1189,7 @@ namespace {
|
|||||||
bool Modified; // This is only used by doInitialization.
|
bool Modified; // This is only used by doInitialization.
|
||||||
public:
|
public:
|
||||||
static char ID; // Pass identification
|
static char ID; // Pass identification
|
||||||
SimplifyLibCalls() : FunctionPass(&ID) {}
|
SimplifyLibCalls() : FunctionPass(&ID), StrCpy(false), StrCpyChk(true) {}
|
||||||
|
|
||||||
void InitOptimizations();
|
void InitOptimizations();
|
||||||
bool runOnFunction(Function &F);
|
bool runOnFunction(Function &F);
|
||||||
|
|
||||||
@@ -1240,7 +1240,6 @@ void SimplifyLibCalls::InitOptimizations() {
|
|||||||
Optimizations["memset"] = &MemSet;
|
Optimizations["memset"] = &MemSet;
|
||||||
|
|
||||||
// _chk variants of String and Memory LibCall Optimizations.
|
// _chk variants of String and Memory LibCall Optimizations.
|
||||||
StrCpyChk.setOptChkCall(true);
|
|
||||||
Optimizations["__strcpy_chk"] = &StrCpyChk;
|
Optimizations["__strcpy_chk"] = &StrCpyChk;
|
||||||
|
|
||||||
// Math Library Optimizations
|
// Math Library Optimizations
|
||||||
|
Reference in New Issue
Block a user