Split the PHINode class out from the iOther.h file into the iPHINode.h file
authorChris Lattner <sabre@nondot.org>
Mon, 3 Dec 2001 18:02:31 +0000 (18:02 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 3 Dec 2001 18:02:31 +0000 (18:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1405 91177308-0d34-0410-b5e6-96231b3b80d8

27 files changed:
include/llvm/iOther.h
include/llvm/iPHINode.h [new file with mode: 0644]
lib/Analysis/InductionVariable.cpp
lib/AsmParser/llvmAsmParser.y
lib/Bytecode/Reader/ConstantReader.cpp
lib/Bytecode/Reader/InstructionReader.cpp
lib/Bytecode/Reader/Reader.cpp
lib/Bytecode/Reader/ReaderInternals.h
lib/CodeGen/InstrSelection/InstrForest.cpp
lib/CodeGen/InstrSelection/InstrSelection.cpp
lib/ExecutionEngine/Interpreter/Execution.cpp
lib/Target/SparcV9/InstrSelection/InstrForest.cpp
lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
lib/Transforms/ExprTypeConvert.cpp
lib/Transforms/HoistPHIConstants.cpp
lib/Transforms/IPO/DeadTypeElimination.cpp
lib/Transforms/IPO/InlineSimple.cpp
lib/Transforms/IPO/MutateStructTypes.cpp
lib/Transforms/Scalar/ADCE.cpp
lib/Transforms/Scalar/ConstantProp.cpp
lib/Transforms/Scalar/DCE.cpp
lib/Transforms/Scalar/InductionVars.cpp
lib/Transforms/Scalar/SCCP.cpp
lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
lib/VMCore/AsmWriter.cpp
lib/VMCore/BasicBlock.cpp
lib/VMCore/InstrTypes.cpp

index cba41964d7a1c5dce4c05d98398d3f1d70eb9c66..de1532d5903e4d0999cff937572f119e4b7070b0 100644 (file)
 #include "llvm/InstrTypes.h"
 #include "llvm/Method.h"
 
-//===----------------------------------------------------------------------===//
-//                               PHINode Class
-//===----------------------------------------------------------------------===//
-
-// PHINode - The PHINode class is used to represent the magical mystical PHI
-// node, that can not exist in nature, but can be synthesized in a computer
-// scientist's overactive imagination.
-//
-class PHINode : public Instruction {
-  PHINode(const PHINode &PN);
-public:
-  PHINode(const Type *Ty, const string &Name = "");
-
-  virtual Instruction *clone() const { return new PHINode(*this); }
-  virtual const char *getOpcodeName() const { return "phi"; }
-
-  // getNumIncomingValues - Return the number of incoming edges the PHI node has
-  inline unsigned getNumIncomingValues() const { return Operands.size()/2; }
-
-  // getIncomingValue - Return incoming value #x
-  inline const Value *getIncomingValue(unsigned i) const {
-    return Operands[i*2];
-  }
-  inline Value *getIncomingValue(unsigned i) {
-    return Operands[i*2];
-  }
-  inline void setIncomingValue(unsigned i, Value *V) {
-    Operands[i*2] = V;
-  }
-
-  // getIncomingBlock - Return incoming basic block #x
-  inline const BasicBlock *getIncomingBlock(unsigned i) const { 
-    return cast<const BasicBlock>(Operands[i*2+1]);
-  }
-  inline BasicBlock *getIncomingBlock(unsigned i) { 
-    return cast<BasicBlock>(Operands[i*2+1]);
-  }
-  inline void setIncomingBlock(unsigned i, BasicBlock *BB) {
-    Operands[i*2+1] = BB;
-  }
-
-  // addIncoming - Add an incoming value to the end of the PHI list
-  void addIncoming(Value *D, BasicBlock *BB);
-
-  // removeIncomingValue - Remove an incoming value.  This is useful if a
-  // predecessor basic block is deleted.  The value removed is returned.
-  Value *removeIncomingValue(const BasicBlock *BB);
-
-  // getBasicBlockIndex - Return the first index of the specified basic 
-  // block in the value list for this PHI.  Returns -1 if no instance.
-  //
-  int getBasicBlockIndex(const BasicBlock *BB) const {
-    for (unsigned i = 0; i < Operands.size()/2; ++i) 
-      if (getIncomingBlock(i) == BB) return i;
-    return -1;
-  }
-
-  // Methods for support type inquiry through isa, cast, and dyn_cast:
-  static inline bool classof(const PHINode *) { return true; }
-  static inline bool classof(const Instruction *I) {
-    return I->getOpcode() == Instruction::PHINode; 
-  }
-  static inline bool classof(const Value *V) {
-    return isa<Instruction>(V) && classof(cast<Instruction>(V));
-  }
-};
-
-
 //===----------------------------------------------------------------------===//
 //                                 CastInst Class
 //===----------------------------------------------------------------------===//
diff --git a/include/llvm/iPHINode.h b/include/llvm/iPHINode.h
new file mode 100644 (file)
index 0000000..66afac6
--- /dev/null
@@ -0,0 +1,80 @@
+//===-- llvm/iPHINode.h - PHI instruction definition -------------*- C++ -*--=//
+//
+// This file defines the PHINode class.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_IPHINODE_H
+#define LLVM_IPHINODE_H
+
+#include "llvm/Instruction.h"
+class BasicBlock;
+
+//===----------------------------------------------------------------------===//
+//                               PHINode Class
+//===----------------------------------------------------------------------===//
+
+// PHINode - The PHINode class is used to represent the magical mystical PHI
+// node, that can not exist in nature, but can be synthesized in a computer
+// scientist's overactive imagination.
+//
+class PHINode : public Instruction {
+  PHINode(const PHINode &PN);
+public:
+  PHINode(const Type *Ty, const string &Name = "");
+
+  virtual Instruction *clone() const { return new PHINode(*this); }
+  virtual const char *getOpcodeName() const { return "phi"; }
+
+  // getNumIncomingValues - Return the number of incoming edges the PHI node has
+  inline unsigned getNumIncomingValues() const { return Operands.size()/2; }
+
+  // getIncomingValue - Return incoming value #x
+  inline const Value *getIncomingValue(unsigned i) const {
+    return Operands[i*2];
+  }
+  inline Value *getIncomingValue(unsigned i) {
+    return Operands[i*2];
+  }
+  inline void setIncomingValue(unsigned i, Value *V) {
+    Operands[i*2] = V;
+  }
+
+  // getIncomingBlock - Return incoming basic block #x
+  inline const BasicBlock *getIncomingBlock(unsigned i) const { 
+    return (const BasicBlock*)Operands[i*2+1].get();
+  }
+  inline BasicBlock *getIncomingBlock(unsigned i) { 
+    return (BasicBlock*)Operands[i*2+1].get();
+  }
+  inline void setIncomingBlock(unsigned i, BasicBlock *BB) {
+    Operands[i*2+1] = (Value*)BB;
+  }
+
+  // addIncoming - Add an incoming value to the end of the PHI list
+  void addIncoming(Value *D, BasicBlock *BB);
+
+  // removeIncomingValue - Remove an incoming value.  This is useful if a
+  // predecessor basic block is deleted.  The value removed is returned.
+  Value *removeIncomingValue(const BasicBlock *BB);
+
+  // getBasicBlockIndex - Return the first index of the specified basic 
+  // block in the value list for this PHI.  Returns -1 if no instance.
+  //
+  int getBasicBlockIndex(const BasicBlock *BB) const {
+    for (unsigned i = 0; i < Operands.size()/2; ++i) 
+      if (getIncomingBlock(i) == BB) return i;
+    return -1;
+  }
+
+  // Methods for support type inquiry through isa, cast, and dyn_cast:
+  static inline bool classof(const PHINode *) { return true; }
+  static inline bool classof(const Instruction *I) {
+    return I->getOpcode() == Instruction::PHINode; 
+  }
+  static inline bool classof(const Value *V) {
+    return isa<Instruction>(V) && classof(cast<Instruction>(V));
+  }
+};
+
+#endif
index b64daa25b3058f84fb593b4ffa7cead1a9f1ab72..73f4e7fe57176b73b8a211ee95fdfcb494619ae9 100644 (file)
@@ -19,7 +19,8 @@
 #include "llvm/Analysis/InductionVariable.h"
 #include "llvm/Analysis/LoopInfo.h"
 #include "llvm/Analysis/Expressions.h"
-#include "llvm/iOther.h"
+#include "llvm/iPHINode.h"
+#include "llvm/InstrTypes.h"
 #include "llvm/Type.h"
 #include "llvm/ConstPoolVals.h"
 
index 0f5c11e1eae514ad55b904a0ba05884722b78e36..b5816f20ac1dce29351710d0320da8b8f272f5a6 100644 (file)
@@ -4,12 +4,6 @@
 //
 //===------------------------------------------------------------------------=//
 
-//
-// TODO: Parse comments and add them to an internal node... so that they may
-// be saved in the bytecode format as well as everything else.  Very important
-// for a general IR format.
-//
-
 %{
 #include "ParserInternals.h"
 #include "llvm/Assembly/Parser.h"
@@ -21,6 +15,7 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/iTerminators.h"
 #include "llvm/iMemory.h"
+#include "llvm/iPHINode.h"
 #include "Support/STLExtras.h"
 #include "Support/DepthFirstIterator.h"
 #include <list>
index 405745d14adb806e9686c04d147a5b79f1638f52..21462b16d7408e33f5a5a7df5cb59d9a16b3a165 100644 (file)
@@ -8,12 +8,11 @@
 //
 //===------------------------------------------------------------------------===
 
+#include "ReaderInternals.h"
 #include "llvm/Module.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/ConstPoolVals.h"
-#include "llvm/DerivedTypes.h"
 #include "llvm/GlobalVariable.h"
-#include "ReaderInternals.h"
 #include <algorithm>
 
 
index c59d147c2401e4c23e7014c10618595ef86ddff0..a80f656d0dd45c392f4f62fe31db0545b74113b1 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/iOther.h"
+#include "ReaderInternals.h"
 #include "llvm/iTerminators.h"
 #include "llvm/iMemory.h"
-#include "llvm/DerivedTypes.h"
-#include "ReaderInternals.h"
+#include "llvm/iPHINode.h"
+#include "llvm/iOther.h"
 
 bool BytecodeParser::ParseRawInst(const uchar *&Buf, const uchar *EndBuf, 
                                  RawInst &Result) {
index 7f02b9339f83375d5bb6fade212a4b38c71860d2..2766b3485ed0f8320e1363dbb5c3f4c2344e9b84 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
+#include "ReaderInternals.h"
 #include "llvm/Bytecode/Reader.h"
 #include "llvm/Bytecode/Format.h"
 #include "llvm/GlobalVariable.h"
 #include "llvm/Module.h"
 #include "llvm/BasicBlock.h"
-#include "llvm/DerivedTypes.h"
 #include "llvm/ConstPoolVals.h"
+#include "llvm/iPHINode.h"
 #include "llvm/iOther.h"
-#include "ReaderInternals.h"
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
index fb34169d79501e5843bd1d2d6bd93cff707289aa..b3977f6c123b342d8c46b56956182f4f2ea43fb2 100644 (file)
@@ -11,6 +11,7 @@
 #include "llvm/SymTabValue.h"
 #include "llvm/Method.h"
 #include "llvm/Instruction.h"
+#include "llvm/DerivedTypes.h"
 #include <map>
 #include <utility>
 #include <list>
index c6d53674ac77f293bff851947ae601689e913cf5..e0f0219a73f97c18152d87ec3bcf09369227b660 100644 (file)
@@ -26,7 +26,7 @@
 #include "llvm/Method.h"
 #include "llvm/iTerminators.h"
 #include "llvm/iMemory.h"
-#include "llvm/iOther.h"
+#include "llvm/iPHINode.h"
 #include "llvm/ConstPoolVals.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/CodeGen/MachineInstr.h"
index ce26a1d073e57948ebc565aa3f51bfdec205cb90..d0a301ce5eed799c0eb6708a0054058ea9a8fd70 100644 (file)
@@ -20,7 +20,7 @@
 #include "llvm/Instruction.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/Method.h"
-#include "llvm/iOther.h"
+#include "llvm/iPHINode.h"
 #include "llvm/Target/MachineRegInfo.h"
 #include "Support/CommandLine.h"
 #include <string.h>
index 2f0ee41c52fb6c01dbb493bdec6e76a045a8b0d6..a1547c165329bec19bab6bb32ebac0a26bee3896 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "Interpreter.h"
 #include "ExecutionAnnotations.h"
+#include "llvm/iPHINode.h"
 #include "llvm/iOther.h"
 #include "llvm/iTerminators.h"
 #include "llvm/iMemory.h"
index c6d53674ac77f293bff851947ae601689e913cf5..e0f0219a73f97c18152d87ec3bcf09369227b660 100644 (file)
@@ -26,7 +26,7 @@
 #include "llvm/Method.h"
 #include "llvm/iTerminators.h"
 #include "llvm/iMemory.h"
-#include "llvm/iOther.h"
+#include "llvm/iPHINode.h"
 #include "llvm/ConstPoolVals.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/CodeGen/MachineInstr.h"
index ce26a1d073e57948ebc565aa3f51bfdec205cb90..d0a301ce5eed799c0eb6708a0054058ea9a8fd70 100644 (file)
@@ -20,7 +20,7 @@
 #include "llvm/Instruction.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/Method.h"
-#include "llvm/iOther.h"
+#include "llvm/iPHINode.h"
 #include "llvm/Target/MachineRegInfo.h"
 #include "Support/CommandLine.h"
 #include <string.h>
index a1d92f1b26987ccccc3a1d2331e01251e4937fb6..7efe6238bec3bde982f387832305322e3a9fcff9 100644 (file)
@@ -9,6 +9,7 @@
 #include "TransformInternals.h"
 #include "llvm/Method.h"
 #include "llvm/iOther.h"
+#include "llvm/iPHINode.h"
 #include "llvm/iMemory.h"
 #include "llvm/ConstPoolVals.h"
 #include "llvm/Optimizations/ConstantHandling.h"
index d08deba7781440ada93dbd9569cf669ccd88a635..fe7cabf1614a42ba83a179b34829f207f41fa1b2 100644 (file)
@@ -6,10 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-
-
-
 #include "llvm/Transforms/HoistPHIConstants.h"
+#include "llvm/iPHINode.h"
 #include "llvm/iOther.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/Method.h"
index e02c022dbb24b903f6656e9de3c17b420174d977..f29ae29e0b3ac50b286282dd137967be47eafa8d 100644 (file)
 #include "TransformInternals.h"
 #include "llvm/SymbolTable.h"
 #include "llvm/DerivedTypes.h"
-#include "llvm/iOther.h"
+#include "llvm/iPHINode.h"
 #include "llvm/iMemory.h"
 #include "llvm/iTerminators.h"
+#include "llvm/iOther.h"
 #include <algorithm>
 
 static const Type *PtrArrSByte = 0; // '[sbyte]*' type
index bc320ee330f1a62b1def46d299f18e9026ba848b..e54e0d9b7f4b5a5669b58fb390cc50f2f5189ec6 100644 (file)
@@ -23,6 +23,7 @@
 #include "llvm/Module.h"
 #include "llvm/Method.h"
 #include "llvm/iTerminators.h"
+#include "llvm/iPHINode.h"
 #include "llvm/iOther.h"
 #include <algorithm>
 #include <map>
index fd1f46d0fa2ff11d4f9da545d2b27263fd8decfb..a433e26ec54e819c481fc7c653aa9fc9b632541a 100644 (file)
 #include "llvm/Method.h"
 #include "llvm/GlobalVariable.h"
 #include "llvm/SymbolTable.h"
-#include "llvm/iOther.h"
+#include "llvm/iPHINode.h"
 #include "llvm/iMemory.h"
 #include "llvm/iTerminators.h"
+#include "llvm/iOther.h"
 #include <algorithm>
 
 // To enable debugging, uncomment this...
index a5d1d12bcf85761065333630f1a15776bc4961a6..a38dbc56176fa621f0bb3c56c5a2d74c99483760 100644 (file)
@@ -12,7 +12,7 @@
 #include "llvm/Analysis/Dominators.h"
 #include "llvm/Analysis/Writer.h"
 #include "llvm/iTerminators.h"
-#include "llvm/iOther.h"
+#include "llvm/iPHINode.h"
 #include "Support/STLExtras.h"
 #include "Support/DepthFirstIterator.h"
 #include <set>
index 15be76343e13300082b732d30a94a1a1f6636b25..bf2886871f8403e01bf446307b8226d068b147e1 100644 (file)
@@ -27,6 +27,7 @@
 #include "llvm/Method.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/iTerminators.h"
+#include "llvm/iPHINode.h"
 #include "llvm/iOther.h"
 #include "llvm/ConstPoolVals.h"
 
index caacf32d389d42ac05aaace76127caeb9cc0b8ae..e1bda22b8b90721bbbc3ded364453ee33f71a20e 100644 (file)
@@ -29,7 +29,7 @@
 #include "llvm/Method.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/iTerminators.h"
-#include "llvm/iOther.h"
+#include "llvm/iPHINode.h"
 #include "llvm/Assembly/Writer.h"
 #include "Support/STLExtras.h"
 #include <algorithm>
index 9f0513f36e8ad8871719e7575acc0b25abc5080d..7dfae486d2b5d7104dfc62114454a4ddf347f20d 100644 (file)
@@ -24,7 +24,7 @@
 #include "llvm/Analysis/IntervalPartition.h"
 #include "llvm/Assembly/Writer.h"
 #include "llvm/SymbolTable.h"
-#include "llvm/iOther.h"
+#include "llvm/iPHINode.h"
 #include "Support/STLExtras.h"
 #include <algorithm>
 
index 256fadf637123b13a7a724bef67112e190f91bee..3c699c16e0e1981a00336bc0ca3f20c2250a0f81 100644 (file)
 #include "llvm/BasicBlock.h"
 #include "llvm/ConstPoolVals.h"
 #include "llvm/InstrTypes.h"
-#include "llvm/iOther.h"
+#include "llvm/iPHINode.h"
 #include "llvm/iMemory.h"
 #include "llvm/iTerminators.h"
+#include "llvm/iOther.h"
 #include "llvm/Assembly/Writer.h"
 #include "Support/STLExtras.h"
 #include <algorithm>
index ab600bd151a7fa9c127e458811fa239620f488d4..efc7676bb714095d078a6c520add646b5eb22542 100644 (file)
@@ -9,7 +9,7 @@
 #include "llvm/BasicBlock.h"
 #include "llvm/Method.h"
 #include "llvm/iTerminators.h"
-#include "llvm/iOther.h"
+#include "llvm/iPHINode.h"
 #include "llvm/Type.h"
 
 // UnifyAllExitNodes - Unify all exit nodes of the CFG by creating a new
index 2be172324c46b948f291b95e22d891a8cb7f2dcf..9523c9428a190f42a1960b8b3ab7073966d081c2 100644 (file)
 #include "llvm/GlobalVariable.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/ConstPoolVals.h"
-#include "llvm/iOther.h"
 #include "llvm/iMemory.h"
 #include "llvm/iTerminators.h"
+#include "llvm/iPHINode.h"
+#include "llvm/iOther.h"
 #include "llvm/SymbolTable.h"
 #include "Support/StringExtras.h"
 #include "Support/STLExtras.h"
index 462b98fb87dac9100b362e587846a007ee06e329..40962ef0f3d56177c29522563c72521c291f12e0 100644 (file)
@@ -10,7 +10,7 @@
 #include "llvm/Method.h"
 #include "llvm/SymbolTable.h"
 #include "llvm/Type.h"
-#include "llvm/iOther.h"
+#include "llvm/iPHINode.h"
 #include "llvm/CodeGen/MachineInstr.h"
 
 // Instantiate Templates - This ugliness is the price we have to pay
index 9e49805d315b23a10aa09f8c29f604675086a9cd..69a703c0c7461d2443f93c033857224282e837d2 100644 (file)
@@ -5,6 +5,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/iOther.h"
+#include "llvm/iPHINode.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/Method.h"
 #include "llvm/SymbolTable.h"