Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
smeenai committed Nov 7, 2024
1 parent 4c6d517 commit c9c46ca
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 36 deletions.
1 change: 0 additions & 1 deletion clang/include/clang/CIR/CIRGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class CIRGenTypes;
} // namespace CIRGen
} // namespace clang


namespace cir {
class CIRGenerator : public clang::ASTConsumer {
virtual void anchor();
Expand Down
10 changes: 5 additions & 5 deletions clang/lib/CIR/CodeGen/CIRGenBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,8 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
}

Address createBaseClassAddr(mlir::Location loc, Address addr,
mlir::Type destType, unsigned offset,
bool assumeNotNull) {
mlir::Type destType, unsigned offset,
bool assumeNotNull) {
if (destType == addr.getElementType())
return addr;

Expand All @@ -717,8 +717,8 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
}

Address createDerivedClassAddr(mlir::Location loc, Address addr,
mlir::Type destType, unsigned offset,
bool assumeNotNull) {
mlir::Type destType, unsigned offset,
bool assumeNotNull) {
if (destType == addr.getElementType())
return addr;

Expand Down Expand Up @@ -834,7 +834,7 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
/// Cast the element type of the given address to a different type,
/// preserving information like the alignment.
Address createElementBitCast(mlir::Location loc, Address addr,
mlir::Type destType) {
mlir::Type destType) {
if (destType == addr.getElementType())
return addr;

Expand Down
4 changes: 2 additions & 2 deletions clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2313,8 +2313,8 @@ buildCommonNeonCallPattern0(CIRGenFunction &cgf, llvm::StringRef intrincsName,
mlir::Value CIRGenFunction::buildCommonNeonBuiltinExpr(
unsigned builtinID, unsigned llvmIntrinsic, unsigned altLLVMIntrinsic,
const char *nameHint, unsigned modifier, const CallExpr *e,
llvm::SmallVectorImpl<mlir::Value> &ops, Address ptrOp0,
Address ptrOp1, llvm::Triple::ArchType arch) {
llvm::SmallVectorImpl<mlir::Value> &ops, Address ptrOp0, Address ptrOp1,
llvm::Triple::ArchType arch) {
// Get the last argument, which specifies the vector type.
const clang::Expr *arg = e->getArg(e->getNumArgs() - 1);
std::optional<llvm::APSInt> neonTypeConst =
Expand Down
10 changes: 5 additions & 5 deletions clang/lib/CIR/CodeGen/CIRGenCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1465,8 +1465,8 @@ const CIRGenFunctionInfo &CIRGenTypes::arrangeCXXMethodCall(

auto info = proto->getExtInfo();
return arrangeCIRFunctionInfo(GetReturnType(proto->getReturnType()),
cir::FnInfoOpts::IsInstanceMethod, argTypes, info,
paramInfos, required);
cir::FnInfoOpts::IsInstanceMethod, argTypes,
info, paramInfos, required);
}

/// Figure out the rules for calling a function with the given formal type using
Expand Down Expand Up @@ -1544,9 +1544,9 @@ CIRGenTypes::arrangeFunctionDeclaration(const FunctionDecl *FD) {
// When declaring a function without a prototype, always use a non-variadic
// type.
if (CanQual<FunctionNoProtoType> noProto = FTy.getAs<FunctionNoProtoType>()) {
return arrangeCIRFunctionInfo(noProto->getReturnType(), cir::FnInfoOpts::None,
std::nullopt, noProto->getExtInfo(), {},
RequiredArgs::All);
return arrangeCIRFunctionInfo(noProto->getReturnType(),
cir::FnInfoOpts::None, std::nullopt,
noProto->getExtInfo(), {}, RequiredArgs::All);
}

return arrangeFreeFunctionType(FTy.castAs<FunctionProtoType>());
Expand Down
6 changes: 4 additions & 2 deletions clang/lib/CIR/CodeGen/CIRGenExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2455,7 +2455,8 @@ CIRGenFunction::buildConditionalBlocks(const AbstractConditionalOperator *E,
*this, loc, b.getInsertionBlock()};
CGF.currLexScope->setAsTernary();

assert(!cir::MissingFeatures::incrementProfileCounter());
assert(
!cir::MissingFeatures::incrementProfileCounter());
eval.begin(CGF);
Info.LHS = BranchGenFunc(CGF, trueExpr);
auto lhs = Info.LHS->getPointer();
Expand All @@ -2476,7 +2477,8 @@ CIRGenFunction::buildConditionalBlocks(const AbstractConditionalOperator *E,
*this, loc, b.getInsertionBlock()};
CGF.currLexScope->setAsTernary();

assert(!cir::MissingFeatures::incrementProfileCounter());
assert(
!cir::MissingFeatures::incrementProfileCounter());
eval.begin(CGF);
Info.RHS = BranchGenFunc(CGF, falseExpr);
auto rhs = Info.RHS->getPointer();
Expand Down
3 changes: 2 additions & 1 deletion clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1971,7 +1971,8 @@ mlir::Value ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) {
llvm_unreachable("NYI");

if (E->getType()->isVectorType()) {
assert(!cir::MissingFeatures::scalableVectors() && "NYI: scalable vector init");
assert(!cir::MissingFeatures::scalableVectors() &&
"NYI: scalable vector init");
assert(!cir::MissingFeatures::vectorConstants() && "NYI: vector constants");
auto VectorType =
mlir::dyn_cast<mlir::cir::VectorType>(CGF.getCIRType(E->getType()));
Expand Down
6 changes: 4 additions & 2 deletions clang/lib/CIR/CodeGen/CIRGenFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,13 @@ void CIRGenFunction::buildAndUpdateRetAlloca(QualType ty, mlir::Location loc,
// Count the implicit return.
if (!endsWithReturn(CurFuncDecl))
++NumReturnExprs;
} else if (CurFnInfo->getReturnInfo().getKind() == cir::ABIArgInfo::Indirect) {
} else if (CurFnInfo->getReturnInfo().getKind() ==
cir::ABIArgInfo::Indirect) {
// TODO(CIR): Consider this implementation in CIRtoLLVM
llvm_unreachable("NYI");
// TODO(CIR): Consider this implementation in CIRtoLLVM
} else if (CurFnInfo->getReturnInfo().getKind() == cir::ABIArgInfo::InAlloca) {
} else if (CurFnInfo->getReturnInfo().getKind() ==
cir::ABIArgInfo::InAlloca) {
llvm_unreachable("NYI");
} else {
auto addr = buildAlloca("__retval", ty, loc, alignment);
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/CIR/CodeGen/CIRGenFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -1008,8 +1008,8 @@ class CIRGenFunction : public CIRGenTypeCache {
mlir::Value buildCommonNeonBuiltinExpr(
unsigned builtinID, unsigned llvmIntrinsic, unsigned altLLVMIntrinsic,
const char *nameHint, unsigned modifier, const CallExpr *e,
llvm::SmallVectorImpl<mlir::Value> &ops, Address ptrOp0,
Address ptrOp1, llvm::Triple::ArchType arch);
llvm::SmallVectorImpl<mlir::Value> &ops, Address ptrOp0, Address ptrOp1,
llvm::Triple::ArchType arch);

mlir::Value buildAlignmentAssumption(mlir::Value ptrValue, QualType ty,
SourceLocation loc,
Expand Down
4 changes: 3 additions & 1 deletion clang/lib/CIR/CodeGen/CIRGenFunctionInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,9 @@ class CIRGenFunctionInfo final
clang::CanQualType getReturnType() const { return getArgsBuffer()[0].type; }

cir::ABIArgInfo &getReturnInfo() { return getArgsBuffer()[0].info; }
const cir::ABIArgInfo &getReturnInfo() const { return getArgsBuffer()[0].info; }
const cir::ABIArgInfo &getReturnInfo() const {
return getArgsBuffer()[0].info;
}

bool isChainCall() const { return ChainCall; }

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CIR/CodeGen/CIRGenOpenCLRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ class CIRGenOpenCLRuntime {
const clang::VarDecl &D);
};

} // clang::CIRGen cir
} // namespace clang::CIRGen

#endif // LLVM_CLANG_LIB_CIR_CIRGENOPENCLRUNTIME_H
4 changes: 2 additions & 2 deletions clang/lib/CIR/CodeGen/CIRGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ void CIRGenerator::Initialize(ASTContext &astCtx) {
mlirCtx->getOrLoadDialect<mlir::LLVM::LLVMDialect>();
mlirCtx->getOrLoadDialect<mlir::memref::MemRefDialect>();
mlirCtx->getOrLoadDialect<mlir::omp::OpenMPDialect>();
CGM = std::make_unique<clang::CIRGen::CIRGenModule>(*mlirCtx.get(), astCtx, codeGenOpts,
Diags);
CGM = std::make_unique<clang::CIRGen::CIRGenModule>(*mlirCtx.get(), astCtx,
codeGenOpts, Diags);
auto mod = CGM->getModule();
auto layout = llvm::DataLayout(astCtx.getTargetInfo().getDataLayoutString());
setMLIRDataLayout(mod, layout);
Expand Down
3 changes: 2 additions & 1 deletion clang/lib/CIR/CodeGen/ConstantInitFuture.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class ConstantInitBuilderBase;
} // namespace clang::CIRGen

namespace llvm {
template <> struct PointerLikeTypeTraits<clang::CIRGen::ConstantInitBuilderBase *> {
template <>
struct PointerLikeTypeTraits<clang::CIRGen::ConstantInitBuilderBase *> {
using T = clang::CIRGen::ConstantInitBuilderBase *;

static inline void *getAsVoidPointer(T p) { return p; }
Expand Down
24 changes: 13 additions & 11 deletions clang/lib/CIR/CodeGen/TargetInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ class DefaultABIInfo : public ABIInfo {
if (const auto *EIT = RetTy->getAs<BitIntType>())
llvm_unreachable("NYI");

return (isPromotableIntegerTypeForABI(RetTy) ? cir::ABIArgInfo::getExtend(RetTy)
: cir::ABIArgInfo::getDirect());
return (isPromotableIntegerTypeForABI(RetTy)
? cir::ABIArgInfo::getExtend(RetTy)
: cir::ABIArgInfo::getDirect());
}

cir::ABIArgInfo classifyArgumentType(QualType Ty) const {
Expand Down Expand Up @@ -116,7 +117,7 @@ class AArch64ABIInfo : public ABIInfo {

cir::ABIArgInfo classifyReturnType(QualType RetTy, bool IsVariadic) const;
cir::ABIArgInfo classifyArgumentType(QualType RetTy, bool IsVariadic,
unsigned CallingConvention) const;
unsigned CallingConvention) const;

void computeInfo(CIRGenFunctionInfo &FI) const override {
// Top leevl CIR has unlimited arguments and return types. Lowering for ABI
Expand Down Expand Up @@ -207,8 +208,8 @@ class X86_64ABIInfo : public ABIInfo {
cir::ABIArgInfo classifyReturnType(QualType RetTy) const;

cir::ABIArgInfo classifyArgumentType(clang::QualType Ty, unsigned freeIntRegs,
unsigned &neededInt, unsigned &neededSSE,
bool isNamedArg) const;
unsigned &neededInt, unsigned &neededSSE,
bool isNamedArg) const;

mlir::Type GetINTEGERTypeAtOffset(mlir::Type CIRType, unsigned CIROffset,
QualType SourceTy,
Expand Down Expand Up @@ -270,7 +271,8 @@ class SPIRVABIInfo : public CommonSPIRABIInfo {
};
} // namespace

void clang::CIRGen::computeSPIRKernelABIInfo(CIRGenModule &CGM, CIRGenFunctionInfo &FI) {
void clang::CIRGen::computeSPIRKernelABIInfo(CIRGenModule &CGM,
CIRGenFunctionInfo &FI) {
if (CGM.getTarget().getTriple().isSPIRV())
SPIRVABIInfo(CGM.getTypes()).computeInfo(FI);
else
Expand Down Expand Up @@ -319,7 +321,7 @@ CIRGenCXXABI &ABIInfo::getCXXABI() const { return CGT.getCXXABI(); }
clang::ASTContext &ABIInfo::getContext() const { return CGT.getContext(); }

cir::ABIArgInfo X86_64ABIInfo::getIndirectResult(QualType Ty,
unsigned freeIntRegs) const {
unsigned freeIntRegs) const {
assert(false && "NYI");
}

Expand Down Expand Up @@ -366,10 +368,10 @@ mlir::Type X86_64ABIInfo::GetINTEGERTypeAtOffset(mlir::Type CIRType,
}

cir::ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty,
unsigned int freeIntRegs,
unsigned int &neededInt,
unsigned int &neededSSE,
bool isNamedArg) const {
unsigned int freeIntRegs,
unsigned int &neededInt,
unsigned int &neededSSE,
bool isNamedArg) const {
Ty = useFirstFieldIfTransparentUnion(Ty);

X86_64ABIInfo::Class Lo, Hi;
Expand Down

0 comments on commit c9c46ca

Please sign in to comment.