-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CIR][Basic][NFC] Add the CIR language to the Language enum #86072
[CIR][Basic][NFC] Add the CIR language to the Language enum #86072
Conversation
Created using spr 1.3.5
@llvm/pr-subscribers-clang Author: Nathan Lanza (lanza) ChangesAdd the CIR language to the Language enum and the standard usages of it. commit-id:fd12b2c2 Full diff: https://github.com/llvm/llvm-project/pull/86072.diff 7 Files Affected:
diff --git a/clang/include/clang/Basic/LangStandard.h b/clang/include/clang/Basic/LangStandard.h
index 199e24c6731603..ed9572672f0563 100644
--- a/clang/include/clang/Basic/LangStandard.h
+++ b/clang/include/clang/Basic/LangStandard.h
@@ -41,6 +41,7 @@ enum class Language : uint8_t {
RenderScript,
HIP,
HLSL,
+ CIR,
///@}
};
StringRef languageToString(Language L);
diff --git a/clang/include/clang/Driver/Types.def b/clang/include/clang/Driver/Types.def
index f72c27e1ee7019..0e0cae5fb7068d 100644
--- a/clang/include/clang/Driver/Types.def
+++ b/clang/include/clang/Driver/Types.def
@@ -90,6 +90,7 @@ TYPE("ir", LLVM_BC, INVALID, "bc", phases
TYPE("lto-ir", LTO_IR, INVALID, "s", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
TYPE("lto-bc", LTO_BC, INVALID, "o", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
+TYPE("cir", CIR, INVALID, "cir", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
// Misc.
TYPE("ast", AST, INVALID, "ast", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
TYPE("ifs", IFS, INVALID, "ifs", phases::IfsMerge)
diff --git a/clang/lib/Basic/LangStandards.cpp b/clang/lib/Basic/LangStandards.cpp
index cb2c0772349982..c8c9292abcb22b 100644
--- a/clang/lib/Basic/LangStandards.cpp
+++ b/clang/lib/Basic/LangStandards.cpp
@@ -21,6 +21,8 @@ StringRef clang::languageToString(Language L) {
return "Asm";
case Language::LLVM_IR:
return "LLVM IR";
+ case Language::CIR:
+ return "ClangIR";
case Language::C:
return "C";
case Language::CXX:
@@ -92,6 +94,7 @@ LangStandard::Kind clang::getDefaultLanguageStandard(clang::Language Lang,
switch (Lang) {
case Language::Unknown:
case Language::LLVM_IR:
+ case Language::CIR:
llvm_unreachable("Invalid input kind!");
case Language::OpenCL:
return LangStandard::lang_opencl12;
diff --git a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
index 349b93e2a2326f..545860acb7db80 100644
--- a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -208,6 +208,7 @@ StringRef getLanguageName(Language Lang) {
case Language::Unknown:
case Language::Asm:
case Language::LLVM_IR:
+ case Language::CIR:
llvm_unreachable("Unsupported language kind");
}
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 0df6a82ccd8933..7bd91d4791ecf0 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -2757,6 +2757,9 @@ static void GenerateFrontendArgs(const FrontendOptions &Opts,
case Language::HLSL:
Lang = "hlsl";
break;
+ case Language::CIR:
+ Lang = "cir";
+ break;
}
GenerateArg(Consumer, OPT_x,
@@ -2958,6 +2961,7 @@ static bool ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
.Cases("ast", "pcm", "precompiled-header",
InputKind(Language::Unknown, InputKind::Precompiled))
.Case("ir", Language::LLVM_IR)
+ .Case("cir", Language::CIR)
.Default(Language::Unknown);
if (DashX.isUnknown())
@@ -3323,6 +3327,7 @@ static bool IsInputCompatibleWithStandard(InputKind IK,
switch (IK.getLanguage()) {
case Language::Unknown:
case Language::LLVM_IR:
+ case Language::CIR:
llvm_unreachable("should not parse language flags for this input");
case Language::C:
@@ -3388,6 +3393,8 @@ static StringRef GetInputKindName(InputKind IK) {
return "Asm";
case Language::LLVM_IR:
return "LLVM IR";
+ case Language::CIR:
+ return "Clang IR";
case Language::HLSL:
return "HLSL";
@@ -3403,7 +3410,8 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions &Opts,
const llvm::Triple &T,
InputKind IK) {
if (IK.getFormat() == InputKind::Precompiled ||
- IK.getLanguage() == Language::LLVM_IR) {
+ IK.getLanguage() == Language::LLVM_IR ||
+ IK.getLanguage() == Language::CIR) {
if (Opts.ObjCAutoRefCount)
GenerateArg(Consumer, OPT_fobjc_arc);
if (Opts.PICLevel != 0)
@@ -3689,7 +3697,8 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
unsigned NumErrorsBefore = Diags.getNumErrors();
if (IK.getFormat() == InputKind::Precompiled ||
- IK.getLanguage() == Language::LLVM_IR) {
+ IK.getLanguage() == Language::LLVM_IR ||
+ IK.getLanguage() == Language::CIR) {
// ObjCAAutoRefCount and Sanitize LangOpts are used to setup the
// PassManager in BackendUtil.cpp. They need to be initialized no matter
// what the input type is.
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp
index 81fcd8d5ae9bd3..3fd1cdd3b47942 100644
--- a/clang/lib/Frontend/FrontendActions.cpp
+++ b/clang/lib/Frontend/FrontendActions.cpp
@@ -1083,6 +1083,7 @@ void PrintPreambleAction::ExecuteAction() {
case Language::CUDA:
case Language::HIP:
case Language::HLSL:
+ case Language::CIR:
break;
case Language::Unknown:
diff --git a/clang/lib/Frontend/FrontendOptions.cpp b/clang/lib/Frontend/FrontendOptions.cpp
index bf83b27c1367ef..32ed99571e85d2 100644
--- a/clang/lib/Frontend/FrontendOptions.cpp
+++ b/clang/lib/Frontend/FrontendOptions.cpp
@@ -34,5 +34,6 @@ InputKind FrontendOptions::getInputKindForExtension(StringRef Extension) {
.Case("hip", Language::HIP)
.Cases("ll", "bc", Language::LLVM_IR)
.Case("hlsl", Language::HLSL)
+ .Case("cir", Language::CIR)
.Default(Language::Unknown);
}
|
Created using spr 1.3.5 [skip ci]
Created using spr 1.3.5
Created using spr 1.3.5 [skip ci]
Could you remove the commit-id line from the commit message, as it doesn’t seem relevant? |
That's spr's bookkeeping. It doesn't make it into the final commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Created using spr 1.3.5 [skip ci]
Created using spr 1.3.5
Add the CIR language to the Language enum and the standard usages of it. commit-id:fd12b2c2 Reviewers: bcardosolopes, AaronBallman, erichkeane Reviewed By: AaronBallman, bcardosolopes Pull Request: llvm#86072
Add the CIR language to the Language enum and the standard usages of it.
commit-id:fd12b2c2