2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-2014 Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_JIT_VASM_LLVM_H_
18 #define incl_HPHP_JIT_VASM_LLVM_H_
20 #define __STDC_LIMIT_MACROS
23 #include "hphp/runtime/vm/jit/containers.h"
24 #include "hphp/runtime/vm/jit/vasm.h"
25 #include "hphp/runtime/vm/jit/vasm-emit.h"
27 #include <folly/Format.h>
29 namespace HPHP
{ namespace jit
{
30 ///////////////////////////////////////////////////////////////////////////////
34 ///////////////////////////////////////////////////////////////////////////////
37 * Thrown when the LLVM backend encounters something it doesn't support.
39 struct FailedLLVMCodeGen
: public std::runtime_error
{
40 template<typename
... Args
>
41 explicit FailedLLVMCodeGen(Args
&&... args
)
42 : std::runtime_error(folly::sformat(std::forward
<Args
>(args
)...))
47 * Thrown when the llvm_compare trace module is active, to allow comparing LLVM
50 struct CompareLLVMCodeGen
: FailedLLVMCodeGen
{
51 explicit CompareLLVMCodeGen(jit::vector
<std::string
>&& disasm
,
54 : FailedLLVMCodeGen("Discarding LLVM code for comparison")
55 , disasm(std::move(disasm
))
56 , llvm(std::move(llvm
))
57 , main_size(main_size
)
60 jit::vector
<std::string
> disasm
;
66 * Emit machine code for unit using the LLVM backend.
68 * Throws FailedLLVMCodeGen on failure. Any code/data emitted to the given
69 * areas is *not* cleaned up on failure; the caller must decide how to clean
72 void genCodeLLVM(const Vunit
& unit
, Vasm::AreaList
& areas
);
74 ///////////////////////////////////////////////////////////////////////////////