summaryrefslogtreecommitdiff
path: root/lib/AsmParser/LLParser.h
diff options
context:
space:
mode:
authorMichael Ilseman <milseman@apple.com>2012-11-27 00:42:44 +0000
committerMichael Ilseman <milseman@apple.com>2012-11-27 00:42:44 +0000
commit15c13d3e63d7745bccad74d547af4e3482193eaa (patch)
tree7f27560aaf6fc5c3698d8a3a574545745350b98d /lib/AsmParser/LLParser.h
parent4d265332341360a7cb5b15e2c2f0c675a7fed766 (diff)
downloadllvm-15c13d3e63d7745bccad74d547af4e3482193eaa.tar.gz
llvm-15c13d3e63d7745bccad74d547af4e3482193eaa.tar.bz2
llvm-15c13d3e63d7745bccad74d547af4e3482193eaa.tar.xz
Fast-math flags for LLVM IR parsing and printing
Added in the ability to read LLVM IR text that contains fast-math flags as a sequence of capital letters separated by spaces in any order. Added in the printing of the fast-math flags in a canonical order, and don't print the other flags when 'fast' is specified, as 'fast' implies all the others. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168645 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser/LLParser.h')
-rw-r--r--lib/AsmParser/LLParser.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/AsmParser/LLParser.h b/lib/AsmParser/LLParser.h
index 9f9672d67b..8e04705a7b 100644
--- a/lib/AsmParser/LLParser.h
+++ b/lib/AsmParser/LLParser.h
@@ -18,6 +18,7 @@
#include "llvm/Attributes.h"
#include "llvm/Instructions.h"
#include "llvm/Module.h"
+#include "llvm/Operator.h"
#include "llvm/Type.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringMap.h"
@@ -154,6 +155,21 @@ namespace llvm {
Lex.Lex();
return true;
}
+
+ FastMathFlags EatFastMathFlagsIfPresent() {
+ FastMathFlags FMF;
+ while (true)
+ switch (Lex.getKind()) {
+ case lltok::kw_fast: FMF.UnsafeAlgebra = true; Lex.Lex(); continue;
+ case lltok::kw_nnan: FMF.NoNaNs = true; Lex.Lex(); continue;
+ case lltok::kw_ninf: FMF.NoInfs = true; Lex.Lex(); continue;
+ case lltok::kw_nsz: FMF.NoSignedZeros = true; Lex.Lex(); continue;
+ case lltok::kw_arcp: FMF.AllowReciprocal = true; Lex.Lex(); continue;
+ default: return FMF;
+ }
+ return FMF;
+ }
+
bool ParseOptionalToken(lltok::Kind T, bool &Present, LocTy *Loc = 0) {
if (Lex.getKind() != T) {
Present = false;