diff options
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/MachineFunction.cpp | 62 | 
1 files changed, 30 insertions, 32 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 224231c..bfa5ab2 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -719,43 +719,41 @@ MachineFunction::CallSiteInfo::CallSiteInfo(const CallBase &CB) {    }  } -namespace llvm { +template <> +struct llvm::DOTGraphTraits<const MachineFunction *> +    : public DefaultDOTGraphTraits { +  DOTGraphTraits(bool isSimple = false) : DefaultDOTGraphTraits(isSimple) {} -  template<> -  struct DOTGraphTraits<const MachineFunction*> : public DefaultDOTGraphTraits { -    DOTGraphTraits(bool isSimple = false) : DefaultDOTGraphTraits(isSimple) {} +  static std::string getGraphName(const MachineFunction *F) { +    return ("CFG for '" + F->getName() + "' function").str(); +  } -    static std::string getGraphName(const MachineFunction *F) { -      return ("CFG for '" + F->getName() + "' function").str(); +  std::string getNodeLabel(const MachineBasicBlock *Node, +                           const MachineFunction *Graph) { +    std::string OutStr; +    { +      raw_string_ostream OSS(OutStr); + +      if (isSimple()) { +        OSS << printMBBReference(*Node); +        if (const BasicBlock *BB = Node->getBasicBlock()) +          OSS << ": " << BB->getName(); +      } else +        Node->print(OSS);      } -    std::string getNodeLabel(const MachineBasicBlock *Node, -                             const MachineFunction *Graph) { -      std::string OutStr; -      { -        raw_string_ostream OSS(OutStr); - -        if (isSimple()) { -          OSS << printMBBReference(*Node); -          if (const BasicBlock *BB = Node->getBasicBlock()) -            OSS << ": " << BB->getName(); -        } else -          Node->print(OSS); -      } - -      if (OutStr[0] == '\n') OutStr.erase(OutStr.begin()); - -      // Process string output to make it nicer... -      for (unsigned i = 0; i != OutStr.length(); ++i) -        if (OutStr[i] == '\n') {                            // Left justify -          OutStr[i] = '\\'; -          OutStr.insert(OutStr.begin()+i+1, 'l'); -        } -      return OutStr; -    } -  }; +    if (OutStr[0] == '\n') +      OutStr.erase(OutStr.begin()); -} // end namespace llvm +    // Process string output to make it nicer... +    for (unsigned i = 0; i != OutStr.length(); ++i) +      if (OutStr[i] == '\n') { // Left justify +        OutStr[i] = '\\'; +        OutStr.insert(OutStr.begin() + i + 1, 'l'); +      } +    return OutStr; +  } +};  void MachineFunction::viewCFG() const  {  | 
