opnsense-src/include/clang/CodeGen/CodeGenAction.h

104 lines
2.7 KiB
C
Raw Normal View History

2010-03-03 12:28:16 -05:00
//===--- CodeGenAction.h - LLVM Code Generation Frontend Action -*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
2010-07-13 13:21:42 -04:00
#ifndef LLVM_CLANG_CODEGEN_CODE_GEN_ACTION_H
#define LLVM_CLANG_CODEGEN_CODE_GEN_ACTION_H
2010-03-03 12:28:16 -05:00
#include "clang/Frontend/FrontendAction.h"
#include "llvm/ADT/OwningPtr.h"
namespace llvm {
class LLVMContext;
2010-03-03 12:28:16 -05:00
class Module;
}
namespace clang {
class BackendConsumer;
2010-03-03 12:28:16 -05:00
class CodeGenAction : public ASTFrontendAction {
private:
unsigned Act;
OwningPtr<llvm::Module> TheModule;
llvm::Module *LinkModule;
llvm::LLVMContext *VMContext;
bool OwnsVMContext;
2010-03-03 12:28:16 -05:00
protected:
/// Create a new code generation action. If the optional \p _VMContext
/// parameter is supplied, the action uses it without taking ownership,
/// otherwise it creates a fresh LLVM context and takes ownership.
CodeGenAction(unsigned _Act, llvm::LLVMContext *_VMContext = 0);
2010-03-03 12:28:16 -05:00
2010-07-13 13:21:42 -04:00
virtual bool hasIRSupport() const;
2010-03-03 12:28:16 -05:00
virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
StringRef InFile);
2010-03-03 12:28:16 -05:00
2010-07-13 13:21:42 -04:00
virtual void ExecuteAction();
2010-03-03 12:28:16 -05:00
virtual void EndSourceFileAction();
public:
~CodeGenAction();
/// setLinkModule - Set the link module to be used by this action. If a link
/// module is not provided, and CodeGenOptions::LinkBitcodeFile is non-empty,
/// the action will load it from the specified file.
void setLinkModule(llvm::Module *Mod) { LinkModule = Mod; }
2010-03-03 12:28:16 -05:00
/// takeModule - Take the generated LLVM module, for use after the action has
/// been run. The result may be null on failure.
llvm::Module *takeModule();
/// Take the LLVM context used by this action.
llvm::LLVMContext *takeLLVMContext();
BackendConsumer *BEConsumer;
2010-03-03 12:28:16 -05:00
};
class EmitAssemblyAction : public CodeGenAction {
virtual void anchor();
2010-03-03 12:28:16 -05:00
public:
EmitAssemblyAction(llvm::LLVMContext *_VMContext = 0);
2010-03-03 12:28:16 -05:00
};
class EmitBCAction : public CodeGenAction {
virtual void anchor();
2010-03-03 12:28:16 -05:00
public:
EmitBCAction(llvm::LLVMContext *_VMContext = 0);
2010-03-03 12:28:16 -05:00
};
class EmitLLVMAction : public CodeGenAction {
virtual void anchor();
2010-03-03 12:28:16 -05:00
public:
EmitLLVMAction(llvm::LLVMContext *_VMContext = 0);
2010-03-03 12:28:16 -05:00
};
class EmitLLVMOnlyAction : public CodeGenAction {
virtual void anchor();
2010-03-03 12:28:16 -05:00
public:
EmitLLVMOnlyAction(llvm::LLVMContext *_VMContext = 0);
2010-03-03 12:28:16 -05:00
};
2010-05-27 11:17:06 -04:00
class EmitCodeGenOnlyAction : public CodeGenAction {
virtual void anchor();
2010-05-27 11:17:06 -04:00
public:
EmitCodeGenOnlyAction(llvm::LLVMContext *_VMContext = 0);
2010-05-27 11:17:06 -04:00
};
2010-03-03 12:28:16 -05:00
class EmitObjAction : public CodeGenAction {
virtual void anchor();
2010-03-03 12:28:16 -05:00
public:
EmitObjAction(llvm::LLVMContext *_VMContext = 0);
2010-03-03 12:28:16 -05:00
};
}
2010-07-13 13:21:42 -04:00
#endif