blob: 17b4fe88c7528e2ec63c6cb1f85ed0d935319654 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
//===- X86MCTargetExpr.cpp - X86 Target Specific MCExpr Implementation ----===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "X86MCTargetExpr.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCValue.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
X86MCTargetExpr *X86MCTargetExpr::Create(const MCSymbol *Sym, VariantKind K,
MCContext &Ctx) {
return new (Ctx) X86MCTargetExpr(Sym, K);
}
void X86MCTargetExpr::PrintImpl(raw_ostream &OS) const {
OS << *Sym;
switch (Kind) {
case Invalid: OS << "@<invalid>"; break;
case GOT: OS << "@GOT"; break;
case GOTOFF: OS << "@GOTOFF"; break;
case GOTPCREL: OS << "@GOTPCREL"; break;
case GOTTPOFF: OS << "@GOTTPOFF"; break;
case INDNTPOFF: OS << "@INDNTPOFF"; break;
case NTPOFF: OS << "@NTPOFF"; break;
case PLT: OS << "@PLT"; break;
case TLSGD: OS << "@TLSGD"; break;
case TPOFF: OS << "@TPOFF"; break;
}
}
bool X86MCTargetExpr::EvaluateAsRelocatableImpl(MCValue &Res) const {
// FIXME: I don't know if this is right, it followed MCSymbolRefExpr.
// Evaluate recursively if this is a variable.
if (Sym->isVariable())
return Sym->getValue()->EvaluateAsRelocatable(Res);
Res = MCValue::get(Sym, 0, 0);
return true;
}
|