Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/include/llvm/IR/Operator.h
Show All 12 Lines | |||||
#ifndef LLVM_IR_OPERATOR_H | #ifndef LLVM_IR_OPERATOR_H | ||||
#define LLVM_IR_OPERATOR_H | #define LLVM_IR_OPERATOR_H | ||||
#include "llvm/ADT/MapVector.h" | #include "llvm/ADT/MapVector.h" | ||||
#include "llvm/ADT/None.h" | #include "llvm/ADT/None.h" | ||||
#include "llvm/ADT/Optional.h" | #include "llvm/ADT/Optional.h" | ||||
#include "llvm/IR/Constants.h" | #include "llvm/IR/Constants.h" | ||||
#include "llvm/IR/Function.h" | |||||
#include "llvm/IR/Instruction.h" | #include "llvm/IR/Instruction.h" | ||||
#include "llvm/IR/Type.h" | #include "llvm/IR/Type.h" | ||||
#include "llvm/IR/Value.h" | #include "llvm/IR/Value.h" | ||||
#include "llvm/Support/Casting.h" | #include "llvm/Support/Casting.h" | ||||
#include <cstddef> | #include <cstddef> | ||||
namespace llvm { | namespace llvm { | ||||
▲ Show 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | public: | ||||
FastMathFlags() = default; | FastMathFlags() = default; | ||||
static FastMathFlags getFast() { | static FastMathFlags getFast() { | ||||
FastMathFlags FMF; | FastMathFlags FMF; | ||||
FMF.setFast(); | FMF.setFast(); | ||||
return FMF; | return FMF; | ||||
} | } | ||||
static FastMathFlags getFromFuncAttr(Function *F) { | |||||
FastMathFlags FMF; | |||||
if (F->hasFnAttribute("unsafe-fp-math")) { | |||||
bool UnsafeMath = F->getFnAttribute("unsafe-fp-math").getValueAsBool(); | |||||
FMF.setAllowReassoc(UnsafeMath); | |||||
FMF.setAllowReciprocal(UnsafeMath); | |||||
} | |||||
if (F->hasFnAttribute("no-nans-fp-math")) | |||||
FMF.setNoNaNs(F->getFnAttribute("no-nans-fp-math").getValueAsBool()); | |||||
if (F->hasFnAttribute("no-signed-zeros-fp-math")) | |||||
FMF.setNoSignedZeros( | |||||
F->getFnAttribute("no-signed-zeros-fp-math").getValueAsBool()); | |||||
if (F->hasFnAttribute("no-infs-fp-math")) | |||||
FMF.setNoInfs(F->getFnAttribute("no-infs-fp-math").getValueAsBool()); | |||||
if (F->hasFnAttribute("approx-func-fp-math")) | |||||
FMF.setApproxFunc( | |||||
F->getFnAttribute("approx-func-fp-math").getValueAsBool()); | |||||
return FMF; | |||||
} | |||||
bool any() const { return Flags != 0; } | bool any() const { return Flags != 0; } | ||||
bool none() const { return Flags == 0; } | bool none() const { return Flags == 0; } | ||||
bool all() const { return Flags == ~0U; } | bool all() const { return Flags == ~0U; } | ||||
void clear() { Flags = 0; } | void clear() { Flags = 0; } | ||||
void set() { Flags = ~0U; } | void set() { Flags = ~0U; } | ||||
/// Flag queries | /// Flag queries | ||||
▲ Show 20 Lines • Show All 455 Lines • Show Last 20 Lines |