Daniel Dunbar | 4ee3461 | 2010-02-25 04:37:45 +0000 | [diff] [blame] | 1 | //===--- CodeGenAction.h - LLVM Code Generation Frontend Action -*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "clang/Frontend/FrontendAction.h" |
Daniel Dunbar | b954e98 | 2010-02-25 04:37:50 +0000 | [diff] [blame] | 11 | #include "llvm/ADT/OwningPtr.h" |
| 12 | |
| 13 | namespace llvm { |
| 14 | class Module; |
| 15 | } |
Daniel Dunbar | 4ee3461 | 2010-02-25 04:37:45 +0000 | [diff] [blame] | 16 | |
| 17 | namespace clang { |
| 18 | |
| 19 | class CodeGenAction : public ASTFrontendAction { |
| 20 | private: |
| 21 | unsigned Act; |
Daniel Dunbar | b954e98 | 2010-02-25 04:37:50 +0000 | [diff] [blame] | 22 | llvm::OwningPtr<llvm::Module> TheModule; |
Daniel Dunbar | 4ee3461 | 2010-02-25 04:37:45 +0000 | [diff] [blame] | 23 | |
| 24 | protected: |
| 25 | CodeGenAction(unsigned _Act); |
| 26 | |
| 27 | virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, |
| 28 | llvm::StringRef InFile); |
Daniel Dunbar | b954e98 | 2010-02-25 04:37:50 +0000 | [diff] [blame] | 29 | |
| 30 | virtual void EndSourceFileAction(); |
| 31 | |
| 32 | public: |
Chandler Carruth | f84df9f | 2010-02-26 08:51:12 +0000 | [diff] [blame] | 33 | ~CodeGenAction(); |
| 34 | |
Daniel Dunbar | b954e98 | 2010-02-25 04:37:50 +0000 | [diff] [blame] | 35 | /// takeModule - Take the generated LLVM module, for use after the action has |
| 36 | /// been run. The result may be null on failure. |
| 37 | llvm::Module *takeModule(); |
Daniel Dunbar | 4ee3461 | 2010-02-25 04:37:45 +0000 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | class EmitAssemblyAction : public CodeGenAction { |
| 41 | public: |
| 42 | EmitAssemblyAction(); |
| 43 | }; |
| 44 | |
| 45 | class EmitBCAction : public CodeGenAction { |
| 46 | public: |
| 47 | EmitBCAction(); |
| 48 | }; |
| 49 | |
| 50 | class EmitLLVMAction : public CodeGenAction { |
| 51 | public: |
| 52 | EmitLLVMAction(); |
| 53 | }; |
| 54 | |
| 55 | class EmitLLVMOnlyAction : public CodeGenAction { |
| 56 | public: |
| 57 | EmitLLVMOnlyAction(); |
| 58 | }; |
| 59 | |
Daniel Dunbar | 32148ce | 2010-05-25 18:41:01 +0000 | [diff] [blame^] | 60 | class EmitCodeGenOnlyAction : public CodeGenAction { |
| 61 | public: |
| 62 | EmitCodeGenOnlyAction(); |
| 63 | }; |
| 64 | |
Daniel Dunbar | 4ee3461 | 2010-02-25 04:37:45 +0000 | [diff] [blame] | 65 | class EmitObjAction : public CodeGenAction { |
| 66 | public: |
| 67 | EmitObjAction(); |
| 68 | }; |
| 69 | |
| 70 | } |