1 //===- MCFixup.cpp - Assembly Fixup Implementation ------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/MC/MCFixup.h"
13 static MCSymbolRefExpr::VariantKind getAccessVariant(const MCExpr *Expr) {
14 switch (Expr->getKind()) {
17 llvm_unreachable("unsupported");
19 case MCExpr::Constant:
20 return MCSymbolRefExpr::VK_None;
22 case MCExpr::SymbolRef: {
23 const MCSymbolRefExpr *SRE = cast<MCSymbolRefExpr>(Expr);
24 return SRE->getKind();
26 case MCExpr::Binary: {
27 const MCBinaryExpr *ABE = cast<MCBinaryExpr>(Expr);
28 assert(getAccessVariant(ABE->getRHS()) == MCSymbolRefExpr::VK_None);
29 return getAccessVariant(ABE->getLHS());
34 MCSymbolRefExpr::VariantKind MCFixup::getAccessVariant() const {
35 return ::getAccessVariant(getValue());