Skip to content

Commit aace7bc

Browse files
rebase
Created using spr 1.3.4
2 parents 9683d8b + 0b56fc8 commit aace7bc

File tree

80 files changed

+2340
-896
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2340
-896
lines changed

clang-tools-extra/README.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ Clang frontend. These tools are kept in a separate "extra" repository to
88
allow lighter weight checkouts of the core Clang codebase.
99

1010
All discussion regarding Clang, Clang-based tools, and code in this repository
11-
should be held using the standard Clang forum:
11+
should be held using the standard Clang forums:
1212
https://discourse.llvm.org/c/clang
13+
https://discourse.llvm.org/c/clang/clang-tidy/71
14+
https://discourse.llvm.org/c/clang/clangd/34
1315

14-
Code review for this tree should take place on the standard Clang patch and
15-
commit lists:
16-
http://lists.llvm.org/mailman/listinfo/cfe-commits
16+
Code review for this tree should take place on Github:
17+
https://github.com/llvm/llvm-project/pulls?q=label%3Aclang-tools-extra
1718

1819
If you find a bug in these tools, please file it in the LLVM bug tracker:
1920
https://github.com/llvm/llvm-project/issues/

clang/include/clang/Basic/LangOptions.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -633,11 +633,6 @@ class LangOptions : public LangOptionsBase {
633633
// received as a result of a standard operator new (-fcheck-new)
634634
bool CheckNew = false;
635635

636-
// In OpenACC mode, contains a user provided override for the _OPENACC macro.
637-
// This exists so that we can override the macro value and test our incomplete
638-
// implementation on real-world examples.
639-
std::string OpenACCMacroOverride;
640-
641636
/// The HLSL root signature version for dxil.
642637
llvm::dxbc::RootSignatureVersion HLSLRootSigVer =
643638
llvm::dxbc::RootSignatureVersion::V1_1;

clang/include/clang/Driver/Options.td

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,19 +1422,6 @@ def fno_hip_emit_relocatable : Flag<["-"], "fno-hip-emit-relocatable">,
14221422
HelpText<"Do not override toolchain to compile HIP source to relocatable">;
14231423
}
14241424

1425-
// Clang specific/exclusive options for OpenACC.
1426-
def openacc_macro_override
1427-
: Separate<["-"], "fexperimental-openacc-macro-override">,
1428-
Visibility<[ClangOption, CC1Option]>,
1429-
Group<f_Group>,
1430-
HelpText<"Overrides the _OPENACC macro value for experimental testing "
1431-
"during OpenACC support development">;
1432-
def openacc_macro_override_EQ
1433-
: Joined<["-"], "fexperimental-openacc-macro-override=">,
1434-
Alias<openacc_macro_override>;
1435-
1436-
// End Clang specific/exclusive options for OpenACC.
1437-
14381425
def libomptarget_amdgpu_bc_path_EQ : Joined<["--"], "libomptarget-amdgpu-bc-path=">, Group<i_Group>,
14391426
HelpText<"Path to libomptarget-amdgcn bitcode library">;
14401427
def libomptarget_amdgcn_bc_path_EQ : Joined<["--"], "libomptarget-amdgcn-bc-path=">, Group<i_Group>,

clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
125125
mlir::Value real = emitScalarExpr(e->getArg(0));
126126
mlir::Value imag = emitScalarExpr(e->getArg(1));
127127
mlir::Value complex = builder.createComplexCreate(loc, real, imag);
128-
return RValue::get(complex);
128+
return RValue::getComplex(complex);
129129
}
130130

131131
case Builtin::BI__builtin_creal:
@@ -150,6 +150,18 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
150150
return RValue::get(imag);
151151
}
152152

153+
case Builtin::BI__builtin_conj:
154+
case Builtin::BI__builtin_conjf:
155+
case Builtin::BI__builtin_conjl:
156+
case Builtin::BIconj:
157+
case Builtin::BIconjf:
158+
case Builtin::BIconjl: {
159+
mlir::Value complex = emitComplexExpr(e->getArg(0));
160+
mlir::Value conj = builder.createUnaryOp(getLoc(e->getExprLoc()),
161+
cir::UnaryOpKind::Not, complex);
162+
return RValue::getComplex(conj);
163+
}
164+
153165
case Builtin::BI__builtin_clrsb:
154166
case Builtin::BI__builtin_clrsbl:
155167
case Builtin::BI__builtin_clrsbll:

clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ mlir::Value ComplexExprEmitter::VisitBinComma(const BinaryOperator *e) {
231231
mlir::Value ComplexExprEmitter::VisitCallExpr(const CallExpr *e) {
232232
if (e->getCallReturnType(cgf.getContext())->isReferenceType())
233233
return emitLoadOfLValue(e);
234-
235-
return cgf.emitCallExpr(e).getValue();
234+
return cgf.emitCallExpr(e).getComplexValue();
236235
}
237236

238237
mlir::Value ComplexExprEmitter::VisitCastExpr(CastExpr *e) {

clang/lib/CIR/CodeGen/CIRGenValue.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ class RValue {
5858
return value;
5959
}
6060

61+
/// Return the value of this complex value.
62+
mlir::Value getComplexValue() const {
63+
assert(isComplex() && "Not a complex!");
64+
return value;
65+
}
66+
6167
/// Return the value of the address of the aggregate.
6268
Address getAggregateAddress() const {
6369
assert(isAggregate() && "Not an aggregate!");

clang/lib/CodeGen/Targets/X86.cpp

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,13 +2470,12 @@ GetSSETypeAtOffset(llvm::Type *IRType, unsigned IROffset,
24702470
return llvm::Type::getDoubleTy(getVMContext());
24712471
}
24722472

2473-
24742473
/// GetINTEGERTypeAtOffset - The ABI specifies that a value should be passed in
2475-
/// an 8-byte GPR. This means that we either have a scalar or we are talking
2476-
/// about the high or low part of an up-to-16-byte struct. This routine picks
2477-
/// the best LLVM IR type to represent this, which may be i64 or may be anything
2478-
/// else that the backend will pass in a GPR that works better (e.g. i8, %foo*,
2479-
/// etc).
2474+
/// one or more 8-byte GPRs. This means that we either have a scalar or we are
2475+
/// talking about the high and/or low part of an up-to-16-byte struct. This
2476+
/// routine picks the best LLVM IR type to represent this, which may be i64 or
2477+
/// may be anything else that the backend will pass in GPRs that works better
2478+
/// (e.g. i8, %foo*, etc).
24802479
///
24812480
/// PrefType is an LLVM IR type that corresponds to (part of) the IR type for
24822481
/// the source type. IROffset is an offset in bytes into the LLVM IR type that
@@ -2534,6 +2533,13 @@ GetINTEGERTypeAtOffset(llvm::Type *IRType, unsigned IROffset,
25342533
SourceOffset);
25352534
}
25362535

2536+
// if we have a 128-bit integer, we can pass it safely using an i128
2537+
// so we return that
2538+
if (IRType->isIntegerTy(128)) {
2539+
assert(IROffset == 0);
2540+
return IRType;
2541+
}
2542+
25372543
// Okay, we don't have any better idea of what to pass, so we pass this in an
25382544
// integer register that isn't too big to fit the rest of the struct.
25392545
unsigned TySizeInBytes =
@@ -2591,8 +2597,7 @@ GetX86_64ByValArgumentPair(llvm::Type *Lo, llvm::Type *Hi,
25912597
return Result;
25922598
}
25932599

2594-
ABIArgInfo X86_64ABIInfo::
2595-
classifyReturnType(QualType RetTy) const {
2600+
ABIArgInfo X86_64ABIInfo::classifyReturnType(QualType RetTy) const {
25962601
// AMD64-ABI 3.2.3p4: Rule 1. Classify the return type with the
25972602
// classification algorithm.
25982603
X86_64ABIInfo::Class Lo, Hi;
@@ -2638,6 +2643,12 @@ classifyReturnType(QualType RetTy) const {
26382643
isPromotableIntegerTypeForABI(RetTy))
26392644
return ABIArgInfo::getExtend(RetTy);
26402645
}
2646+
2647+
if (ResType->isIntegerTy(128)) {
2648+
// i128 are passed directly
2649+
assert(Hi == Integer);
2650+
return ABIArgInfo::getDirect(ResType);
2651+
}
26412652
break;
26422653

26432654
// AMD64-ABI 3.2.3p4: Rule 4. If the class is SSE, the next
@@ -2783,6 +2794,11 @@ X86_64ABIInfo::classifyArgumentType(QualType Ty, unsigned freeIntRegs,
27832794
return ABIArgInfo::getExtend(Ty, CGT.ConvertType(Ty));
27842795
}
27852796

2797+
if (ResType->isIntegerTy(128)) {
2798+
assert(Hi == Integer);
2799+
++neededInt;
2800+
return ABIArgInfo::getDirect(ResType);
2801+
}
27862802
break;
27872803

27882804
// AMD64-ABI 3.2.3p3: Rule 3. If the class is SSE, the next

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3846,15 +3846,6 @@ static void RenderOpenACCOptions(const Driver &D, const ArgList &Args,
38463846
return;
38473847

38483848
CmdArgs.push_back("-fopenacc");
3849-
3850-
if (Arg *A = Args.getLastArg(options::OPT_openacc_macro_override)) {
3851-
StringRef Value = A->getValue();
3852-
int Version;
3853-
if (!Value.getAsInteger(10, Version))
3854-
A->renderAsInput(Args, CmdArgs);
3855-
else
3856-
D.Diag(diag::err_drv_clang_unsupported) << Value;
3857-
}
38583849
}
38593850

38603851
static void RenderBuiltinOptions(const ToolChain &TC, const llvm::Triple &T,

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3913,12 +3913,8 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions &Opts,
39133913
if (Opts.OpenMPCUDAMode)
39143914
GenerateArg(Consumer, OPT_fopenmp_cuda_mode);
39153915

3916-
if (Opts.OpenACC) {
3916+
if (Opts.OpenACC)
39173917
GenerateArg(Consumer, OPT_fopenacc);
3918-
if (!Opts.OpenACCMacroOverride.empty())
3919-
GenerateArg(Consumer, OPT_openacc_macro_override,
3920-
Opts.OpenACCMacroOverride);
3921-
}
39223918

39233919
// The arguments used to set Optimize, OptimizeSize and NoInlineDefine are
39243920
// generated from CodeGenOptions.
@@ -4424,13 +4420,9 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
44244420
Args.hasArg(options::OPT_fopenmp_cuda_mode);
44254421

44264422
// OpenACC Configuration.
4427-
if (Args.hasArg(options::OPT_fopenacc)) {
4423+
if (Args.hasArg(options::OPT_fopenacc))
44284424
Opts.OpenACC = true;
44294425

4430-
if (Arg *A = Args.getLastArg(options::OPT_openacc_macro_override))
4431-
Opts.OpenACCMacroOverride = A->getValue();
4432-
}
4433-
44344426
if (Arg *A = Args.getLastArg(OPT_ffp_contract)) {
44354427
StringRef Val = A->getValue();
44364428
if (Val == "fast")

clang/lib/Frontend/InitPreprocessor.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -639,16 +639,8 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
639639
}
640640
}
641641

642-
if (LangOpts.OpenACC) {
643-
// FIXME: When we have full support for OpenACC, we should set this to the
644-
// version we support. Until then, set as '1' by default, but provide a
645-
// temporary mechanism for users to override this so real-world examples can
646-
// be tested against.
647-
if (!LangOpts.OpenACCMacroOverride.empty())
648-
Builder.defineMacro("_OPENACC", LangOpts.OpenACCMacroOverride);
649-
else
650-
Builder.defineMacro("_OPENACC", "1");
651-
}
642+
if (LangOpts.OpenACC)
643+
Builder.defineMacro("_OPENACC", "202506");
652644
}
653645

654646
/// Initialize the predefined C++ language feature test macros defined in

0 commit comments

Comments
 (0)