tms34010: accept the optimizer's returned argument attribute
This commit is contained in:
1 parent
454fb4ac15
commit
a9c33665ea
3 files changed
+23
-4
No files matched your search
@@ -70,11 +70,15 @@ SDValue TMS34010TargetLowering::LowerFormalArguments(
|
||||
// elimination).
|
||||
for (unsigned i = 0, e = Ins.size(); i != e; ++i) {
|
||||
const ISD::InputArg &In = Ins[i];
|
||||
// `returned` is an optimization hint, not an ABI feature: the argument is
|
||||
// still passed in its normal stack slot, and the callee already returns
|
||||
// through the ABI's A8. The optimizer infers it for ordinary C such as
|
||||
// `int first(int a, int b) { return a; }`, so rejecting it made valid -O2
|
||||
// input uncompilable. The ABI-affecting flags stay rejected.
|
||||
if (In.Flags.isSRet() || In.Flags.isByVal() || In.Flags.isInReg() ||
|
||||
In.Flags.isNest() || In.Flags.isReturned())
|
||||
In.Flags.isNest())
|
||||
report_fatal_error(
|
||||
"M2 supports only plain arguments "
|
||||
"(no sret/byval/inreg/nest/returned)",
|
||||
"M2 supports only plain arguments (no sret/byval/inreg/nest)",
|
||||
false);
|
||||
if (In.VT != MVT::i32)
|
||||
report_fatal_error("M2 supports only i32 and pointer arguments", false);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
;
|
||||
; M2 has no sret convention. The pointer attribute must be rejected even
|
||||
; though its legalized type is a plain i32.
|
||||
; CHECK: M2 supports only plain arguments (no sret/byval/inreg/nest/returned)
|
||||
; CHECK: M2 supports only plain arguments (no sret/byval/inreg/nest)
|
||||
define void @sret_arg(ptr sret(i32) %out) {
|
||||
entry:
|
||||
store i32 0, ptr %out
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
; RUN: llc -march=tms34010 -O0 -filetype=asm < %s | FileCheck %s
|
||||
; RUN: llc -march=tms34010 -O2 -filetype=asm < %s | FileCheck %s
|
||||
;
|
||||
; `returned` is an optimizer hint, not an ABI convention: the optimizer infers
|
||||
; it for `return a`, and the argument still lives in its normal FP-relative
|
||||
; stack slot. It must not be rejected.
|
||||
define i32 @first(i32 returned %a, i32 %b) {
|
||||
entry:
|
||||
ret i32 %a
|
||||
}
|
||||
; CHECK-LABEL: _first:
|
||||
; CHECK: MOVE A13, -*SP, 1
|
||||
; CHECK: ADDI -32, A{{[0-9]+}}
|
||||
; CHECK: MOVE {{A[0-9]+}}, A8
|
||||
; CHECK: RETS 2
|
||||
Reference in new issue
Block a user