diff options
| author | 2019-01-27 16:42:12 +0000 | |
|---|---|---|
| committer | 2019-01-27 16:42:12 +0000 | |
| commit | b773203fb58f3ef282fb69c832d8710cab5bc82d (patch) | |
| tree | e75913f147570fbd75169647b144df85b88a038c /gnu/llvm/lib/MC/MCInst.cpp | |
| parent | tweak errno in previous (diff) | |
| download | wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.tar.xz wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.zip | |
Import LLVM 7.0.1 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/lib/MC/MCInst.cpp')
| -rw-r--r-- | gnu/llvm/lib/MC/MCInst.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gnu/llvm/lib/MC/MCInst.cpp b/gnu/llvm/lib/MC/MCInst.cpp index f6d1d3cffca..f9b71caaf91 100644 --- a/gnu/llvm/lib/MC/MCInst.cpp +++ b/gnu/llvm/lib/MC/MCInst.cpp @@ -8,8 +8,10 @@ //===----------------------------------------------------------------------===// #include "llvm/MC/MCInst.h" +#include "llvm/Config/llvm-config.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInstPrinter.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" @@ -35,6 +37,23 @@ void MCOperand::print(raw_ostream &OS) const { OS << ">"; } +bool MCOperand::evaluateAsConstantImm(int64_t &Imm) const { + if (isImm()) { + Imm = getImm(); + return true; + } + return false; +} + +bool MCOperand::isBareSymbolRef() const { + assert(isExpr() && + "isBareSymbolRef expects only expressions"); + const MCExpr *Expr = getExpr(); + MCExpr::ExprKind Kind = getExpr()->getKind(); + return Kind == MCExpr::SymbolRef && + cast<MCSymbolRefExpr>(Expr)->getKind() == MCSymbolRefExpr::VK_None; +} + #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) LLVM_DUMP_METHOD void MCOperand::dump() const { print(dbgs()); |
