Skip to content

Commit 4be559d

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:6be6400848ee into origin/amd-gfx:a024ca2edc29
Local branch origin/amd-gfx a024ca2 Merged main:2e6402ca2c6c into origin/amd-gfx:6216d62a0208 Remote branch main 6be6400 [LiveDebugValues][NFC] Remove TargetPassConfig from LDVImpl (llvm#131562)
2 parents a024ca2 + 6be6400 commit 4be559d

File tree

176 files changed

+59611
-1176
lines changed

Some content is hidden

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

176 files changed

+59611
-1176
lines changed

bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
244244
Inst.clear();
245245
Inst.addOperand(MCOperand::createExpr(RISCVMCExpr::create(
246246
MCSymbolRefExpr::create(Target, MCSymbolRefExpr::VK_None, *Ctx),
247-
RISCVMCExpr::VK_RISCV_CALL, *Ctx)));
247+
RISCVMCExpr::VK_CALL, *Ctx)));
248248
}
249249

250250
void createCall(MCInst &Inst, const MCSymbol *Target,
@@ -434,19 +434,19 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
434434
case ELF::R_RISCV_TLS_GOT_HI20:
435435
// The GOT is reused so no need to create GOT relocations
436436
case ELF::R_RISCV_PCREL_HI20:
437-
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_RISCV_PCREL_HI, Ctx);
437+
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_PCREL_HI, Ctx);
438438
case ELF::R_RISCV_PCREL_LO12_I:
439439
case ELF::R_RISCV_PCREL_LO12_S:
440-
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_RISCV_PCREL_LO, Ctx);
440+
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_PCREL_LO, Ctx);
441441
case ELF::R_RISCV_HI20:
442-
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_RISCV_HI, Ctx);
442+
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_HI, Ctx);
443443
case ELF::R_RISCV_LO12_I:
444444
case ELF::R_RISCV_LO12_S:
445-
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_RISCV_LO, Ctx);
445+
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_LO, Ctx);
446446
case ELF::R_RISCV_CALL:
447-
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_RISCV_CALL, Ctx);
447+
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_CALL, Ctx);
448448
case ELF::R_RISCV_CALL_PLT:
449-
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_RISCV_CALL_PLT, Ctx);
449+
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_CALL_PLT, Ctx);
450450
}
451451
}
452452

@@ -471,8 +471,8 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
471471
switch (cast<RISCVMCExpr>(ImmExpr)->getKind()) {
472472
default:
473473
return false;
474-
case RISCVMCExpr::VK_RISCV_CALL:
475-
case RISCVMCExpr::VK_RISCV_CALL_PLT:
474+
case RISCVMCExpr::VK_CALL:
475+
case RISCVMCExpr::VK_CALL_PLT:
476476
return true;
477477
}
478478
}

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,54 @@ def BrOp : CIR_Op<"br",
468468
}];
469469
}
470470

