diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2021-02-16 20:13:02 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2021-02-16 20:13:02 +0000 |
| commit | b60736ec1405bb0a8dd40989f67ef4c93da068ab (patch) | |
| tree | 5c43fbb7c9fc45f0f87e0e6795a86267dbd12f9d /llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp | |
| parent | cfca06d7963fa0909f90483b42a6d7d194d01e08 (diff) | |
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp')
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp b/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp index daf88589bb52..c976a9c62d3b 100644 --- a/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp @@ -8,6 +8,7 @@ #include "PPCMachineFunctionInfo.h" #include "llvm/ADT/Twine.h" +#include "llvm/BinaryFormat/XCOFF.h" #include "llvm/IR/DataLayout.h" #include "llvm/MC/MCContext.h" #include "llvm/Support/CommandLine.h" @@ -63,3 +64,36 @@ bool PPCFunctionInfo::isLiveInZExt(Register VReg) const { return LiveIn.second.isZExt(); return false; } + +void PPCFunctionInfo::appendParameterType(ParamType Type) { + uint32_t CopyParamType = ParameterType; + int Bits = 0; + + // If it is fixed type, we only need to increase the FixedParamNum, for + // the bit encode of fixed type is bit of zero, we do not need to change the + // ParamType. + if (Type == FixedType) { + ++FixedParamNum; + return; + } + + ++FloatingPointParamNum; + + for (int I = 0; + I < static_cast<int>(FloatingPointParamNum + FixedParamNum - 1); ++I) { + if (CopyParamType & XCOFF::TracebackTable::ParmTypeIsFloatingBit) { + // '10'b => floating point short parameter. + // '11'b => floating point long parameter. + CopyParamType <<= 2; + Bits += 2; + } else { + // '0'b => fixed parameter. + CopyParamType <<= 1; + ++Bits; + } + } + + assert(Type != FixedType && "FixedType should already be handled."); + if (Bits < 31) + ParameterType |= Type << (30 - Bits); +} |
