mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-24 13:18:17 +00:00
All DSGraphs keep a reference to the targetdata they are created with. This is
used to eliminate the hard coded, hacked in, sparc specific, global TargetData. Changing the TargetData used to actually match the code fixes problems, and eliminates a crash. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9659 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -62,12 +62,19 @@ private:
|
||||
//
|
||||
GlobalSetTy InlinedGlobals;
|
||||
|
||||
/// TD - This is the target data object for the machine this graph is
|
||||
/// constructed for.
|
||||
const TargetData &TD;
|
||||
|
||||
void operator=(const DSGraph &); // DO NOT IMPLEMENT
|
||||
|
||||
public:
|
||||
// Create a new, empty, DSGraph.
|
||||
DSGraph() : GlobalsGraph(0), PrintAuxCalls(false) {}
|
||||
DSGraph(Function &F, DSGraph *GlobalsGraph); // Compute the local DSGraph
|
||||
DSGraph(const TargetData &td)
|
||||
: GlobalsGraph(0), PrintAuxCalls(false), TD(td) {}
|
||||
|
||||
// Compute the local DSGraph
|
||||
DSGraph(const TargetData &td, Function &F, DSGraph *GlobalsGraph);
|
||||
|
||||
// Copy ctor - If you want to capture the node mapping between the source and
|
||||
// destination graph, you may optionally do this by specifying a map to record
|
||||
@@ -84,9 +91,13 @@ public:
|
||||
DSGraph *getGlobalsGraph() const { return GlobalsGraph; }
|
||||
void setGlobalsGraph(DSGraph *G) { GlobalsGraph = G; }
|
||||
|
||||
// setPrintAuxCalls - If you call this method, the auxillary call vector will
|
||||
// be printed instead of the standard call vector to the dot file.
|
||||
//
|
||||
/// getTargetData - Return the TargetData object for the current target.
|
||||
///
|
||||
const TargetData &getTargetData() const { return TD; }
|
||||
|
||||
/// setPrintAuxCalls - If you call this method, the auxillary call vector will
|
||||
/// be printed instead of the standard call vector to the dot file.
|
||||
///
|
||||
void setPrintAuxCalls() { PrintAuxCalls = true; }
|
||||
bool shouldPrintAuxCalls() const { return PrintAuxCalls; }
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
template<typename BaseType>
|
||||
class DSNodeIterator; // Data structure graph traversal iterator
|
||||
class TargetData;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// DSNode - Data structure node class
|
||||
@@ -134,6 +135,11 @@ public:
|
||||
DSGraph *getParentGraph() const { return ParentGraph; }
|
||||
void setParentGraph(DSGraph *G) { ParentGraph = G; }
|
||||
|
||||
|
||||
/// getTargetData - Get the target data object used to construct this node.
|
||||
///
|
||||
const TargetData &getTargetData() const;
|
||||
|
||||
/// getForwardNode - This method returns the node that this node is forwarded
|
||||
/// to, if any.
|
||||
DSNode *getForwardNode() const { return ForwardNH.getNode(); }
|
||||
|
||||
@@ -28,7 +28,7 @@ class DSNode; // Each node in the graph
|
||||
class DSGraph; // A graph for a function
|
||||
|
||||
namespace DS { // FIXME: After the paper, this should get cleaned up
|
||||
enum { PointerShift = 3, // 64bit ptrs = 3, 32 bit ptrs = 2
|
||||
enum { PointerShift = 2, // 64bit ptrs = 3, 32 bit ptrs = 2
|
||||
PointerSize = 1 << PointerShift
|
||||
};
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#define LLVM_ANALYSIS_DATA_STRUCTURE_H
|
||||
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "Support/hash_set"
|
||||
|
||||
class Type;
|
||||
@@ -69,6 +70,7 @@ public:
|
||||
// getAnalysisUsage - This obviously provides a data structure graph.
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
AU.addRequired<TargetData>();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -62,12 +62,19 @@ private:
|
||||
//
|
||||
GlobalSetTy InlinedGlobals;
|
||||
|
||||
/// TD - This is the target data object for the machine this graph is
|
||||
/// constructed for.
|
||||
const TargetData &TD;
|
||||
|
||||
void operator=(const DSGraph &); // DO NOT IMPLEMENT
|
||||
|
||||
public:
|
||||
// Create a new, empty, DSGraph.
|
||||
DSGraph() : GlobalsGraph(0), PrintAuxCalls(false) {}
|
||||
DSGraph(Function &F, DSGraph *GlobalsGraph); // Compute the local DSGraph
|
||||
DSGraph(const TargetData &td)
|
||||
: GlobalsGraph(0), PrintAuxCalls(false), TD(td) {}
|
||||
|
||||
// Compute the local DSGraph
|
||||
DSGraph(const TargetData &td, Function &F, DSGraph *GlobalsGraph);
|
||||
|
||||
// Copy ctor - If you want to capture the node mapping between the source and
|
||||
// destination graph, you may optionally do this by specifying a map to record
|
||||
@@ -84,9 +91,13 @@ public:
|
||||
DSGraph *getGlobalsGraph() const { return GlobalsGraph; }
|
||||
void setGlobalsGraph(DSGraph *G) { GlobalsGraph = G; }
|
||||
|
||||
// setPrintAuxCalls - If you call this method, the auxillary call vector will
|
||||
// be printed instead of the standard call vector to the dot file.
|
||||
//
|
||||
/// getTargetData - Return the TargetData object for the current target.
|
||||
///
|
||||
const TargetData &getTargetData() const { return TD; }
|
||||
|
||||
/// setPrintAuxCalls - If you call this method, the auxillary call vector will
|
||||
/// be printed instead of the standard call vector to the dot file.
|
||||
///
|
||||
void setPrintAuxCalls() { PrintAuxCalls = true; }
|
||||
bool shouldPrintAuxCalls() const { return PrintAuxCalls; }
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
template<typename BaseType>
|
||||
class DSNodeIterator; // Data structure graph traversal iterator
|
||||
class TargetData;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// DSNode - Data structure node class
|
||||
@@ -134,6 +135,11 @@ public:
|
||||
DSGraph *getParentGraph() const { return ParentGraph; }
|
||||
void setParentGraph(DSGraph *G) { ParentGraph = G; }
|
||||
|
||||
|
||||
/// getTargetData - Get the target data object used to construct this node.
|
||||
///
|
||||
const TargetData &getTargetData() const;
|
||||
|
||||
/// getForwardNode - This method returns the node that this node is forwarded
|
||||
/// to, if any.
|
||||
DSNode *getForwardNode() const { return ForwardNH.getNode(); }
|
||||
|
||||
@@ -28,7 +28,7 @@ class DSNode; // Each node in the graph
|
||||
class DSGraph; // A graph for a function
|
||||
|
||||
namespace DS { // FIXME: After the paper, this should get cleaned up
|
||||
enum { PointerShift = 3, // 64bit ptrs = 3, 32 bit ptrs = 2
|
||||
enum { PointerShift = 2, // 64bit ptrs = 3, 32 bit ptrs = 2
|
||||
PointerSize = 1 << PointerShift
|
||||
};
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#define LLVM_ANALYSIS_DATA_STRUCTURE_H
|
||||
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "Support/hash_set"
|
||||
|
||||
class Type;
|
||||
@@ -69,6 +70,7 @@ public:
|
||||
// getAnalysisUsage - This obviously provides a data structure graph.
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
AU.addRequired<TargetData>();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user