[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/CallingConvLower.cpp

Chris Lattner sabre at nondot.org
Tue Feb 27 22:56:36 PST 2007



Changes in directory llvm/lib/CodeGen/SelectionDAG:

CallingConvLower.cpp updated: 1.2 -> 1.3
---
Log message:

add methods to analyze calls and formals.


---
Diffs of the changes:  (+34 -0)

 CallingConvLower.cpp |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/CallingConvLower.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/CallingConvLower.cpp:1.2 llvm/lib/CodeGen/SelectionDAG/CallingConvLower.cpp:1.3
--- llvm/lib/CodeGen/SelectionDAG/CallingConvLower.cpp:1.2	Mon Feb 26 23:13:54 2007
+++ llvm/lib/CodeGen/SelectionDAG/CallingConvLower.cpp	Wed Feb 28 00:56:20 2007
@@ -13,6 +13,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/CodeGen/CallingConvLower.h"
+#include "llvm/CodeGen/SelectionDAGNodes.h"
 #include "llvm/Target/MRegisterInfo.h"
 #include "llvm/Target/TargetMachine.h"
 using namespace llvm;
@@ -35,3 +36,36 @@
     for (; (Reg = *RegAliases); ++RegAliases)
       UsedRegs[Reg/32] |= 1 << (Reg&31);
 }
+
+/// AnalyzeCallOperands - Analyze an ISD::CALL node, incorporating info
+/// about the passed values into this state.
+void CCState::AnalyzeCallOperands(SDNode *TheCall, CCAssignFn Fn) {
+  unsigned NumOps = (TheCall->getNumOperands() - 5) / 2;
+  for (unsigned i = 0; i != NumOps; ++i) {
+    MVT::ValueType ArgVT = TheCall->getOperand(5+2*i).getValueType();
+    SDOperand FlagOp = TheCall->getOperand(5+2*i+1);
+    unsigned ArgFlags =cast<ConstantSDNode>(FlagOp)->getValue();
+    if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) {
+      cerr << "Call operand #" << i << " has unhandled type "
+           << MVT::getValueTypeString(ArgVT) << "\n";
+      abort();
+    }
+  }
+}
+
+/// AnalyzeFormalArguments - Analyze an ISD::FORMAL_ARGUMENTS node,
+/// incorporating info about the formals into this state.
+void CCState::AnalyzeFormalArguments(SDNode *TheArgs, CCAssignFn Fn) {
+  unsigned NumArgs = TheArgs->getNumValues()-1;
+
+  for (unsigned i = 0; i != NumArgs; ++i) {
+    MVT::ValueType ArgVT = TheArgs->getValueType(i);
+    SDOperand FlagOp = TheArgs->getOperand(3+i);
+    unsigned ArgFlags = cast<ConstantSDNode>(FlagOp)->getValue();
+    if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) {
+      cerr << "Formal argument #" << i << " has unhandled type "
+           << MVT::getValueTypeString(ArgVT) << "\n";
+      abort();
+    }
+  }
+}






More information about the llvm-commits mailing list