[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp ScheduleDAG.cpp SelectionDAG.cpp SelectionDAGISel.cpp

2007-01-26 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.457 - 1.458
ScheduleDAG.cpp updated: 1.116 - 1.117
SelectionDAG.cpp updated: 1.377 - 1.378
SelectionDAGISel.cpp updated: 1.344 - 1.345
---
Log message:

Make LABEL a builtin opcode.

---
Diffs of the changes:  (+11 -10)

 LegalizeDAG.cpp  |   12 ++--
 ScheduleDAG.cpp  |1 +
 SelectionDAG.cpp |2 +-
 SelectionDAGISel.cpp |6 +++---
 4 files changed, 11 insertions(+), 10 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.457 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.458
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.457 Sat Jan 20 16:35:55 2007
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Fri Jan 26 08:34:51 2007
@@ -737,9 +737,9 @@
 case TargetLowering::Expand: {
   MachineDebugInfo *DebugInfo = DAG.getMachineDebugInfo();
   bool useDEBUG_LOC = TLI.isOperationLegal(ISD::DEBUG_LOC, MVT::Other);
-  bool useDEBUG_LABEL = TLI.isOperationLegal(ISD::DEBUG_LABEL, MVT::Other);
+  bool useLABEL = TLI.isOperationLegal(ISD::LABEL, MVT::Other);
   
-  if (DebugInfo  (useDEBUG_LOC || useDEBUG_LABEL)) {
+  if (DebugInfo  (useDEBUG_LOC || useLABEL)) {
 const std::string FName =
   castStringSDNode(Node-getOperand(3))-getValue();
 const std::string DirName = 
@@ -761,7 +761,7 @@
   unsigned Col = castConstantSDNode(ColOp)-getValue();
   unsigned ID = DebugInfo-RecordLabel(Line, Col, SrcFile);
   Ops.push_back(DAG.getConstant(ID, MVT::i32));
-  Result = DAG.getNode(ISD::DEBUG_LABEL, 
MVT::Other,Ops[0],Ops.size());
+  Result = DAG.getNode(ISD::LABEL, MVT::Other,Ops[0],Ops.size());
 }
   } else {
 Result = Tmp1;  // chain
@@ -803,9 +803,9 @@
 }
 break;
 
-  case ISD::DEBUG_LABEL:
-assert(Node-getNumOperands() == 2  Invalid DEBUG_LABEL node!);
-switch (TLI.getOperationAction(ISD::DEBUG_LABEL, MVT::Other)) {
+  case ISD::LABEL:
+assert(Node-getNumOperands() == 2  Invalid LABEL node!);
+switch (TLI.getOperationAction(ISD::LABEL, MVT::Other)) {
 default: assert(0  This action is not supported yet!);
 case TargetLowering::Legal:
   Tmp1 = LegalizeOp(Node-getOperand(0));  // Legalize the chain.


Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.116 
llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.117
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.116 Wed Jan 24 01:03:39 2007
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp   Fri Jan 26 08:34:51 2007
@@ -452,6 +452,7 @@
   assert(0  This target-independent node should have been selected!);
 case ISD::EntryToken: // fall thru
 case ISD::TokenFactor:
+case ISD::LABEL:
   break;
 case ISD::CopyToReg: {
   unsigned InReg;


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.377 
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.378
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.377Thu Dec  7 
14:28:15 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp  Fri Jan 26 08:34:51 2007
@@ -2691,6 +2691,7 @@
   case ISD::UNDEF: return undef;
   case ISD::MERGE_VALUES:  return mergevalues;
   case ISD::INLINEASM: return inlineasm;
+  case ISD::LABEL: return label;
   case ISD::HANDLENODE:return handlenode;
   case ISD::FORMAL_ARGUMENTS: return formal_arguments;
   case ISD::CALL:  return call;
@@ -2811,7 +2812,6 @@
   // Debug info
   case ISD::LOCATION: return location;
   case ISD::DEBUG_LOC: return debug_loc;
-  case ISD::DEBUG_LABEL: return debug_label;
 
   case ISD::CONDCODE:
 switch (castCondCodeSDNode(this)-get()) {


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.344 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.345
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.344Sat Jan 20 
18:29:25 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Fri Jan 26 08:34:51 2007
@@ -1980,7 +1980,7 @@
 DbgRegionStartInst RSI = castDbgRegionStartInst(I);
 if (DebugInfo  RSI.getContext()  DebugInfo-Verify(RSI.getContext())) {
   unsigned LabelID = DebugInfo-RecordRegionStart(RSI.getContext());
-  DAG.setRoot(DAG.getNode(ISD::DEBUG_LABEL, MVT::Other, getRoot(),
+  DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getRoot(),
   DAG.getConstant(LabelID, MVT::i32)));
 }
 
@@ -1991,7 +1991,7 @@
 DbgRegionEndInst REI = castDbgRegionEndInst(I);
 if (DebugInfo  REI.getContext()  DebugInfo-Verify(REI.getContext())) {
   unsigned LabelID = DebugInfo-RecordRegionEnd(REI.getContext());
-  DAG.setRoot(DAG.getNode(ISD::DEBUG_LABEL, MVT::Other,
+  DAG.setRoot(DAG.getNode(ISD::LABEL, 

[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp ScheduleDAG.cpp SelectionDAG.cpp SelectionDAGISel.cpp

2006-04-22 Thread Nate Begeman


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.369 - 1.370
ScheduleDAG.cpp updated: 1.81 - 1.82
SelectionDAG.cpp updated: 1.301 - 1.302
SelectionDAGISel.cpp updated: 1.223 - 1.224
---
Log message:

JumpTable support!  What this represents is working asm and jit support for
x86 and ppc for 100% dense switch statements when relocations are non-PIC.
This support will be extended and enhanced in the coming days to support
PIC, and less dense forms of jump tables.


---
Diffs of the changes:  (+185 -8)

 LegalizeDAG.cpp  |   20 ++-
 ScheduleDAG.cpp  |3 +
 SelectionDAG.cpp |   26 +
 SelectionDAGISel.cpp |  144 ---
 4 files changed, 185 insertions(+), 8 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.369 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.370
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.369 Wed Apr 19 18:17:50 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Sat Apr 22 13:53:45 2006
@@ -510,6 +510,7 @@
   case ISD::Register:
   case ISD::BasicBlock:
   case ISD::TargetFrameIndex:
+  case ISD::TargetJumpTable:
   case ISD::TargetConstant:
   case ISD::TargetConstantFP:
   case ISD::TargetConstantPool:
@@ -552,7 +553,8 @@
 abort();
   case ISD::GlobalAddress:
   case ISD::ExternalSymbol:
-  case ISD::ConstantPool:   // Nothing to do.
+  case ISD::ConstantPool:
+  case ISD::JumpTable: // Nothing to do.
 switch (TLI.getOperationAction(Node-getOpcode(), Node-getValueType(0))) {
 default: assert(0  This action is not supported yet!);
 case TargetLowering::Custom:
@@ -1183,7 +1185,21 @@
 
 Result = DAG.UpdateNodeOperands(Result, Tmp1, Node-getOperand(1));
 break;
-
+  case ISD::BRIND:
+Tmp1 = LegalizeOp(Node-getOperand(0));  // Legalize the chain.
+// Ensure that libcalls are emitted before a branch.
+Tmp1 = DAG.getNode(ISD::TokenFactor, MVT::Other, Tmp1, LastCALLSEQ_END);
+Tmp1 = LegalizeOp(Tmp1);
+LastCALLSEQ_END = DAG.getEntryNode();
+
+switch (getTypeAction(Node-getOperand(1).getValueType())) {
+default: assert(0  Indirect target must be legal type (pointer)!);
+case Legal:
+  Tmp2 = LegalizeOp(Node-getOperand(1)); // Legalize the condition.
+  break;
+}
+Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2);
+break;
   case ISD::BRCOND:
 Tmp1 = LegalizeOp(Node-getOperand(0));  // Legalize the chain.
 // Ensure that libcalls are emitted before a return.


Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.81 
llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.82
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.81  Fri Mar 24 01:15:07 2006
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp   Sat Apr 22 13:53:45 2006
@@ -117,6 +117,9 @@
   } else if (FrameIndexSDNode *FI =
  dyn_castFrameIndexSDNode(Op)) {
 MI-addFrameIndexOperand(FI-getIndex());
+  } else if (JumpTableSDNode *JT =
+ dyn_castJumpTableSDNode(Op)) {
+MI-addJumpTableIndexOperand(JT-getIndex());
   } else if (ConstantPoolSDNode *CP = 
  dyn_castConstantPoolSDNode(Op)) {
 int Offset = CP-getOffset();


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.301 
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.302
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.301Thu Apr 20 
00:39:12 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp  Sat Apr 22 13:53:45 2006
@@ -387,6 +387,13 @@
   case ISD::TargetFrameIndex:
 Erased = TargetFrameIndices.erase(castFrameIndexSDNode(N)-getIndex());
 break;
+  case ISD::JumpTable:
+Erased = JumpTableIndices.erase(castJumpTableSDNode(N)-getIndex());
+break;
+  case ISD::TargetJumpTable:
+Erased = 
+  TargetJumpTableIndices.erase(castJumpTableSDNode(N)-getIndex());
+break;
   case ISD::ConstantPool:
 Erased = ConstantPoolIndices.
   erase(std::make_pair(castConstantPoolSDNode(N)-get(),
@@ -741,6 +748,22 @@
   return SDOperand(N, 0);
 }
 
+SDOperand SelectionDAG::getJumpTable(int JTI, MVT::ValueType VT) {
+  SDNode *N = JumpTableIndices[JTI];
+  if (N) return SDOperand(N, 0);
+  N = new JumpTableSDNode(JTI, VT, false);
+  AllNodes.push_back(N);
+  return SDOperand(N, 0);
+}
+
+SDOperand SelectionDAG::getTargetJumpTable(int JTI, MVT::ValueType VT) {
+  SDNode *N = TargetJumpTableIndices[JTI];
+  if (N) return SDOperand(N, 0);
+  N = new JumpTableSDNode(JTI, VT, true);
+  AllNodes.push_back(N);
+  return SDOperand(N, 0);
+}
+
 SDOperand SelectionDAG::getConstantPool(Constant *C, MVT::ValueType VT,
 unsigned Alignment,  int Offset) {
   SDNode *N = ConstantPoolIndices[std::make_pair(C,
@@ -2742,6 +2765,7 @@
   case ISD::ConstantFP:return ConstantFP;