mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-24 13:18:17 +00:00
Move TargetData to DataLayout.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165402 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/DataLayout.h"
|
||||
#include "llvm/Target/TargetLibraryInfo.h"
|
||||
#include "llvm/Transforms/Utils/Local.h"
|
||||
#include <list>
|
||||
@@ -39,7 +39,7 @@ STATISTIC(NumMoveToCpy, "Number of memmoves converted to memcpy");
|
||||
STATISTIC(NumCpyToSet, "Number of memcpys converted to memset");
|
||||
|
||||
static int64_t GetOffsetFromIndex(const GEPOperator *GEP, unsigned Idx,
|
||||
bool &VariableIdxFound, const TargetData &TD){
|
||||
bool &VariableIdxFound, const DataLayout &TD){
|
||||
// Skip over the first indices.
|
||||
gep_type_iterator GTI = gep_type_begin(GEP);
|
||||
for (unsigned i = 1; i != Idx; ++i, ++GTI)
|
||||
@@ -72,7 +72,7 @@ static int64_t GetOffsetFromIndex(const GEPOperator *GEP, unsigned Idx,
|
||||
/// constant offset, and return that constant offset. For example, Ptr1 might
|
||||
/// be &A[42], and Ptr2 might be &A[40]. In this case offset would be -8.
|
||||
static bool IsPointerOffset(Value *Ptr1, Value *Ptr2, int64_t &Offset,
|
||||
const TargetData &TD) {
|
||||
const DataLayout &TD) {
|
||||
Ptr1 = Ptr1->stripPointerCasts();
|
||||
Ptr2 = Ptr2->stripPointerCasts();
|
||||
GEPOperator *GEP1 = dyn_cast<GEPOperator>(Ptr1);
|
||||
@@ -141,12 +141,12 @@ struct MemsetRange {
|
||||
/// TheStores - The actual stores that make up this range.
|
||||
SmallVector<Instruction*, 16> TheStores;
|
||||
|
||||
bool isProfitableToUseMemset(const TargetData &TD) const;
|
||||
bool isProfitableToUseMemset(const DataLayout &TD) const;
|
||||
|
||||
};
|
||||
} // end anon namespace
|
||||
|
||||
bool MemsetRange::isProfitableToUseMemset(const TargetData &TD) const {
|
||||
bool MemsetRange::isProfitableToUseMemset(const DataLayout &TD) const {
|
||||
// If we found more than 4 stores to merge or 16 bytes, use memset.
|
||||
if (TheStores.size() >= 4 || End-Start >= 16) return true;
|
||||
|
||||
@@ -192,9 +192,9 @@ class MemsetRanges {
|
||||
/// because each element is relatively large and expensive to copy.
|
||||
std::list<MemsetRange> Ranges;
|
||||
typedef std::list<MemsetRange>::iterator range_iterator;
|
||||
const TargetData &TD;
|
||||
const DataLayout &TD;
|
||||
public:
|
||||
MemsetRanges(const TargetData &td) : TD(td) {}
|
||||
MemsetRanges(const DataLayout &td) : TD(td) {}
|
||||
|
||||
typedef std::list<MemsetRange>::const_iterator const_iterator;
|
||||
const_iterator begin() const { return Ranges.begin(); }
|
||||
@@ -302,7 +302,7 @@ namespace {
|
||||
class MemCpyOpt : public FunctionPass {
|
||||
MemoryDependenceAnalysis *MD;
|
||||
TargetLibraryInfo *TLI;
|
||||
const TargetData *TD;
|
||||
const DataLayout *TD;
|
||||
public:
|
||||
static char ID; // Pass identification, replacement for typeid
|
||||
MemCpyOpt() : FunctionPass(ID) {
|
||||
@@ -1000,7 +1000,7 @@ bool MemCpyOpt::iterateOnFunction(Function &F) {
|
||||
bool MemCpyOpt::runOnFunction(Function &F) {
|
||||
bool MadeChange = false;
|
||||
MD = &getAnalysis<MemoryDependenceAnalysis>();
|
||||
TD = getAnalysisIfAvailable<TargetData>();
|
||||
TD = getAnalysisIfAvailable<DataLayout>();
|
||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
|
||||
// If we don't have at least memset and memcpy, there is little point of doing
|
||||
|
||||
Reference in New Issue
Block a user