Skip to content

Commit bc6253c

Browse files
ilovepisvkeerthy
authored andcommitted
1 parent 99266bf commit bc6253c

File tree

7 files changed

+0
-216
lines changed

7 files changed

+0
-216
lines changed

clang/lib/Basic/Targets/LoongArch.cpp

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -393,73 +393,6 @@ bool LoongArchTargetInfo::handleTargetFeatures(
393393
return true;
394394
}
395395

396-
enum class AttrFeatureKind { Arch, Tune, NoFeature, Feature };
397-
398-
static std::pair<AttrFeatureKind, llvm::StringRef>
399-
getAttrFeatureTypeAndValue(llvm::StringRef AttrFeature) {
400-
if (auto Split = AttrFeature.split("="); !Split.second.empty()) {
401-
if (Split.first.trim() == "arch")
402-
return {AttrFeatureKind::Arch, Split.second.trim()};
403-
if (Split.first.trim() == "tune")
404-
return {AttrFeatureKind::Tune, Split.second.trim()};
405-
}
406-
if (AttrFeature.starts_with("no-"))
407-
return {AttrFeatureKind::NoFeature, AttrFeature.drop_front(3)};
408-
return {AttrFeatureKind::Feature, AttrFeature};
409-
}
410-
411-
ParsedTargetAttr
412-
LoongArchTargetInfo::parseTargetAttr(StringRef Features) const {
413-
ParsedTargetAttr Ret;
414-
if (Features == "default")
415-
return Ret;
416-
SmallVector<StringRef, 1> AttrFeatures;
417-
Features.split(AttrFeatures, ",");
418-
419-
for (auto &Feature : AttrFeatures) {
420-
auto [Kind, Value] = getAttrFeatureTypeAndValue(Feature.trim());
421-
422-
switch (Kind) {
423-
case AttrFeatureKind::Arch: {
424-
if (llvm::LoongArch::isValidArchName(Value) || Value == "la64v1.0" ||
425-
Value == "la64v1.1") {
426-
std::vector<llvm::StringRef> ArchFeatures;
427-
if (llvm::LoongArch::getArchFeatures(Value, ArchFeatures)) {
428-
Ret.Features.insert(Ret.Features.end(), ArchFeatures.begin(),
429-
ArchFeatures.end());
430-
}
431-
432-
if (!Ret.CPU.empty())
433-
Ret.Duplicate = "arch=";
434-
else if (Value == "la64v1.0" || Value == "la64v1.1")
435-
Ret.CPU = "loongarch64";
436-
else
437-
Ret.CPU = Value;
438-
} else {
439-
Ret.Features.push_back("!arch=" + Value.str());
440-
}
441-
break;
442-
}
443-
444-
case AttrFeatureKind::Tune:
445-
if (!Ret.Tune.empty())
446-
Ret.Duplicate = "tune=";
447-
else
448-
Ret.Tune = Value;
449-
break;
450-
451-
case AttrFeatureKind::NoFeature:
452-
Ret.Features.push_back("-" + Value.str());
453-
break;
454-
455-
case AttrFeatureKind::Feature:
456-
Ret.Features.push_back("+" + Value.str());
457-
break;
458-
}
459-
}
460-
return Ret;
461-
}
462-
463396
bool LoongArchTargetInfo::isValidCPUName(StringRef Name) const {
464397
return llvm::LoongArch::isValidCPUName(Name);
465398
}
@@ -468,7 +401,3 @@ void LoongArchTargetInfo::fillValidCPUList(
468401
SmallVectorImpl<StringRef> &Values) const {
469402
llvm::LoongArch::fillValidCPUList(Values);
470403
}
471-
472-
bool LoongArchTargetInfo::isValidFeatureName(StringRef Name) const {
473-
return llvm::LoongArch::isValidFeatureName(Name);
474-
}

clang/lib/Basic/Targets/LoongArch.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ class LLVM_LIBRARY_VISIBILITY LoongArchTargetInfo : public TargetInfo {
101101
bool handleTargetFeatures(std::vector<std::string> &Features,
102102
DiagnosticsEngine &Diags) override;
103103

104-
ParsedTargetAttr parseTargetAttr(StringRef Str) const override;
105-
bool supportsTargetAttributeTune() const override { return true; }
106-
107104
bool
108105
initFeatureMap(llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags,
109106
StringRef CPU,
@@ -113,7 +110,6 @@ class LLVM_LIBRARY_VISIBILITY LoongArchTargetInfo : public TargetInfo {
113110

114111
bool isValidCPUName(StringRef Name) const override;
115112
void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
116-
bool isValidFeatureName(StringRef Name) const override;
117113
};
118114

119115
class LLVM_LIBRARY_VISIBILITY LoongArch32TargetInfo

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3195,17 +3195,6 @@ bool Sema::checkTargetAttr(SourceLocation LiteralLoc, StringRef AttrStr) {
31953195
}
31963196
}
31973197

3198-
if (Context.getTargetInfo().getTriple().isLoongArch()) {
3199-
for (const auto &Feature : ParsedAttrs.Features) {
3200-
StringRef CurFeature = Feature;
3201-
if (CurFeature.starts_with("!arch=")) {
3202-
StringRef ArchValue = CurFeature.split("=").second.trim();
3203-
return Diag(LiteralLoc, diag::err_attribute_unsupported)
3204-
<< "target(arch=..)" << ArchValue;
3205-
}
3206-
}
3207-
}
3208-
32093198
if (ParsedAttrs.Duplicate != "")
32103199
return Diag(LiteralLoc, diag::warn_unsupported_target_attribute)
32113200
<< Duplicate << None << ParsedAttrs.Duplicate << Target;

clang/test/CodeGen/LoongArch/targetattr.c

Lines changed: 0 additions & 92 deletions
This file was deleted.

clang/test/Sema/attr-target-loongarch.c

Lines changed: 0 additions & 25 deletions
This file was deleted.

llvm/include/llvm/TargetParser/LoongArchTargetParser.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ struct ArchInfo {
8585
};
8686

8787
bool isValidArchName(StringRef Arch);
88-
bool isValidFeatureName(StringRef Feature);
8988
bool getArchFeatures(StringRef Arch, std::vector<StringRef> &Features);
9089
bool isValidCPUName(StringRef TuneCPU);
9190
void fillValidCPUList(SmallVectorImpl<StringRef> &Values);

llvm/lib/TargetParser/LoongArchTargetParser.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,6 @@ bool LoongArch::isValidArchName(StringRef Arch) {
3434
return false;
3535
}
3636

37-
bool LoongArch::isValidFeatureName(StringRef Feature) {
38-
if (Feature.starts_with("+") || Feature.starts_with("-"))
39-
return false;
40-
for (const auto &F : AllFeatures) {
41-
StringRef CanonicalName =
42-
F.Name.starts_with("+") ? F.Name.drop_front() : F.Name;
43-
if (CanonicalName == Feature)
44-
return true;
45-
}
46-
return false;
47-
}
48-
4937
bool LoongArch::getArchFeatures(StringRef Arch,
5038
std::vector<StringRef> &Features) {
5139
for (const auto A : AllArchs) {

0 commit comments

Comments
 (0)