diff options
| author | Michael Ilseman <milseman@apple.com> | 2012-11-27 00:42:44 +0000 |
|---|---|---|
| committer | Michael Ilseman <milseman@apple.com> | 2012-11-27 00:42:44 +0000 |
| commit | 9205317bc3814acd8e898e356ccf7faed9b47090 (patch) | |
| tree | 919069ee4f06171b8a7ddb91b70575d13536762a /llvm/lib/AsmParser/LLParser.cpp | |
| parent | 69e328e5bd51f3f9dc7598573e70c4562911f8b9 (diff) | |
| download | bcm5719-llvm-9205317bc3814acd8e898e356ccf7faed9b47090.tar.gz bcm5719-llvm-9205317bc3814acd8e898e356ccf7faed9b47090.zip | |
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.
llvm-svn: 168645
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
| -rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 41cca685769..65f42450622 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -3012,7 +3012,17 @@ int LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB, } case lltok::kw_fadd: case lltok::kw_fsub: - case lltok::kw_fmul: return ParseArithmetic(Inst, PFS, KeywordVal, 2); + case lltok::kw_fmul: + case lltok::kw_fdiv: + case lltok::kw_frem: { + FastMathFlags FMF = EatFastMathFlagsIfPresent(); + int Res = ParseArithmetic(Inst, PFS, KeywordVal, 2); + if (Res != 0) + return Res; + if (FMF.any()) + Inst->setFastMathFlags(FMF); + return 0; + } case lltok::kw_sdiv: case lltok::kw_udiv: @@ -3027,8 +3037,6 @@ int LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB, case lltok::kw_urem: case lltok::kw_srem: return ParseArithmetic(Inst, PFS, KeywordVal, 1); - case lltok::kw_fdiv: - case lltok::kw_frem: return ParseArithmetic(Inst, PFS, KeywordVal, 2); case lltok::kw_and: case lltok::kw_or: case lltok::kw_xor: return ParseLogical(Inst, PFS, KeywordVal); |

