Mercurial > hg > CbC > CbC_llvm
comparison lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp @ 100:7d135dc70f03 LLVM 3.9
LLVM 3.9
author | Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 26 Jan 2016 22:53:40 +0900 |
parents | afa8332a0e37 |
children | 1172e4bd9c6f |
comparison
equal
deleted
inserted
replaced
96:6418606d0ead | 100:7d135dc70f03 |
---|---|
20 #include "llvm/IR/DebugInfo.h" | 20 #include "llvm/IR/DebugInfo.h" |
21 #include "llvm/IR/Function.h" | 21 #include "llvm/IR/Function.h" |
22 #include "llvm/IR/Intrinsics.h" | 22 #include "llvm/IR/Intrinsics.h" |
23 #include "llvm/Support/Debug.h" | 23 #include "llvm/Support/Debug.h" |
24 #include "llvm/Support/GraphWriter.h" | 24 #include "llvm/Support/GraphWriter.h" |
25 #include "llvm/Support/Printable.h" | |
25 #include "llvm/Support/raw_ostream.h" | 26 #include "llvm/Support/raw_ostream.h" |
26 #include "llvm/Target/TargetInstrInfo.h" | 27 #include "llvm/Target/TargetInstrInfo.h" |
27 #include "llvm/Target/TargetIntrinsicInfo.h" | 28 #include "llvm/Target/TargetIntrinsicInfo.h" |
28 #include "llvm/Target/TargetMachine.h" | 29 #include "llvm/Target/TargetMachine.h" |
29 #include "llvm/Target/TargetRegisterInfo.h" | 30 #include "llvm/Target/TargetRegisterInfo.h" |
207 case ISD::UMIN: return "umin"; | 208 case ISD::UMIN: return "umin"; |
208 case ISD::UMAX: return "umax"; | 209 case ISD::UMAX: return "umax"; |
209 | 210 |
210 case ISD::FPOWI: return "fpowi"; | 211 case ISD::FPOWI: return "fpowi"; |
211 case ISD::SETCC: return "setcc"; | 212 case ISD::SETCC: return "setcc"; |
213 case ISD::SETCCE: return "setcce"; | |
212 case ISD::SELECT: return "select"; | 214 case ISD::SELECT: return "select"; |
213 case ISD::VSELECT: return "vselect"; | 215 case ISD::VSELECT: return "vselect"; |
214 case ISD::SELECT_CC: return "select_cc"; | 216 case ISD::SELECT_CC: return "select_cc"; |
215 case ISD::INSERT_VECTOR_ELT: return "insert_vector_elt"; | 217 case ISD::INSERT_VECTOR_ELT: return "insert_vector_elt"; |
216 case ISD::EXTRACT_VECTOR_ELT: return "extract_vector_elt"; | 218 case ISD::EXTRACT_VECTOR_ELT: return "extract_vector_elt"; |
231 case ISD::SUBC: return "subc"; | 233 case ISD::SUBC: return "subc"; |
232 case ISD::SUBE: return "sube"; | 234 case ISD::SUBE: return "sube"; |
233 case ISD::SHL_PARTS: return "shl_parts"; | 235 case ISD::SHL_PARTS: return "shl_parts"; |
234 case ISD::SRA_PARTS: return "sra_parts"; | 236 case ISD::SRA_PARTS: return "sra_parts"; |
235 case ISD::SRL_PARTS: return "srl_parts"; | 237 case ISD::SRL_PARTS: return "srl_parts"; |
236 case ISD::UABSDIFF: return "uabsdiff"; | |
237 case ISD::SABSDIFF: return "sabsdiff"; | |
238 | 238 |
239 // Conversion operators. | 239 // Conversion operators. |
240 case ISD::SIGN_EXTEND: return "sign_extend"; | 240 case ISD::SIGN_EXTEND: return "sign_extend"; |
241 case ISD::ZERO_EXTEND: return "zero_extend"; | 241 case ISD::ZERO_EXTEND: return "zero_extend"; |
242 case ISD::ANY_EXTEND: return "any_extend"; | 242 case ISD::ANY_EXTEND: return "any_extend"; |
307 case ISD::DEBUGTRAP: return "debugtrap"; | 307 case ISD::DEBUGTRAP: return "debugtrap"; |
308 case ISD::LIFETIME_START: return "lifetime.start"; | 308 case ISD::LIFETIME_START: return "lifetime.start"; |
309 case ISD::LIFETIME_END: return "lifetime.end"; | 309 case ISD::LIFETIME_END: return "lifetime.end"; |
310 case ISD::GC_TRANSITION_START: return "gc_transition.start"; | 310 case ISD::GC_TRANSITION_START: return "gc_transition.start"; |
311 case ISD::GC_TRANSITION_END: return "gc_transition.end"; | 311 case ISD::GC_TRANSITION_END: return "gc_transition.end"; |
312 case ISD::GET_DYNAMIC_AREA_OFFSET: return "get.dynamic.area.offset"; | |
312 | 313 |
313 // Bit manipulation | 314 // Bit manipulation |
315 case ISD::BITREVERSE: return "bitreverse"; | |
314 case ISD::BSWAP: return "bswap"; | 316 case ISD::BSWAP: return "bswap"; |
315 case ISD::CTPOP: return "ctpop"; | 317 case ISD::CTPOP: return "ctpop"; |
316 case ISD::CTTZ: return "cttz"; | 318 case ISD::CTTZ: return "cttz"; |
317 case ISD::CTTZ_ZERO_UNDEF: return "cttz_zero_undef"; | 319 case ISD::CTTZ_ZERO_UNDEF: return "cttz_zero_undef"; |
318 case ISD::CTLZ: return "ctlz"; | 320 case ISD::CTLZ: return "ctlz"; |
319 case ISD::CTLZ_ZERO_UNDEF: return "ctlz_zero_undef"; | 321 case ISD::CTLZ_ZERO_UNDEF: return "ctlz_zero_undef"; |
320 | 322 |
321 // Trampolines | 323 // Trampolines |
322 case ISD::INIT_TRAMPOLINE: return "init_trampoline"; | 324 case ISD::INIT_TRAMPOLINE: return "init_trampoline"; |
323 case ISD::ADJUST_TRAMPOLINE: return "adjust_trampoline"; | 325 case ISD::ADJUST_TRAMPOLINE: return "adjust_trampoline"; |
324 | 326 |
325 case ISD::CONDCODE: | 327 case ISD::CONDCODE: |
364 case ISD::POST_INC: return "<post-inc>"; | 366 case ISD::POST_INC: return "<post-inc>"; |
365 case ISD::POST_DEC: return "<post-dec>"; | 367 case ISD::POST_DEC: return "<post-dec>"; |
366 } | 368 } |
367 } | 369 } |
368 | 370 |
369 namespace { | 371 static Printable PrintNodeId(const SDNode &Node) { |
370 class PrintNodeId { | 372 return Printable([&Node](raw_ostream &OS) { |
371 const SDNode &Node; | |
372 public: | |
373 explicit PrintNodeId(const SDNode &Node) | |
374 : Node(Node) {} | |
375 void print(raw_ostream &OS) const { | |
376 #ifndef NDEBUG | 373 #ifndef NDEBUG |
377 OS << 't' << Node.PersistentId; | 374 OS << 't' << Node.PersistentId; |
378 #else | 375 #else |
379 OS << (const void*)&Node; | 376 OS << (const void*)&Node; |
380 #endif | 377 #endif |
381 } | 378 }); |
382 }; | |
383 | |
384 static inline raw_ostream &operator<<(raw_ostream &OS, const PrintNodeId &P) { | |
385 P.print(OS); | |
386 return OS; | |
387 } | |
388 } | 379 } |
389 | 380 |
390 void SDNode::dump() const { dump(nullptr); } | 381 void SDNode::dump() const { dump(nullptr); } |
391 void SDNode::dump(const SelectionDAG *G) const { | 382 void SDNode::dump(const SelectionDAG *G) const { |
392 print(dbgs(), G); | 383 print(dbgs(), G); |
602 void SelectionDAG::dump() const { | 593 void SelectionDAG::dump() const { |
603 dbgs() << "SelectionDAG has " << AllNodes.size() << " nodes:\n"; | 594 dbgs() << "SelectionDAG has " << AllNodes.size() << " nodes:\n"; |
604 | 595 |
605 for (allnodes_const_iterator I = allnodes_begin(), E = allnodes_end(); | 596 for (allnodes_const_iterator I = allnodes_begin(), E = allnodes_end(); |
606 I != E; ++I) { | 597 I != E; ++I) { |
607 const SDNode *N = I; | 598 const SDNode *N = &*I; |
608 if (!N->hasOneUse() && N != getRoot().getNode() && | 599 if (!N->hasOneUse() && N != getRoot().getNode() && |
609 (!shouldPrintInline(*N) || N->use_empty())) | 600 (!shouldPrintInline(*N) || N->use_empty())) |
610 DumpNodes(N, 2, this); | 601 DumpNodes(N, 2, this); |
611 } | 602 } |
612 | 603 |
621 print_details(OS, G); | 612 print_details(OS, G); |
622 } | 613 } |
623 | 614 |
624 static bool printOperand(raw_ostream &OS, const SelectionDAG *G, | 615 static bool printOperand(raw_ostream &OS, const SelectionDAG *G, |
625 const SDValue Value) { | 616 const SDValue Value) { |
626 if (shouldPrintInline(*Value.getNode())) { | 617 if (!Value.getNode()) { |
618 OS << "<null>"; | |
619 return false; | |
620 } else if (shouldPrintInline(*Value.getNode())) { | |
627 OS << Value->getOperationName(G) << ':'; | 621 OS << Value->getOperationName(G) << ':'; |
628 Value->print_types(OS, G); | 622 Value->print_types(OS, G); |
629 Value->print_details(OS, G); | 623 Value->print_details(OS, G); |
630 return true; | 624 return true; |
631 } else { | 625 } else { |