forked from OSchip/llvm-project
Add -emit-llvm-only option (generate LLVM IR & run passes, but discard
output). - For timing IRgen phase. llvm-svn: 65580
This commit is contained in:
parent
53e06f9cb4
commit
26d5f05bf5
|
@ -48,7 +48,8 @@ ASTConsumer *CreateCodeRewriterTest(const std::string& InFile,
|
|||
enum BackendAction {
|
||||
Backend_EmitAssembly,
|
||||
Backend_EmitBC,
|
||||
Backend_EmitLL
|
||||
Backend_EmitLL,
|
||||
Backend_EmitNothing
|
||||
};
|
||||
ASTConsumer *CreateBackendConsumer(BackendAction Action,
|
||||
Diagnostic &Diags,
|
||||
|
|
|
@ -181,6 +181,9 @@ FunctionPassManager *BackendConsumer::getPerFunctionPasses() const {
|
|||
}
|
||||
|
||||
bool BackendConsumer::AddEmitPasses(std::string &Error) {
|
||||
if (Action == Backend_EmitNothing)
|
||||
return true;
|
||||
|
||||
if (OutputFile == "-" || (InputFile == "-" && OutputFile.empty())) {
|
||||
AsmOutStream = new raw_stdout_ostream();
|
||||
sys::Program::ChangeStdoutToBinary();
|
||||
|
|
|
@ -86,6 +86,7 @@ enum ProgActions {
|
|||
EmitAssembly, // Emit a .s file.
|
||||
EmitLLVM, // Emit a .ll file.
|
||||
EmitBC, // Emit a .bc file.
|
||||
EmitLLVMOnly, // Generate LLVM IR, but do not
|
||||
SerializeAST, // Emit a .ast file.
|
||||
EmitHTML, // Translate input source into HTML.
|
||||
ASTPrint, // Parse ASTs and print them.
|
||||
|
@ -143,6 +144,8 @@ ProgAction(llvm::cl::desc("Choose output type:"), llvm::cl::ZeroOrMore,
|
|||
"Build ASTs then convert to LLVM, emit .ll file"),
|
||||
clEnumValN(EmitBC, "emit-llvm-bc",
|
||||
"Build ASTs then convert to LLVM, emit .bc file"),
|
||||
clEnumValN(EmitLLVMOnly, "emit-llvm-only",
|
||||
"Build ASTs and convert to LLVM, discarding output"),
|
||||
clEnumValN(SerializeAST, "serialize",
|
||||
"Build ASTs and emit .ast file"),
|
||||
clEnumValN(RewriteTest, "rewrite-test",
|
||||
|
@ -1297,12 +1300,15 @@ static ASTConsumer *CreateASTConsumer(const std::string& InFile,
|
|||
|
||||
case EmitAssembly:
|
||||
case EmitLLVM:
|
||||
case EmitBC: {
|
||||
case EmitBC:
|
||||
case EmitLLVMOnly: {
|
||||
BackendAction Act;
|
||||
if (ProgAction == EmitAssembly)
|
||||
Act = Backend_EmitAssembly;
|
||||
else if (ProgAction == EmitLLVM)
|
||||
Act = Backend_EmitLL;
|
||||
else if (ProgAction == EmitLLVMOnly)
|
||||
Act = Backend_EmitNothing;
|
||||
else
|
||||
Act = Backend_EmitBC;
|
||||
|
||||
|
|
Loading…
Reference in New Issue