diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2006-10-06 17:26:30 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2006-10-06 17:26:30 +0000 |
commit | af1dabef358895da483617b6f5cbd25b60b6f410 (patch) | |
tree | 437cbee7f53e9b545c850b84812847755dc44c02 | |
parent | 1b5076887e32f9a16a1f65f3ce9abf11c31abcd7 (diff) |
fix some bugs affecting functions with no arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30767 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/ARM/ARMISelDAGToDAG.cpp | 6 | ||||
-rw-r--r-- | test/CodeGen/ARM/call.ll | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/Target/ARM/ARMISelDAGToDAG.cpp b/lib/Target/ARM/ARMISelDAGToDAG.cpp index 107ce5c543..167c052c33 100644 --- a/lib/Target/ARM/ARMISelDAGToDAG.cpp +++ b/lib/Target/ARM/ARMISelDAGToDAG.cpp @@ -181,6 +181,8 @@ public: } unsigned getStackSize(void) { int last = is_reg.size() - 1; + if (last < 0) + return 0; if (isRegister(last)) return 0; return getOffset(last) + MVT::getSizeInBits(getType(last))/8; @@ -193,7 +195,7 @@ public: last--; return last; } - unsigned lastRegNum(void) { + int lastRegNum(void) { int l = lastRegArg(); if (l < 0) return -1; @@ -264,7 +266,7 @@ static SDOperand LowerCALL(SDOperand Op, SelectionDAG &DAG) { // Build a sequence of copy-to-reg nodes chained together with token chain // and flag operands which copy the outgoing args into the appropriate regs. SDOperand InFlag; - for (unsigned i = 0, e = Layout.lastRegArg(); i <= e; ++i) { + for (int i = 0, e = Layout.lastRegArg(); i <= e; ++i) { SDOperand Arg = Op.getOperand(5+2*i); unsigned RegNum = Layout.getRegisterNum(i); unsigned Reg1 = regs[RegNum]; diff --git a/test/CodeGen/ARM/call.ll b/test/CodeGen/ARM/call.ll index cfffa99eb0..890018396e 100644 --- a/test/CodeGen/ARM/call.ll +++ b/test/CodeGen/ARM/call.ll @@ -2,7 +2,9 @@ void %f() { entry: call void %g( int 1, int 2, int 3, int 4 ) + call void %h() ret void } declare void %g(int, int, int, int) +declare void %h() |