Silence -Wunused-variable in release builds.
[llvm/stm8.git] / lib / Target / Mips / MipsMCSymbolRefExpr.cpp
blob9a2bdae0e3391a5f188c8f9b9a21e41059c33a5e
1 //===-- MipsMCSymbolRefExpr.cpp - Mips specific MC expression classes -----===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
10 #define DEBUG_TYPE "mipsmcsymbolrefexpr"
11 #include "MipsMCSymbolRefExpr.h"
12 #include "llvm/MC/MCAssembler.h"
13 #include "llvm/MC/MCContext.h"
14 #include "llvm/MC/MCSymbol.h"
15 using namespace llvm;
17 const MipsMCSymbolRefExpr*
18 MipsMCSymbolRefExpr::Create(VariantKind Kind, const MCSymbol *Symbol,
19 int Offset, MCContext &Ctx) {
20 return new (Ctx) MipsMCSymbolRefExpr(Kind, Symbol, Offset);
23 void MipsMCSymbolRefExpr::PrintImpl(raw_ostream &OS) const {
24 switch (Kind) {
25 default: assert(0 && "Invalid kind!");
26 case VK_Mips_None: break;
27 case VK_Mips_GPREL: OS << "%gp_rel("; break;
28 case VK_Mips_GOT_CALL: OS << "%call16("; break;
29 case VK_Mips_GOT: OS << "%got("; break;
30 case VK_Mips_ABS_HI: OS << "%hi("; break;
31 case VK_Mips_ABS_LO: OS << "%lo("; break;
32 case VK_Mips_TLSGD: OS << "%tlsgd("; break;
33 case VK_Mips_GOTTPREL: OS << "%gottprel("; break;
34 case VK_Mips_TPREL_HI: OS << "%tprel_hi("; break;
35 case VK_Mips_TPREL_LO: OS << "%tprel_lo("; break;
38 OS << *Symbol;
40 if (Offset) {
41 if (Offset > 0)
42 OS << '+';
43 OS << Offset;
46 if (Kind != VK_Mips_None)
47 OS << ')';
50 bool
51 MipsMCSymbolRefExpr::EvaluateAsRelocatableImpl(MCValue &Res,
52 const MCAsmLayout *Layout) const {
53 return false;
56 void MipsMCSymbolRefExpr::AddValueSymbols(MCAssembler *Asm) const {
57 Asm->getOrCreateSymbolData(*Symbol);
60 const MCSection *MipsMCSymbolRefExpr::FindAssociatedSection() const {
61 return Symbol->isDefined() ? &Symbol->getSection() : NULL;