mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-10 01:10:48 +00:00
25ceb5f317
representing @GOT and friends. Use it for personality references as a first use. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95588 91177308-0d34-0410-b5e6-96231b3b80d8
43 lines
1.3 KiB
C++
43 lines
1.3 KiB
C++
//===- 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 GOT: OS << "@GOT"; break;
|
|
case PLT: OS << "@PLT"; break;
|
|
case GOTPCREL: OS << "@GOTPCREL"; 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;
|
|
}
|
|
|
|
X86MCTargetExpr *foo(MCExpr *A) { return (X86MCTargetExpr*)A; } |