mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-27 14:24:40 +00:00
Make code more readable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12305 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -131,7 +131,7 @@ class ModRefInfoBuilder : public InstVisitor<ModRefInfoBuilder> {
|
||||
void operator=(const ModRefInfoBuilder&); // DO NOT IMPLEMENT
|
||||
|
||||
public:
|
||||
/*ctor*/ ModRefInfoBuilder(const DSGraph& _funcGraph,
|
||||
ModRefInfoBuilder(const DSGraph& _funcGraph,
|
||||
const FunctionModRefInfo& _funcModRef,
|
||||
ModRefTable& _modRefTable)
|
||||
: funcGraph(_funcGraph), funcModRef(_funcModRef), modRefTable(_modRefTable)
|
||||
@ -142,11 +142,11 @@ public:
|
||||
// Add the call to the defs list if it modifies any nodes and to the uses
|
||||
// list if it refs any nodes.
|
||||
//
|
||||
void visitCallInst (CallInst& callInst) {
|
||||
void visitCallInst(CallInst& callInst) {
|
||||
ModRefInfo safeModRef(funcGraph.getGraphSize());
|
||||
const ModRefInfo* callModRef = funcModRef.getModRefInfo(callInst);
|
||||
if (callModRef == NULL)
|
||||
{ // call to external/unknown function: mark all nodes as Mod and Ref
|
||||
if (callModRef == NULL) {
|
||||
// call to external/unknown function: mark all nodes as Mod and Ref
|
||||
safeModRef.getModSet().set();
|
||||
safeModRef.getRefSet().set();
|
||||
callModRef = &safeModRef;
|
||||
@ -163,11 +163,10 @@ public:
|
||||
// At a store instruction, add to the mod set the single node pointed to
|
||||
// by the pointer argument of the store. Interestingly, if there is no
|
||||
// such node, that would be a null pointer reference!
|
||||
void visitStoreInst (StoreInst& storeInst) {
|
||||
void visitStoreInst(StoreInst& storeInst) {
|
||||
const DSNodeHandle& ptrNode =
|
||||
funcGraph.getNodeForValue(storeInst.getPointerOperand());
|
||||
if (const DSNode* target = ptrNode.getNode())
|
||||
{
|
||||
if (const DSNode* target = ptrNode.getNode()) {
|
||||
unsigned nodeId = funcModRef.getNodeId(target);
|
||||
ModRefInfo& minfo =
|
||||
modRefTable.modRefMap.insert(
|
||||
@ -175,19 +174,17 @@ public:
|
||||
ModRefInfo(funcGraph.getGraphSize()))).first->second;
|
||||
minfo.setNodeIsMod(nodeId);
|
||||
modRefTable.AddDef(&storeInst);
|
||||
}
|
||||
else
|
||||
} else
|
||||
std::cerr << "Warning: Uninitialized pointer reference!\n";
|
||||
}
|
||||
|
||||
// At a load instruction, add to the ref set the single node pointed to
|
||||
// by the pointer argument of the load. Interestingly, if there is no
|
||||
// such node, that would be a null pointer reference!
|
||||
void visitLoadInst (LoadInst& loadInst) {
|
||||
void visitLoadInst(LoadInst& loadInst) {
|
||||
const DSNodeHandle& ptrNode =
|
||||
funcGraph.getNodeForValue(loadInst.getPointerOperand());
|
||||
if (const DSNode* target = ptrNode.getNode())
|
||||
{
|
||||
if (const DSNode* target = ptrNode.getNode()) {
|
||||
unsigned nodeId = funcModRef.getNodeId(target);
|
||||
ModRefInfo& minfo =
|
||||
modRefTable.modRefMap.insert(
|
||||
@ -195,8 +192,7 @@ public:
|
||||
ModRefInfo(funcGraph.getGraphSize()))).first->second;
|
||||
minfo.setNodeIsRef(nodeId);
|
||||
modRefTable.AddUse(&loadInst);
|
||||
}
|
||||
else
|
||||
} else
|
||||
std::cerr << "Warning: Uninitialized pointer reference!\n";
|
||||
}
|
||||
};
|
||||
|
@ -131,7 +131,7 @@ class ModRefInfoBuilder : public InstVisitor<ModRefInfoBuilder> {
|
||||
void operator=(const ModRefInfoBuilder&); // DO NOT IMPLEMENT
|
||||
|
||||
public:
|
||||
/*ctor*/ ModRefInfoBuilder(const DSGraph& _funcGraph,
|
||||
ModRefInfoBuilder(const DSGraph& _funcGraph,
|
||||
const FunctionModRefInfo& _funcModRef,
|
||||
ModRefTable& _modRefTable)
|
||||
: funcGraph(_funcGraph), funcModRef(_funcModRef), modRefTable(_modRefTable)
|
||||
@ -142,11 +142,11 @@ public:
|
||||
// Add the call to the defs list if it modifies any nodes and to the uses
|
||||
// list if it refs any nodes.
|
||||
//
|
||||
void visitCallInst (CallInst& callInst) {
|
||||
void visitCallInst(CallInst& callInst) {
|
||||
ModRefInfo safeModRef(funcGraph.getGraphSize());
|
||||
const ModRefInfo* callModRef = funcModRef.getModRefInfo(callInst);
|
||||
if (callModRef == NULL)
|
||||
{ // call to external/unknown function: mark all nodes as Mod and Ref
|
||||
if (callModRef == NULL) {
|
||||
// call to external/unknown function: mark all nodes as Mod and Ref
|
||||
safeModRef.getModSet().set();
|
||||
safeModRef.getRefSet().set();
|
||||
callModRef = &safeModRef;
|
||||
@ -163,11 +163,10 @@ public:
|
||||
// At a store instruction, add to the mod set the single node pointed to
|
||||
// by the pointer argument of the store. Interestingly, if there is no
|
||||
// such node, that would be a null pointer reference!
|
||||
void visitStoreInst (StoreInst& storeInst) {
|
||||
void visitStoreInst(StoreInst& storeInst) {
|
||||
const DSNodeHandle& ptrNode =
|
||||
funcGraph.getNodeForValue(storeInst.getPointerOperand());
|
||||
if (const DSNode* target = ptrNode.getNode())
|
||||
{
|
||||
if (const DSNode* target = ptrNode.getNode()) {
|
||||
unsigned nodeId = funcModRef.getNodeId(target);
|
||||
ModRefInfo& minfo =
|
||||
modRefTable.modRefMap.insert(
|
||||
@ -175,19 +174,17 @@ public:
|
||||
ModRefInfo(funcGraph.getGraphSize()))).first->second;
|
||||
minfo.setNodeIsMod(nodeId);
|
||||
modRefTable.AddDef(&storeInst);
|
||||
}
|
||||
else
|
||||
} else
|
||||
std::cerr << "Warning: Uninitialized pointer reference!\n";
|
||||
}
|
||||
|
||||
// At a load instruction, add to the ref set the single node pointed to
|
||||
// by the pointer argument of the load. Interestingly, if there is no
|
||||
// such node, that would be a null pointer reference!
|
||||
void visitLoadInst (LoadInst& loadInst) {
|
||||
void visitLoadInst(LoadInst& loadInst) {
|
||||
const DSNodeHandle& ptrNode =
|
||||
funcGraph.getNodeForValue(loadInst.getPointerOperand());
|
||||
if (const DSNode* target = ptrNode.getNode())
|
||||
{
|
||||
if (const DSNode* target = ptrNode.getNode()) {
|
||||
unsigned nodeId = funcModRef.getNodeId(target);
|
||||
ModRefInfo& minfo =
|
||||
modRefTable.modRefMap.insert(
|
||||
@ -195,8 +192,7 @@ public:
|
||||
ModRefInfo(funcGraph.getGraphSize()))).first->second;
|
||||
minfo.setNodeIsRef(nodeId);
|
||||
modRefTable.AddUse(&loadInst);
|
||||
}
|
||||
else
|
||||
} else
|
||||
std::cerr << "Warning: Uninitialized pointer reference!\n";
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user