Skip to content

Commit

Permalink
[clang][CodeGen] Break up TargetInfo.cpp [1/8]
Browse files Browse the repository at this point in the history
`CCState` is a helper class originally used by the x86 implementation
but has since been abused by other implementations.
Remove this dependency by implementing customized versions of the class
for implementations that need such functionality.

Reviewed By: efriedma, MaskRay

Differential Revision: https://reviews.llvm.org/D148089
  • Loading branch information
s-barannikov committed May 19, 2023
1 parent 8fcb4fa commit f2492f7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions clang/lib/CodeGen/TargetInfo.cpp
Expand Up @@ -9056,13 +9056,17 @@ Address HexagonABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,

namespace {
class LanaiABIInfo : public DefaultABIInfo {
struct CCState {
unsigned FreeRegs;
};

public:
LanaiABIInfo(CodeGen::CodeGenTypes &CGT) : DefaultABIInfo(CGT) {}

bool shouldUseInReg(QualType Ty, CCState &State) const;

void computeInfo(CGFunctionInfo &FI) const override {
CCState State(FI);
CCState State;
// Lanai uses 4 registers to pass arguments unless the function has the
// regparm attribute set.
if (FI.getHasRegParm()) {
Expand Down Expand Up @@ -10074,6 +10078,10 @@ SparcV9TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
namespace {

class ARCABIInfo : public DefaultABIInfo {
struct CCState {
unsigned FreeRegs;
};

public:
using DefaultABIInfo::DefaultABIInfo;

Expand All @@ -10096,7 +10104,7 @@ class ARCABIInfo : public DefaultABIInfo {
}

void computeInfo(CGFunctionInfo &FI) const override {
CCState State(FI);
CCState State;
// ARC uses 8 registers to pass arguments.
State.FreeRegs = 8;

Expand Down

0 comments on commit f2492f7

Please sign in to comment.