diff options
author | Dale Johannesen <dalej@apple.com> | 2008-09-25 20:47:45 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2008-09-25 20:47:45 +0000 |
commit | c08a0e2f7ceaaaef071ba0aa2482a8fd7a6e27a3 (patch) | |
tree | 47df050f4b38ba844ed9163b55ac45fbf4b71a67 /lib | |
parent | 7bf6e5c674cb038d3d09af06d2bee9e8d6153966 (diff) | |
download | external_llvm-c08a0e2f7ceaaaef071ba0aa2482a8fd7a6e27a3.zip external_llvm-c08a0e2f7ceaaaef071ba0aa2482a8fd7a6e27a3.tar.gz external_llvm-c08a0e2f7ceaaaef071ba0aa2482a8fd7a6e27a3.tar.bz2 |
Accept 'inreg' attribute on x86 functions as
meaning sse_regparm (i.e. float/double values go
in XMM0 instead of ST0). Update documentation
to reflect reality.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56619 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp | 9 | ||||
-rw-r--r-- | lib/Target/X86/X86CallingConv.td | 12 |
2 files changed, 15 insertions, 6 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp index b9f1aa4..01f1f28 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp @@ -913,7 +913,8 @@ void SelectionDAGLowering::visitRet(ReturnInst &I) { MVT VT = ValueVTs[j]; // FIXME: C calling convention requires the return type to be promoted to - // at least 32-bit. But this is not necessary for non-C calling conventions. + // at least 32-bit. But this is not necessary for non-C calling + // conventions. if (VT.isInteger()) { MVT MinVT = TLI.getRegisterType(MVT::i32); if (VT.bitsLT(MinVT)) @@ -934,9 +935,13 @@ void SelectionDAGLowering::visitRet(ReturnInst &I) { getCopyToParts(DAG, SDValue(RetOp.getNode(), RetOp.getResNo() + j), &Parts[0], NumParts, PartVT, ExtendKind); + // 'inreg' on function refers to return value + ISD::ArgFlagsTy Flags = ISD::ArgFlagsTy(); + if (F->paramHasAttr(0, ParamAttr::InReg)) + Flags.setInReg(); for (unsigned i = 0; i < NumParts; ++i) { NewValues.push_back(Parts[i]); - NewValues.push_back(DAG.getArgFlags(ISD::ArgFlagsTy())); + NewValues.push_back(DAG.getArgFlags(Flags)); } } } diff --git a/lib/Target/X86/X86CallingConv.td b/lib/Target/X86/X86CallingConv.td index b98b5d9..590bc10 100644 --- a/lib/Target/X86/X86CallingConv.td +++ b/lib/Target/X86/X86CallingConv.td @@ -43,10 +43,14 @@ def RetCC_X86Common : CallingConv<[ // X86-32 C return-value convention. def RetCC_X86_32_C : CallingConv<[ - // The X86-32 calling convention returns FP values in ST0, otherwise it is the - // same as the common X86 calling conv. - CCIfType<[f32], CCAssignToReg<[ST0, ST1]>>, - CCIfType<[f64], CCAssignToReg<[ST0, ST1]>>, + // The X86-32 calling convention returns FP values in ST0, unless marked + // with "inreg" (used here to distinguish one kind of reg from another, + // weirdly; this is really the sse-regparm calling convention) in which + // case they use XMM0, otherwise it is the same as the common X86 calling + // conv. + CCIfInReg<CCIfSubtarget<"hasSSE2()", + CCIfType<[f32, f64], CCAssignToReg<[XMM0,XMM1,XMM2]>>>>, + CCIfType<[f32,f64], CCAssignToReg<[ST0, ST1]>>, CCDelegateTo<RetCC_X86Common> ]>; |