Skip to content

Commit d04b314

Browse files
committed
[𝘀𝗽𝗿] changes to main this commit is based on
Created using spr 1.3.4 [skip ci]
1 parent 5237193 commit d04b314

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5119,7 +5119,7 @@ def module_file_info : Flag<["-"], "module-file-info">, Flags<[]>,
51195119
HelpText<"Provide information about a particular module file">;
51205120
def mthumb : Flag<["-"], "mthumb">, Group<m_Group>;
51215121
def mtune_EQ : Joined<["-"], "mtune=">, Group<m_Group>,
5122-
HelpText<"Only supported on AArch64, PowerPC, RISC-V, SystemZ, and X86">;
5122+
HelpText<"Only supported on AArch64, PowerPC, RISC-V, SPARC, SystemZ, and X86">;
51235123
def multi__module : Flag<["-"], "multi_module">;
51245124
def multiply__defined__unused : Separate<["-"], "multiply_defined_unused">;
51255125
def multiply__defined : Separate<["-"], "multiply_defined">;

llvm/lib/Target/Sparc/SparcSubtarget.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,18 @@ using namespace llvm;
2525

2626
void SparcSubtarget::anchor() { }
2727

28-
SparcSubtarget &SparcSubtarget::initializeSubtargetDependencies(StringRef CPU,
29-
StringRef FS) {
28+
SparcSubtarget &SparcSubtarget::initializeSubtargetDependencies(
29+
StringRef CPU, StringRef TuneCPU, StringRef FS) {
3030
// Determine default and user specified characteristics
3131
std::string CPUName = std::string(CPU);
3232
if (CPUName.empty())
3333
CPUName = (Is64Bit) ? "v9" : "v8";
3434

35+
if (TuneCPU.empty())
36+
TuneCPU = CPUName;
37+
3538
// Parse features string.
36-
ParseSubtargetFeatures(CPUName, /*TuneCPU*/ CPUName, FS);
39+
ParseSubtargetFeatures(CPUName, TuneCPU, FS);
3740

3841
// Popc is a v9-only instruction.
3942
if (!IsV9)
@@ -43,10 +46,12 @@ SparcSubtarget &SparcSubtarget::initializeSubtargetDependencies(StringRef CPU,
4346
}
4447

4548
SparcSubtarget::SparcSubtarget(const Triple &TT, const std::string &CPU,
49+
const std::string &TuneCPU,
4650
const std::string &FS, const TargetMachine &TM,
4751
bool is64Bit)
48-
: SparcGenSubtargetInfo(TT, CPU, /*TuneCPU*/ CPU, FS), TargetTriple(TT),
49-
Is64Bit(is64Bit), InstrInfo(initializeSubtargetDependencies(CPU, FS)),
52+
: SparcGenSubtargetInfo(TT, CPU, TuneCPU, FS), TargetTriple(TT),
53+
Is64Bit(is64Bit),
54+
InstrInfo(initializeSubtargetDependencies(CPU, TuneCPU, FS)),
5055
TLInfo(TM, *this), FrameLowering(*this) {}
5156

5257
int SparcSubtarget::getAdjustedFrameSize(int frameSize) const {

llvm/lib/Target/Sparc/SparcSubtarget.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ class SparcSubtarget : public SparcGenSubtargetInfo {
4545

4646
public:
4747
SparcSubtarget(const Triple &TT, const std::string &CPU,
48-
const std::string &FS, const TargetMachine &TM, bool is64bit);
48+
const std::string &TuneCPU, const std::string &FS,
49+
const TargetMachine &TM, bool is64bit);
4950

5051
const SparcInstrInfo *getInstrInfo() const override { return &InstrInfo; }
5152
const TargetFrameLowering *getFrameLowering() const override {
@@ -70,7 +71,9 @@ class SparcSubtarget : public SparcGenSubtargetInfo {
7071
/// ParseSubtargetFeatures - Parses features string setting specified
7172
/// subtarget options. Definition of function is auto generated by tblgen.
7273
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS);
73-
SparcSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
74+
SparcSubtarget &initializeSubtargetDependencies(StringRef CPU,
75+
StringRef TuneCPU,
76+
StringRef FS);
7477

7578
bool is64Bit() const { return Is64Bit; }
7679

llvm/lib/Target/Sparc/SparcTargetMachine.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,13 @@ SparcTargetMachine::~SparcTargetMachine() = default;
116116
const SparcSubtarget *
117117
SparcTargetMachine::getSubtargetImpl(const Function &F) const {
118118
Attribute CPUAttr = F.getFnAttribute("target-cpu");
119+
Attribute TuneAttr = F.getFnAttribute("tune-cpu");
119120
Attribute FSAttr = F.getFnAttribute("target-features");
120121

121122
std::string CPU =
122123
CPUAttr.isValid() ? CPUAttr.getValueAsString().str() : TargetCPU;
124+
std::string TuneCPU =
125+
TuneAttr.isValid() ? TuneAttr.getValueAsString().str() : CPU;
123126
std::string FS =
124127
FSAttr.isValid() ? FSAttr.getValueAsString().str() : TargetFS;
125128

@@ -137,8 +140,8 @@ SparcTargetMachine::getSubtargetImpl(const Function &F) const {
137140
// creation will depend on the TM and the code generation flags on the
138141
// function that reside in TargetOptions.
139142
resetTargetOptions(F);
140-
I = std::make_unique<SparcSubtarget>(TargetTriple, CPU, FS, *this,
141-
this->is64Bit);
143+
I = std::make_unique<SparcSubtarget>(TargetTriple, CPU, TuneCPU, FS, *this,
144+
this->is64Bit);
142145
}
143146
return I.get();
144147
}

0 commit comments

Comments
 (0)