1 //===-- MipsMCSymbolRefExpr.cpp - Mips specific MC expression classes -----===//
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 #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"
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 {
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;
46 if (Kind
!= VK_Mips_None
)
51 MipsMCSymbolRefExpr::EvaluateAsRelocatableImpl(MCValue
&Res
,
52 const MCAsmLayout
*Layout
) const {
56 void MipsMCSymbolRefExpr::AddValueSymbols(MCAssembler
*Asm
) const {
57 Asm
->getOrCreateSymbolData(*Symbol
);
60 const MCSection
*MipsMCSymbolRefExpr::FindAssociatedSection() const {
61 return Symbol
->isDefined() ? &Symbol
->getSection() : NULL
;