471+
//===----------------------------------------------------------------------===//
472+
// UnaryOp
473+
//===----------------------------------------------------------------------===//
474+
475+
def UnaryOpKind_Inc : I32EnumAttrCase<"Inc", 1, "inc">;
476+
def UnaryOpKind_Dec : I32EnumAttrCase<"Dec", 2, "dec">;
477+
def UnaryOpKind_Plus : I32EnumAttrCase<"Plus", 3, "plus">;
478+
def UnaryOpKind_Minus : I32EnumAttrCase<"Minus", 4, "minus">;
479+
def UnaryOpKind_Not : I32EnumAttrCase<"Not", 5, "not">;
480+
481+
def UnaryOpKind : I32EnumAttr<
482+
"UnaryOpKind",
483+
"unary operation kind",
484+
[UnaryOpKind_Inc,
485+
UnaryOpKind_Dec,
486+
UnaryOpKind_Plus,
487+
UnaryOpKind_Minus,
488+
UnaryOpKind_Not,
489+
]> {
490+
let cppNamespace = "::cir";
491+
}
492+
493+
def UnaryOp : CIR_Op<"unary", [Pure, SameOperandsAndResultType]> {
494+
let summary = "Unary operations";
495+
let description = [{
496+
`cir.unary` performs the unary operation according to
497+
the specified opcode kind: [inc, dec, plus, minus, not].
498+
499+
It requires one input operand and has one result, both types
500+
should be the same.
501+
502+
```mlir
503+
%7 = cir.unary(inc, %1) : i32 -> i32
504+
%8 = cir.unary(dec, %2) : i32 -> i32
505+
```
506+
}];
507+
508+
let results = (outs CIR_AnyType:$result);
509+
let arguments = (ins Arg<UnaryOpKind, "unary op kind">:$kind, Arg<CIR_AnyType>:$input);
510+
511+
let assemblyFormat = [{
512+
`(` $kind `,` $input `)` `:` type($input) `,` type($result) attr-dict
513+
}];
514+
515+
let hasVerifier = 1;
516+
let hasFolder = 1;
517+
}
518+
471519
//===----------------------------------------------------------------------===//
472520
// GlobalOp
473521
//===----------------------------------------------------------------------===//

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ struct MissingFeatures {
7272
static bool opFuncLinkage() { return false; }
7373
static bool opFuncVisibility() { return false; }
7474

75+
// Unary operator handling
76+
static bool opUnarySignedOverflow() { return false; }
77+
static bool opUnaryPromotionType() { return false; }
78+
7579
// Misc
7680
static bool scalarConversionOpts() { return false; }
7781
static bool tryEmitAsConstant() { return false; }
@@ -86,6 +90,11 @@ struct MissingFeatures {
8690
static bool aggValueSlot() { return false; }
8791

8892
static bool unsizedTypes() { return false; }
93+
static bool sanitizers() { return false; }
94+
static bool CGFPOptionsRAII() { return false; }
95+
96+
// Missing types
97+
static bool vectorType() { return false; }
8998
};
9099

91100
} // namespace cir

clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace dependencies {
2626

2727
/// A callback to lookup module outputs for "-fmodule-file=", "-o" etc.
2828
using LookupModuleOutputCallback =
29-
std::function<std::string(const ModuleID &, ModuleOutputKind)>;
29+
llvm::function_ref<std::string(const ModuleDeps &, ModuleOutputKind)>;
3030

3131
/// Graph of modular dependencies.
3232
using ModuleDepsGraph = std::vector<ModuleDeps>;
@@ -208,19 +208,21 @@ class CallbackActionController : public DependencyActionController {
208208
public:
209209
virtual ~CallbackActionController();
210210

211+
static std::string lookupUnreachableModuleOutput(const ModuleDeps &MD,
212+
ModuleOutputKind Kind) {
213+
llvm::report_fatal_error("unexpected call to lookupModuleOutput");
214+
};
215+
211216
CallbackActionController(LookupModuleOutputCallback LMO)
212217
: LookupModuleOutput(std::move(LMO)) {
213218
if (!LookupModuleOutput) {
214-
LookupModuleOutput = [](const ModuleID &,
215-
ModuleOutputKind) -> std::string {
216-
llvm::report_fatal_error("unexpected call to lookupModuleOutput");
217-
};
219+
LookupModuleOutput = lookupUnreachableModuleOutput;
218220
}
219221
}
220222

221-
std::string lookupModuleOutput(const ModuleID &ID,
223+
std::string lookupModuleOutput(const ModuleDeps &MD,
222224
ModuleOutputKind Kind) override {
223-
return LookupModuleOutput(ID, Kind);
225+
return LookupModuleOutput(MD, Kind);
224226
}
225227

226228
private:

clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class DependencyActionController {
6868
public:
6969
virtual ~DependencyActionController();
7070

71-
virtual std::string lookupModuleOutput(const ModuleID &ID,
71+
virtual std::string lookupModuleOutput(const ModuleDeps &MD,
7272
ModuleOutputKind Kind) = 0;
7373
};
7474

clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ struct ModuleDeps {
114114
/// Whether this is a "system" module.
115115
bool IsSystem;
116116

117+
/// Whether this module is fully composed of file & module inputs from
118+
/// locations likely to stay the same across the active development and build
119+
/// cycle. For example, when all those input paths only resolve in Sysroot.
120+
///
121+
/// External paths, as opposed to virtual file paths, are always used
122+
/// for computing this value.
123+
bool IsInStableDirectories;
124+
117125
/// The path to the modulemap file which defines this module.
118126
///
119127
/// This can be used to explicitly build this module. This file will
@@ -219,6 +227,9 @@ class ModuleDepCollectorPP final : public PPCallbacks {
219227
llvm::DenseSet<const Module *> &AddedModules);
220228
void addAffectingClangModule(const Module *M, ModuleDeps &MD,
221229
llvm::DenseSet<const Module *> &AddedModules);
230+
231+
/// Add discovered module dependency for the given module.
232+
void addOneModuleDep(const Module *M, const ModuleID ID, ModuleDeps &MD);
222233
};
223234

224235
/// Collects modular and non-modular dependencies of the main file by attaching
@@ -320,6 +331,13 @@ void resetBenignCodeGenOptions(frontend::ActionKind ProgramAction,
320331
const LangOptions &LangOpts,
321332
CodeGenOptions &CGOpts);
322333

334+
/// Determine if \c Input can be resolved within a stable directory.
335+
///
336+
/// \param Directories Paths known to be in a stable location. e.g. Sysroot.
337+
/// \param Input Path to evaluate.
338+
bool isPathInStableDir(const ArrayRef<StringRef> Directories,
339+
const StringRef Input);
340+
323341
} // end namespace dependencies
324342
} // end namespace tooling
325343
} // end namespace clang

clang/lib/CIR/CodeGen/CIRGenExpr.cpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,54 @@ LValue CIRGenFunction::emitDeclRefLValue(const DeclRefExpr *e) {
165165
return LValue();
166166
}
167167

168+
LValue CIRGenFunction::emitUnaryOpLValue(const UnaryOperator *e) {
169+
UnaryOperatorKind op = e->getOpcode();
170+
171+
// __extension__ doesn't affect lvalue-ness.
172+
if (op == UO_Extension)
173+
return emitLValue(e->getSubExpr());
174+
175+
switch (op) {
176+
case UO_Deref: {
177+
cgm.errorNYI(e->getSourceRange(), "UnaryOp dereference");
178+
return LValue();
179+
}
180+
case UO_Real:
181+
case UO_Imag: {
182+
cgm.errorNYI(e->getSourceRange(), "UnaryOp real/imag");
183+
return LValue();
184+
}
185+
case UO_PreInc:
186+
case UO_PreDec: {
187+
bool isInc = e->isIncrementOp();
188+
LValue lv = emitLValue(e->getSubExpr());
189+
190+
assert(e->isPrefix() && "Prefix operator in unexpected state!");
191+
192+
if (e->getType()->isAnyComplexType()) {
193+
cgm.errorNYI(e->getSourceRange(), "UnaryOp complex inc/dec");
194+
return LValue();
195+
} else {
196+
emitScalarPrePostIncDec(e, lv, isInc, /*isPre=*/true);
197+
}
198+
199+
return lv;
200+
}
201+
case UO_Extension:
202+
llvm_unreachable("UnaryOperator extension should be handled above!");
203+
case UO_Plus:
204+
case UO_Minus:
205+
case UO_Not:
206+
case UO_LNot:
207+
case UO_AddrOf:
208+
case UO_PostInc:
209+
case UO_PostDec:
210+
case UO_Coawait:
211+
llvm_unreachable("UnaryOperator of non-lvalue kind!");
212+
}
213+
llvm_unreachable("Unknown unary operator kind!");
214+
}
215+
168216
/// Emit code to compute the specified expression which
169217
/// can have any type. The result is returned as an RValue struct.
170218
RValue CIRGenFunction::emitAnyExpr(const Expr *e) {

0 commit comments

Comments
 (0)