diff options
author | Dan Gohman <gohman@apple.com> | 2009-07-20 21:19:07 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-07-20 21:19:07 +0000 |
commit | 1224c386981f7948f298ed9ad444c40609570f2e (patch) | |
tree | 69577cb79bc2b30c8f801de5c52a374189fdb7a4 /lib/VMCore/AsmWriter.cpp | |
parent | 33d0474bf5d5783cf9690bcab3eabd513d918fc5 (diff) | |
download | llvm-1224c386981f7948f298ed9ad444c40609570f2e.tar.gz llvm-1224c386981f7948f298ed9ad444c40609570f2e.tar.bz2 llvm-1224c386981f7948f298ed9ad444c40609570f2e.tar.xz |
Assembly and Bitcode support for unsigned/signed overflow flags and
exact sdiv flags.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76475 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/AsmWriter.cpp')
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index d5f211b14f..a091a935ba 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -23,6 +23,7 @@ #include "llvm/InlineAsm.h" #include "llvm/Instruction.h" #include "llvm/Instructions.h" +#include "llvm/Operator.h" #include "llvm/MDNode.h" #include "llvm/Module.h" #include "llvm/ValueSymbolTable.h" @@ -851,6 +852,19 @@ static void WriteMDNodes(raw_ostream &Out, TypePrinting &TypePrinter, } } +static void WriteOptimizationInfo(raw_ostream &Out, const User *U) { + if (const OverflowingBinaryOperator *OBO = + dyn_cast<OverflowingBinaryOperator>(U)) { + if (OBO->hasNoUnsignedOverflow()) + Out << "unsigned "; + if (OBO->hasNoSignedOverflow()) + Out << "signed "; + } else if (const SDivOperator *Div = dyn_cast<SDivOperator>(U)) { + if (Div->isExact()) + Out << "exact "; + } +} + static void WriteConstantInt(raw_ostream &Out, const Constant *CV, TypePrinting &TypePrinter, SlotTracker *Machine) { if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) { @@ -1062,6 +1076,7 @@ static void WriteConstantInt(raw_ostream &Out, const Constant *CV, } if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) { + WriteOptimizationInfo(Out, CE); Out << CE->getOpcodeName(); if (CE->isCompare()) Out << ' ' << getPredicateText(CE->getPredicate()); @@ -1682,6 +1697,9 @@ void AssemblyWriter::printInstruction(const Instruction &I) { Out << "tail "; } + // Print out optimization information. + WriteOptimizationInfo(Out, &I); + // Print out the opcode... Out << I.getOpcodeName(); |