Halide
CodeGen_X86.h
Go to the documentation of this file.
1 #ifndef HALIDE_CODEGEN_X86_H
2 #define HALIDE_CODEGEN_X86_H
3 
4 /** \file
5  * Defines the code-generator for producing x86 machine code
6  */
7 
8 #include "CodeGen_Posix.h"
9 #include "Target.h"
10 
11 namespace llvm {
12 class JITEventListener;
13 }
14 
15 namespace Halide {
16 namespace Internal {
17 
18 /** A code generator that emits x86 code from a given Halide stmt. */
19 class CodeGen_X86 : public CodeGen_Posix {
20 public:
21  /** Create an x86 code generator. Processor features can be
22  * enabled using the appropriate flags in the target struct. */
24 
25 protected:
26  std::string mcpu() const override;
27  std::string mattrs() const override;
28  bool use_soft_float_abi() const override;
29  int native_vector_bits() const override;
30 
31  int vector_lanes_for_slice(const Type &t) const;
32 
33  llvm::Type *llvm_type_of(const Type &t) const override;
34 
36 
37  /** Nodes for which we want to emit specific sse/avx intrinsics */
38  // @{
39  void visit(const Add *) override;
40  void visit(const Sub *) override;
41  void visit(const Cast *) override;
42  void visit(const Call *) override;
43  void visit(const GT *) override;
44  void visit(const LT *) override;
45  void visit(const LE *) override;
46  void visit(const GE *) override;
47  void visit(const EQ *) override;
48  void visit(const NE *) override;
49  void visit(const Select *) override;
50  void visit(const VectorReduce *) override;
51  void visit(const Mul *) override;
52  // @}
53 };
54 
55 } // namespace Internal
56 } // namespace Halide
57 
58 #endif
Halide::Internal::Add
The sum of two expressions.
Definition: IR.h:38
Halide::Internal::CodeGen_X86::mattrs
std::string mattrs() const override
llvm
Definition: CodeGen_Internal.h:19
Halide::Internal::VectorReduce
Horizontally reduce a vector to a scalar or narrower vector using the given commutative and associati...
Definition: IR.h:827
Halide::Internal::GE
Is the first expression greater than or equal to the second.
Definition: IR.h:148
Halide::Internal::CodeGen_Posix
A code generator that emits posix code from a given Halide stmt.
Definition: CodeGen_Posix.h:14
Halide::Internal::CodeGen_Posix::visit
void visit(const Allocate *) override
Posix implementation of Allocate.
Target.h
Halide::Internal::Cast
The actual IR nodes begin here.
Definition: IR.h:29
Halide::Internal::CodeGen_X86::llvm_type_of
llvm::Type * llvm_type_of(const Type &t) const override
Get the llvm type equivalent to the given halide type in the current context.
Halide::Internal::LE
Is the first expression less than or equal to the second.
Definition: IR.h:130
Halide::Internal::NE
Is the first expression not equal to the second.
Definition: IR.h:112
Halide::Internal::CodeGen_X86::CodeGen_X86
CodeGen_X86(Target)
Create an x86 code generator.
Halide::Type
Types in the halide type system.
Definition: Type.h:269
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition: AddAtomicMutex.h:21
Halide::Internal::EQ
Is the first expression equal to the second.
Definition: IR.h:103
Halide::LinkageType::Internal
@ Internal
Not visible externally, similar to 'static' linkage in C.
Halide::Internal::CodeGen_X86::mcpu
std::string mcpu() const override
What should be passed as -mcpu, -mattrs, and related for compilation.
Halide::Internal::CodeGen_X86::visit
void visit(const Add *) override
Nodes for which we want to emit specific sse/avx intrinsics.
Halide::Internal::CodeGen_X86::vector_lanes_for_slice
int vector_lanes_for_slice(const Type &t) const
Halide::Internal::CodeGen_X86
A code generator that emits x86 code from a given Halide stmt.
Definition: CodeGen_X86.h:19
Halide::Internal::Call
A function call.
Definition: IR.h:464
Halide::Internal::CodeGen_X86::native_vector_bits
int native_vector_bits() const override
What's the natural vector bit-width to use for loads, stores, etc.
Halide::Internal::Select
A ternary operator.
Definition: IR.h:186
Halide::Internal::GT
Is the first expression greater than the second.
Definition: IR.h:139
Halide::Internal::Sub
The difference of two expressions.
Definition: IR.h:47
Halide::Target
A struct representing a target machine and os to generate code for.
Definition: Target.h:19
CodeGen_Posix.h
Halide::Internal::LT
Is the first expression less than the second.
Definition: IR.h:121
Halide::Internal::Mul
The product of two expressions.
Definition: IR.h:56
Halide::Internal::CodeGen_X86::use_soft_float_abi
bool use_soft_float_abi() const override