1#ifndef SYMENGINE_LLVM_DOUBLE_H
2#define SYMENGINE_LLVM_DOUBLE_H
8#ifdef HAVE_SYMENGINE_LLVM
23class FunctionPassManager;
32class LLVMVisitor :
public BaseVisitor<LLVMVisitor>
38 replacement_symbol_ptrs;
49 llvm::Function *get_function_type(llvm::LLVMContext *);
50 virtual llvm::Type *get_float_type(llvm::LLVMContext *) = 0;
53 llvm::Value *apply(
const Basic &b);
54 void init(
const vec_basic &x,
const Basic &b,
55 const bool symbolic_cse =
false,
unsigned opt_level = 3);
56 void init(
const vec_basic &x,
const Basic &b,
const bool symbolic_cse,
58 void init(
const vec_basic &inputs,
const vec_basic &outputs,
59 const bool symbolic_cse =
false,
unsigned opt_level = 3);
60 void init(
const vec_basic &inputs,
const vec_basic &outputs,
62 unsigned opt_level = 3);
67 void set_double(
double d);
68 llvm::Function *get_external_function(
const std::string &name,
70 llvm::Function *get_powi();
72 void bvisit(
const Integer &x);
73 void bvisit(
const Rational &x);
74 void bvisit(
const RealDouble &x);
75#ifdef HAVE_SYMENGINE_MPFR
76 void bvisit(
const RealMPFR &x);
78 void bvisit(
const Add &x);
79 void bvisit(
const Mul &x);
80 void bvisit(
const Pow &x);
81 void bvisit(
const Log &x);
82 void bvisit(
const Abs &x);
83 void bvisit(
const Symbol &x);
84 void bvisit(
const Constant &x);
85 void bvisit(
const Basic &);
86 void bvisit(
const Sin &x);
87 void bvisit(
const Cos &x);
88 void bvisit(
const Piecewise &x);
89 void bvisit(
const BooleanAtom &x);
90 void bvisit(
const And &x);
91 void bvisit(
const Or &x);
92 void bvisit(
const Xor &x);
93 void bvisit(
const Not &x);
94 void bvisit(
const Equality &x);
95 void bvisit(
const Unequality &x);
96 void bvisit(
const LessThan &x);
97 void bvisit(
const StrictLessThan &x);
98 void bvisit(
const Max &x);
99 void bvisit(
const Min &x);
100 void bvisit(
const Contains &x);
101 void bvisit(
const Infty &x);
102 void bvisit(
const NaN &x);
103 void bvisit(
const Floor &x);
104 void bvisit(
const Ceiling &x);
105 void bvisit(
const Truncate &x);
106 void bvisit(
const Sign &x);
112 void bvisit(
const UnevaluatedExpr &x);
115class LLVMDoubleVisitor :
public LLVMVisitor
119 void call(
double *outs,
const double *inps)
const;
120 llvm::Type *get_float_type(llvm::LLVMContext *)
override;
121 void visit(
const Tan &x)
override;
122 void visit(
const ASin &x)
override;
123 void visit(
const ACos &x)
override;
124 void visit(
const ATan &x)
override;
125 void visit(
const ATan2 &x)
override;
126 void visit(
const Sinh &x)
override;
127 void visit(
const Cosh &x)
override;
128 void visit(
const Tanh &x)
override;
129 void visit(
const ASinh &x)
override;
130 void visit(
const ACosh &x)
override;
131 void visit(
const ATanh &x)
override;
132 void visit(
const Gamma &x)
override;
133 void visit(
const LogGamma &x)
override;
134 void visit(
const Erf &x)
override;
135 void visit(
const Erfc &x)
override;
138class LLVMFloatVisitor :
public LLVMVisitor
142 void call(
float *outs,
const float *inps)
const;
143 llvm::Type *get_float_type(llvm::LLVMContext *)
override;
144 void visit(
const Tan &x)
override;
145 void visit(
const ASin &x)
override;
146 void visit(
const ACos &x)
override;
147 void visit(
const ATan &x)
override;
148 void visit(
const ATan2 &x)
override;
149 void visit(
const Sinh &x)
override;
150 void visit(
const Cosh &x)
override;
151 void visit(
const Tanh &x)
override;
152 void visit(
const ASinh &x)
override;
153 void visit(
const ACosh &x)
override;
154 void visit(
const ATanh &x)
override;
155 void visit(
const Gamma &x)
override;
156 void visit(
const LogGamma &x)
override;
157 void visit(
const Erf &x)
override;
158 void visit(
const Erfc &x)
override;
161#if SYMENGINE_SIZEOF_LONG_DOUBLE > 8 && defined(__x86_64__) || defined(__i386__)
162#define SYMENGINE_HAVE_LLVM_LONG_DOUBLE 1
163class LLVMLongDoubleVisitor :
public LLVMVisitor
167 void call(
long double *outs,
const long double *inps)
const;
168 llvm::Type *get_float_type(llvm::LLVMContext *)
override;
169 void visit(
const Tan &x)
override;
170 void visit(
const ASin &x)
override;
171 void visit(
const ACos &x)
override;
172 void visit(
const ATan &x)
override;
173 void visit(
const ATan2 &x)
override;
174 void visit(
const Sinh &x)
override;
175 void visit(
const Cosh &x)
override;
176 void visit(
const Tanh &x)
override;
177 void visit(
const ASinh &x)
override;
178 void visit(
const ACosh &x)
override;
179 void visit(
const ATanh &x)
override;
180 void visit(
const Gamma &x)
override;
181 void visit(
const LogGamma &x)
override;
182 void visit(
const Erf &x)
override;
183 void visit(
const Erfc &x)
override;
184 void visit(
const Integer &x)
override;
185 void visit(
const Rational &x)
override;
186 void convert_from_mpfr(
const Basic &x);
187 void visit(
const Constant &x)
override;
188#ifdef HAVE_SYMENGINE_MPFR
189 void visit(
const RealMPFR &x)
override;
The base class for SymEngine.
Main namespace for SymEngine package.
RCP< const Integer > mod(const Integer &n, const Integer &d)
modulo round toward zero