aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2004-03-12 00:58:41 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2004-03-12 00:58:41 +0000
commit56c0fa69a30d887bcd8a373b6f459c39e7fb1d7f (patch)
tree7c269f15b0a69dc72c45e2dfb5b67af16052fcaf /lib
parentec85af16a0a5ad69e79fde0c048886b2c615dd2e (diff)
downloadexternal_llvm-56c0fa69a30d887bcd8a373b6f459c39e7fb1d7f.zip
external_llvm-56c0fa69a30d887bcd8a373b6f459c39e7fb1d7f.tar.gz
external_llvm-56c0fa69a30d887bcd8a373b6f459c39e7fb1d7f.tar.bz2
Make code more readable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12305 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/DataStructure/MemoryDepAnalysis.cpp66
-rw-r--r--lib/Analysis/IPA/MemoryDepAnalysis.cpp66
2 files changed, 62 insertions, 70 deletions
diff --git a/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp b/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp
index 2bc8e4a..97bc981 100644
--- a/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp
+++ b/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp
@@ -53,7 +53,7 @@ namespace llvm {
struct ModRefTable {
typedef hash_map<Instruction*, ModRefInfo> ModRefMap;
typedef ModRefMap::const_iterator const_map_iterator;
- typedef ModRefMap:: iterator map_iterator;
+ typedef ModRefMap:: iterator map_iterator;
typedef std::vector<Instruction*>::const_iterator const_ref_iterator;
typedef std::vector<Instruction*>:: iterator ref_iterator;
@@ -131,9 +131,9 @@ class ModRefInfoBuilder : public InstVisitor<ModRefInfoBuilder> {
void operator=(const ModRefInfoBuilder&); // DO NOT IMPLEMENT
public:
- /*ctor*/ ModRefInfoBuilder(const DSGraph& _funcGraph,
- const FunctionModRefInfo& _funcModRef,
- ModRefTable& _modRefTable)
+ ModRefInfoBuilder(const DSGraph& _funcGraph,
+ const FunctionModRefInfo& _funcModRef,
+ ModRefTable& _modRefTable)
: funcGraph(_funcGraph), funcModRef(_funcModRef), modRefTable(_modRefTable)
{
}
@@ -142,15 +142,15 @@ 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
- safeModRef.getModSet().set();
- safeModRef.getRefSet().set();
- callModRef = &safeModRef;
- }
+ if (callModRef == NULL) {
+ // call to external/unknown function: mark all nodes as Mod and Ref
+ safeModRef.getModSet().set();
+ safeModRef.getRefSet().set();
+ callModRef = &safeModRef;
+ }
modRefTable.modRefMap.insert(std::make_pair(&callInst,
ModRefInfo(*callModRef)));
@@ -163,40 +163,36 @@ 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())
- {
- unsigned nodeId = funcModRef.getNodeId(target);
- ModRefInfo& minfo =
- modRefTable.modRefMap.insert(
- std::make_pair(&storeInst,
- ModRefInfo(funcGraph.getGraphSize()))).first->second;
- minfo.setNodeIsMod(nodeId);
- modRefTable.AddDef(&storeInst);
- }
- else
+ if (const DSNode* target = ptrNode.getNode()) {
+ unsigned nodeId = funcModRef.getNodeId(target);
+ ModRefInfo& minfo =
+ modRefTable.modRefMap.insert(
+ std::make_pair(&storeInst,
+ ModRefInfo(funcGraph.getGraphSize()))).first->second;
+ minfo.setNodeIsMod(nodeId);
+ modRefTable.AddDef(&storeInst);
+ } 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())
- {
- unsigned nodeId = funcModRef.getNodeId(target);
- ModRefInfo& minfo =
- modRefTable.modRefMap.insert(
- std::make_pair(&loadInst,
- ModRefInfo(funcGraph.getGraphSize()))).first->second;
- minfo.setNodeIsRef(nodeId);
- modRefTable.AddUse(&loadInst);
- }
- else
+ if (const DSNode* target = ptrNode.getNode()) {
+ unsigned nodeId = funcModRef.getNodeId(target);
+ ModRefInfo& minfo =
+ modRefTable.modRefMap.insert(
+ std::make_pair(&loadInst,
+ ModRefInfo(funcGraph.getGraphSize()))).first->second;
+ minfo.setNodeIsRef(nodeId);
+ modRefTable.AddUse(&loadInst);
+ } else
std::cerr << "Warning: Uninitialized pointer reference!\n";
}
};
diff --git a/lib/Analysis/IPA/MemoryDepAnalysis.cpp b/lib/Analysis/IPA/MemoryDepAnalysis.cpp
index 2bc8e4a..97bc981 100644
--- a/lib/Analysis/IPA/MemoryDepAnalysis.cpp
+++ b/lib/Analysis/IPA/MemoryDepAnalysis.cpp
@@ -53,7 +53,7 @@ namespace llvm {
struct ModRefTable {
typedef hash_map<Instruction*, ModRefInfo> ModRefMap;
typedef ModRefMap::const_iterator const_map_iterator;
- typedef ModRefMap:: iterator map_iterator;
+ typedef ModRefMap:: iterator map_iterator;
typedef std::vector<Instruction*>::const_iterator const_ref_iterator;
typedef std::vector<Instruction*>:: iterator ref_iterator;
@@ -131,9 +131,9 @@ class ModRefInfoBuilder : public InstVisitor<ModRefInfoBuilder> {
void operator=(const ModRefInfoBuilder&); // DO NOT IMPLEMENT
public:
- /*ctor*/ ModRefInfoBuilder(const DSGraph& _funcGraph,
- const FunctionModRefInfo& _funcModRef,
- ModRefTable& _modRefTable)
+ ModRefInfoBuilder(const DSGraph& _funcGraph,
+ const FunctionModRefInfo& _funcModRef,
+ ModRefTable& _modRefTable)
: funcGraph(_funcGraph), funcModRef(_funcModRef), modRefTable(_modRefTable)
{
}
@@ -142,15 +142,15 @@ 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
- safeModRef.getModSet().set();
- safeModRef.getRefSet().set();
- callModRef = &safeModRef;
- }
+ if (callModRef == NULL) {
+ // call to external/unknown function: mark all nodes as Mod and Ref
+ safeModRef.getModSet().set();
+ safeModRef.getRefSet().set();
+ callModRef = &safeModRef;
+ }
modRefTable.modRefMap.insert(std::make_pair(&callInst,
ModRefInfo(*callModRef)));
@@ -163,40 +163,36 @@ 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())
- {
- unsigned nodeId = funcModRef.getNodeId(target);
- ModRefInfo& minfo =
- modRefTable.modRefMap.insert(
- std::make_pair(&storeInst,
- ModRefInfo(funcGraph.getGraphSize()))).first->second;
- minfo.setNodeIsMod(nodeId);
- modRefTable.AddDef(&storeInst);
- }
- else
+ if (const DSNode* target = ptrNode.getNode()) {
+ unsigned nodeId = funcModRef.getNodeId(target);
+ ModRefInfo& minfo =
+ modRefTable.modRefMap.insert(
+ std::make_pair(&storeInst,
+ ModRefInfo(funcGraph.getGraphSize()))).first->second;
+ minfo.setNodeIsMod(nodeId);
+ modRefTable.AddDef(&storeInst);
+ } 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())
- {
- unsigned nodeId = funcModRef.getNodeId(target);
- ModRefInfo& minfo =
- modRefTable.modRefMap.insert(
- std::make_pair(&loadInst,
- ModRefInfo(funcGraph.getGraphSize()))).first->second;
- minfo.setNodeIsRef(nodeId);
- modRefTable.AddUse(&loadInst);
- }
- else
+ if (const DSNode* target = ptrNode.getNode()) {
+ unsigned nodeId = funcModRef.getNodeId(target);
+ ModRefInfo& minfo =
+ modRefTable.modRefMap.insert(
+ std::make_pair(&loadInst,
+ ModRefInfo(funcGraph.getGraphSize()))).first->second;
+ minfo.setNodeIsRef(nodeId);
+ modRefTable.AddUse(&loadInst);
+ } else
std::cerr << "Warning: Uninitialized pointer reference!\n";
}
};