This reverts commit r224503.
It broke compilation of fortran through the Clang driver. Previously
`clang -c t.f` would invoke `gcc t.f` and `clang -cc1as`, but now it
tries to call `clang -cc1 t.f` which fails for obvious reasons.
llvm-svn: 224546
AnalyzeJobClass,
MigrateJobClass,
CompileJobClass,
- BackendJobClass,
AssembleJobClass,
LinkJobClass,
LipoJobClass,
}
};
-class BackendJobAction : public JobAction {
- void anchor() override;
-public:
- BackendJobAction(std::unique_ptr<Action> Input, types::ID OutputType);
-
- static bool classof(const Action *A) {
- return A->getKind() == BackendJobClass;
- }
-};
-
class AssembleJobAction : public JobAction {
void anchor() override;
public:
Preprocess,
Precompile,
Compile,
- Backend,
Assemble,
Link
};
case AnalyzeJobClass: return "analyzer";
case MigrateJobClass: return "migrator";
case CompileJobClass: return "compiler";
- case BackendJobClass: return "backend";
case AssembleJobClass: return "assembler";
case LinkJobClass: return "linker";
case LipoJobClass: return "lipo";
types::ID OutputType)
: JobAction(CompileJobClass, std::move(Input), OutputType) {}
-void BackendJobAction::anchor() {}
-
-BackendJobAction::BackendJobAction(std::unique_ptr<Action> Input,
- types::ID OutputType)
- : JobAction(BackendJobClass, std::move(Input), OutputType) {}
-
void AssembleJobAction::anchor() {}
AssembleJobAction::AssembleJobAction(std::unique_ptr<Action> Input,
(PhaseArg = DAL.getLastArg(options::OPT__SLASH_P))) {
FinalPhase = phases::Preprocess;
- // -{fsyntax-only,-analyze,emit-ast} only run up to the compiler.
+ // -{fsyntax-only,-analyze,emit-ast,S} only run up to the compiler.
} else if ((PhaseArg = DAL.getLastArg(options::OPT_fsyntax_only)) ||
(PhaseArg = DAL.getLastArg(options::OPT_module_file_info)) ||
(PhaseArg = DAL.getLastArg(options::OPT_verify_pch)) ||
(PhaseArg = DAL.getLastArg(options::OPT__migrate)) ||
(PhaseArg = DAL.getLastArg(options::OPT__analyze,
options::OPT__analyze_auto)) ||
- (PhaseArg = DAL.getLastArg(options::OPT_emit_ast))) {
+ (PhaseArg = DAL.getLastArg(options::OPT_emit_ast)) ||
+ (PhaseArg = DAL.getLastArg(options::OPT_S))) {
FinalPhase = phases::Compile;
- // -S only runs up to the backend.
- } else if ((PhaseArg = DAL.getLastArg(options::OPT_S))) {
- FinalPhase = phases::Backend;
-
// -c only runs up to the assembler.
} else if ((PhaseArg = DAL.getLastArg(options::OPT_c))) {
FinalPhase = phases::Assemble;
/// \brief Check whether the given input tree contains any compilation or
/// assembly actions.
static bool ContainsCompileOrAssembleAction(const Action *A) {
- if (isa<CompileJobAction>(A) ||
- isa<BackendJobAction>(A) ||
- isa<AssembleJobAction>(A))
+ if (isa<CompileJobAction>(A) || isa<AssembleJobAction>(A))
return true;
for (Action::const_iterator it = A->begin(), ie = A->end(); it != ie; ++it)
if (Args.hasArg(options::OPT_verify_pch))
return llvm::make_unique<VerifyPCHJobAction>(std::move(Input),
types::TY_Nothing);
- return llvm::make_unique<CompileJobAction>(std::move(Input),
- types::TY_LLVM_BC);
- }
- case phases::Backend: {
if (IsUsingLTO(Args)) {
types::ID Output =
Args.hasArg(options::OPT_S) ? types::TY_LTO_IR : types::TY_LTO_BC;
- return llvm::make_unique<BackendJobAction>(std::move(Input), Output);
+ return llvm::make_unique<CompileJobAction>(std::move(Input), Output);
}
if (Args.hasArg(options::OPT_emit_llvm)) {
types::ID Output =
Args.hasArg(options::OPT_S) ? types::TY_LLVM_IR : types::TY_LLVM_BC;
- return llvm::make_unique<BackendJobAction>(std::move(Input), Output);
+ return llvm::make_unique<CompileJobAction>(std::move(Input), Output);
}
- return llvm::make_unique<BackendJobAction>(std::move(Input),
+ return llvm::make_unique<CompileJobAction>(std::move(Input),
types::TY_PP_Asm);
}
case phases::Assemble:
// See if we should look for a compiler with an integrated assembler. We match
// bottom up, so what we are actually looking for is an assembler job with a
- // compiler or backend input.
+ // compiler input.
if (TC->useIntegratedAs() &&
!C.getArgs().hasArg(options::OPT_save_temps) &&
!C.getArgs().hasArg(options::OPT__SLASH_FA) &&
!C.getArgs().hasArg(options::OPT__SLASH_Fa) &&
isa<AssembleJobAction>(JA) &&
- Inputs->size() == 1 && (isa<CompileJobAction>(*Inputs->begin()) ||
- isa<BackendJobAction>(*Inputs->begin()))) {
+ Inputs->size() == 1 && isa<CompileJobAction>(*Inputs->begin())) {
const Tool *Compiler =
TC->SelectTool(cast<JobAction>(**Inputs->begin()));
if (!Compiler)
return nullptr;
if (Compiler->hasIntegratedAssembler()) {
- JA = cast<JobAction>(*Inputs->begin());
Inputs = &(*Inputs)[0]->getInputs();
ToolForJob = Compiler;
}
if (!ToolForJob)
ToolForJob = TC->SelectTool(*JA);
- // Unless OPT_save_temps is enabled, combine the compile and backend jobs.
- if (isa<BackendJobAction>(JA) &&
- Inputs->size() == 1 && isa<CompileJobAction>(*Inputs->begin()) &&
- !C.getArgs().hasArg(options::OPT_save_temps))
- Inputs = &(*Inputs)[0]->getInputs();
-
// See if we should use an integrated preprocessor. We do so when we have
// exactly one input, since this is the only use case we care about
// (irrelevant since we don't support combine yet).
Suffixed += "-";
Suffixed.append(BoundArch);
}
- // When using both -save-temps and -emit-llvm, use a ".tmp.bc" suffix for
- // the unoptimized bitcode so that it does not get overwritten by the ".bc"
- // optimized bitcode output.
- if (!AtTopLevel && C.getArgs().hasArg(options::OPT_emit_llvm) &&
- JA.getType() == types::TY_LLVM_BC)
- Suffixed += ".tmp";
Suffixed += '.';
Suffixed += Suffix;
NamedOutput = C.getArgs().MakeArgString(Suffixed.c_str());
// Otherwise make sure this is an action clang understands.
if (!isa<PreprocessJobAction>(JA) && !isa<PrecompileJobAction>(JA) &&
- !isa<CompileJobAction>(JA) && !isa<BackendJobAction>(JA))
+ !isa<CompileJobAction>(JA))
return false;
return true;
case Preprocess: return "preprocessor";
case Precompile: return "precompiler";
case Compile: return "compiler";
- case Backend: return "backend";
case Assemble: return "assembler";
case Link: return "linker";
}
case Action::AnalyzeJobClass:
case Action::MigrateJobClass:
case Action::VerifyPCHJobClass:
- case Action::BackendJobClass:
return getClang();
}
/// \brief Check whether the given input tree contains any compilation actions.
static bool ContainsCompileAction(const Action *A) {
- if (isa<CompileJobAction>(A) || isa<BackendJobAction>(A))
+ if (isa<CompileJobAction>(A))
return true;
for (const auto &Act : *A)
} else if (isa<VerifyPCHJobAction>(JA)) {
CmdArgs.push_back("-verify-pch");
} else {
- assert((isa<CompileJobAction>(JA) || isa<BackendJobAction>(JA)) &&
- "Invalid action for clang tool.");
+ assert(isa<CompileJobAction>(JA) && "Invalid action for clang tool.");
if (JA.getType() == types::TY_Nothing) {
CmdArgs.push_back("-fsyntax-only");
// Forward -Xclang arguments to -cc1, and -mllvm arguments to the LLVM option
// parser.
Args.AddAllArgValues(CmdArgs, options::OPT_Xclang);
- bool OptDisabled = false;
for (arg_iterator it = Args.filtered_begin(options::OPT_mllvm),
ie = Args.filtered_end(); it != ie; ++it) {
(*it)->claim();
// We translate this by hand to the -cc1 argument, since nightly test uses
// it and developers have been trained to spell it with -mllvm.
- if (StringRef((*it)->getValue(0)) == "-disable-llvm-optzns") {
+ if (StringRef((*it)->getValue(0)) == "-disable-llvm-optzns")
CmdArgs.push_back("-disable-llvm-optzns");
- OptDisabled = true;
- } else
+ else
(*it)->render(Args, CmdArgs);
}
- // With -save-temps, we want to save the unoptimized bitcode output from the
- // CompileJobAction, so disable optimizations if they are not already
- // disabled.
- if (Args.hasArg(options::OPT_save_temps) && !OptDisabled &&
- isa<CompileJobAction>(JA))
- CmdArgs.push_back("-disable-llvm-optzns");
-
if (Output.getType() == types::TY_Dependencies) {
// Handled with other dependency code.
} else if (Output.isFilename()) {
// can propagate it to the backend.
bool SplitDwarf = Args.hasArg(options::OPT_gsplit_dwarf) &&
getToolChain().getTriple().isOSLinux() &&
- (isa<AssembleJobAction>(JA) || isa<CompileJobAction>(JA) ||
- isa<BackendJobAction>(JA));
+ (isa<AssembleJobAction>(JA) || isa<CompileJobAction>(JA));
const char *SplitDwarfOut;
if (SplitDwarf) {
CmdArgs.push_back("-split-dwarf-file");
// Handle the debug info splitting at object creation time if we're
// creating an object.
// TODO: Currently only works on linux with newer objcopy.
- if (SplitDwarf && !isa<CompileJobAction>(JA) && !isa<BackendJobAction>(JA))
+ if (SplitDwarf && !isa<CompileJobAction>(JA))
SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output, SplitDwarfOut);
if (Arg *A = Args.getLastArg(options::OPT_pg))
} else {
if (!onlyAssembleType(Id)) {
P.push_back(phases::Compile);
- P.push_back(phases::Backend);
}
P.push_back(phases::Assemble);
}
// COMPILE-AST-PHASES: 0: input,
// COMPILE-AST-PHASES: , ast
-// COMPILE-AST-PHASES: 1: compiler, {0}, ir
-// COMPILE-AST-PHASES: 2: backend, {1}, assembler
-// COMPILE-AST-PHASES: 3: assembler, {2}, object
-// COMPILE-AST-PHASES-NOT: 4:
+// COMPILE-AST-PHASES: 1: compiler, {0}, assembler
+// COMPILE-AST-PHASES: 2: assembler, {1}, object
+// COMPILE-AST-PHASES-NOT: 3:
// COMPILE-AST-PHASES: END
// FIXME: There is a problem with compiling AST's in that the input language is
//
// CHECK-MULTIARCH-ACTIONS: 0: input, "{{.*}}darwin-dsymutil.c", c
// CHECK-MULTIARCH-ACTIONS: 1: preprocessor, {0}, cpp-output
-// CHECK-MULTIARCH-ACTIONS: 2: compiler, {1}, ir
-// CHECK-MULTIARCH-ACTIONS: 3: backend, {2}, assembler
-// CHECK-MULTIARCH-ACTIONS: 4: assembler, {3}, object
-// CHECK-MULTIARCH-ACTIONS: 5: linker, {4}, image
-// CHECK-MULTIARCH-ACTIONS: 6: bind-arch, "i386", {5}, image
-// CHECK-MULTIARCH-ACTIONS: 7: bind-arch, "x86_64", {5}, image
-// CHECK-MULTIARCH-ACTIONS: 8: lipo, {6, 7}, image
-// CHECK-MULTIARCH-ACTIONS: 9: dsymutil, {8}, dSYM
+// CHECK-MULTIARCH-ACTIONS: 2: compiler, {1}, assembler
+// CHECK-MULTIARCH-ACTIONS: 3: assembler, {2}, object
+// CHECK-MULTIARCH-ACTIONS: 4: linker, {3}, image
+// CHECK-MULTIARCH-ACTIONS: 5: bind-arch, "i386", {4}, image
+// CHECK-MULTIARCH-ACTIONS: 6: bind-arch, "x86_64", {4}, image
+// CHECK-MULTIARCH-ACTIONS: 7: lipo, {5, 6}, image
+// CHECK-MULTIARCH-ACTIONS: 8: dsymutil, {7}, dSYM
//
// RUN: %clang -target x86_64-apple-darwin10 -ccc-print-bindings \
// RUN: -arch i386 -arch x86_64 %s -g 2> %t
// RUN: FileCheck -check-prefix=CHECK-MULTIARCH-ACTIONS < %t %s
//
// CHECK-MULTIARCH-ACTIONS: 0: input, "{{.*}}darwin-verify-debug.c", c
-// CHECK-MULTIARCH-ACTIONS: 9: dsymutil, {8}, dSYM
-// CHECK-MULTIARCH-ACTIONS: 10: verify-debug-info, {9}, none
+// CHECK-MULTIARCH-ACTIONS: 8: dsymutil, {7}, dSYM
+// CHECK-MULTIARCH-ACTIONS: 9: verify-debug-info, {8}, none
//
// RUN: %clang -target x86_64-apple-darwin10 -ccc-print-bindings \
// RUN: --verify-debug-info -arch i386 -arch x86_64 %s -g 2> %t
// -flto causes a switch to llvm-bc object files.
// RUN: %clang -ccc-print-phases -c %s -flto 2> %t.log
-// RUN: grep '2: compiler, {1}, ir' %t.log
-// RUN: grep '3: backend, {2}, lto-bc' %t.log
+// RUN: grep '2: compiler, {1}, lto-bc' %t.log
// RUN: %clang -ccc-print-phases %s -flto 2> %t.log
// RUN: grep '0: input, ".*lto.c", c' %t.log
// RUN: grep '1: preprocessor, {0}, cpp-output' %t.log
-// RUN: grep '2: compiler, {1}, ir' %t.log
-// RUN: grep '3: backend, {2}, lto-bc' %t.log
-// RUN: grep '4: linker, {3}, image' %t.log
+// RUN: grep '2: compiler, {1}, lto-bc' %t.log
+// RUN: grep '3: linker, {2}, image' %t.log
// llvm-bc and llvm-ll outputs need to match regular suffixes
// (unfortunately).
// RUN: %clang %s -flto -save-temps -### 2> %t.log
// RUN: grep '"-o" ".*lto\.i" "-x" "c" ".*lto\.c"' %t.log
-// RUN: grep '"-o" ".*lto\.bc" .*".*lto\.i"' %t.log
-// RUN: grep '"-o" ".*lto\.o" .*".*lto\.bc"' %t.log
+// RUN: grep '"-o" ".*lto\.o" .*".*lto\.i"' %t.log
// RUN: grep '".*a.out" .*".*lto\.o"' %t.log
// RUN: %clang %s -flto -S -### 2> %t.log
// RUN: %clang -target i386-unknown-unknown -ccc-print-phases -x c %s -x objective-c %s -x c++ %s -x objective-c++ -x assembler %s -x assembler-with-cpp %s -x none %s 2>&1 | FileCheck -check-prefix=BASIC %s
// BASIC: 0: input, "{{.*}}phases.c", c
// BASIC: 1: preprocessor, {0}, cpp-output
-// BASIC: 2: compiler, {1}, ir
-// BASIC: 3: backend, {2}, assembler
-// BASIC: 4: assembler, {3}, object
-// BASIC: 5: input, "{{.*}}phases.c", objective-c
-// BASIC: 6: preprocessor, {5}, objective-c-cpp-output
-// BASIC: 7: compiler, {6}, ir
-// BASIC: 8: backend, {7}, assembler
-// BASIC: 9: assembler, {8}, object
-// BASIC: 10: input, "{{.*}}phases.c", c++
-// BASIC: 11: preprocessor, {10}, c++-cpp-output
-// BASIC: 12: compiler, {11}, ir
-// BASIC: 13: backend, {12}, assembler
-// BASIC: 14: assembler, {13}, object
-// BASIC: 15: input, "{{.*}}phases.c", assembler
+// BASIC: 2: compiler, {1}, assembler
+// BASIC: 3: assembler, {2}, object
+// BASIC: 4: input, "{{.*}}phases.c", objective-c
+// BASIC: 5: preprocessor, {4}, objective-c-cpp-output
+// BASIC: 6: compiler, {5}, assembler
+// BASIC: 7: assembler, {6}, object
+// BASIC: 8: input, "{{.*}}phases.c", c++
+// BASIC: 9: preprocessor, {8}, c++-cpp-output
+// BASIC: 10: compiler, {9}, assembler
+// BASIC: 11: assembler, {10}, object
+// BASIC: 12: input, "{{.*}}phases.c", assembler
+// BASIC: 13: assembler, {12}, object
+// BASIC: 14: input, "{{.*}}phases.c", assembler-with-cpp
+// BASIC: 15: preprocessor, {14}, assembler
// BASIC: 16: assembler, {15}, object
-// BASIC: 17: input, "{{.*}}phases.c", assembler-with-cpp
-// BASIC: 18: preprocessor, {17}, assembler
-// BASIC: 19: assembler, {18}, object
-// BASIC: 20: input, "{{.*}}phases.c", c
-// BASIC: 21: preprocessor, {20}, cpp-output
-// BASIC: 22: compiler, {21}, ir
-// BASIC: 23: backend, {22}, assembler
-// BASIC: 24: assembler, {23}, object
-// BASIC: 25: linker, {4, 9, 14, 16, 19, 24}, image
+// BASIC: 17: input, "{{.*}}phases.c", c
+// BASIC: 18: preprocessor, {17}, cpp-output
+// BASIC: 19: compiler, {18}, assembler
+// BASIC: 20: assembler, {19}, object
+// BASIC: 21: linker, {3, 7, 11, 13, 16, 20}, image
// Universal linked image.
// RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -x c %s -arch ppc -arch i386 2>&1 | FileCheck -check-prefix=ULI %s
// ULI: 0: input, "{{.*}}phases.c", c
// ULI: 1: preprocessor, {0}, cpp-output
-// ULI: 2: compiler, {1}, ir
-// ULI: 3: backend, {2}, assembler
-// ULI: 4: assembler, {3}, object
-// ULI: 5: linker, {4}, image
-// ULI: 6: bind-arch, "ppc", {5}, image
-// ULI: 7: bind-arch, "i386", {5}, image
-// ULI: 8: lipo, {6, 7}, image
+// ULI: 2: compiler, {1}, assembler
+// ULI: 3: assembler, {2}, object
+// ULI: 4: linker, {3}, image
+// ULI: 5: bind-arch, "ppc", {4}, image
+// ULI: 6: bind-arch, "i386", {4}, image
+// ULI: 7: lipo, {5, 6}, image
// Universal object file.
// RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -c -x c %s -arch ppc -arch i386 2>&1 | FileCheck -check-prefix=UOF %s
// UOF: 0: input, "{{.*}}phases.c", c
// UOF: 1: preprocessor, {0}, cpp-output
-// UOF: 2: compiler, {1}, ir
-// UOF: 3: backend, {2}, assembler
-// UOF: 4: assembler, {3}, object
-// UOF: 5: bind-arch, "ppc", {4}, object
-// UOF: 6: bind-arch, "i386", {4}, object
-// UOF: 7: lipo, {5, 6}, object
+// UOF: 2: compiler, {1}, assembler
+// UOF: 3: assembler, {2}, object
+// UOF: 4: bind-arch, "ppc", {3}, object
+// UOF: 5: bind-arch, "i386", {3}, object
+// UOF: 6: lipo, {4, 5}, object
// Arch defaulting
// RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -c -x assembler %s 2>&1 | FileCheck -check-prefix=ARCH1 %s
// RUN: %clang -target x86_64-apple-darwin -save-temps -arch x86_64 %s -### 2>&1 \
// RUN: | FileCheck %s
// CHECK: "-o" "save-temps.i"
-// CHECK: "-disable-llvm-optzns"
-// CHECK: "-o" "save-temps.bc"
// CHECK: "-o" "save-temps.s"
// CHECK: "-o" "save-temps.o"
// CHECK: "-o" "a.out"
-// Check for a single clang cc1 invocation when NOT using -save-temps.
-// RUN: %clang -target x86_64-apple-darwin -arch x86_64 -S %s -### 2>&1 \
-// RUN: | FileCheck %s -check-prefix=NO-TEMPS
-// NO-TEMPS: "-cc1"
-// NO-TEMPS: "-S"
-// NO-TEMPS: "-x" "c"
-
// RUN: %clang -target x86_64-apple-darwin -save-temps -arch i386 -arch x86_64 %s -### 2>&1 \
// RUN: | FileCheck %s -check-prefix=MULT-ARCH
// MULT-ARCH: "-o" "save-temps-i386.i"
-// MULT-ARCH: "-o" "save-temps-i386.bc"
// MULT-ARCH: "-o" "save-temps-i386.s"
// MULT-ARCH: "-o" "save-temps-i386.o"
// MULT-ARCH: "-o" "a.out-i386"
// MULT-ARCH: "-o" "save-temps-x86_64.i"
-// MULT-ARCH: "-o" "save-temps-x86_64.bc"
// MULT-ARCH: "-o" "save-temps-x86_64.s"
// MULT-ARCH: "-o" "save-temps-x86_64.o"
// MULT-ARCH: "-o" "a.out-x86_64"