2009-06-23 23:31:52 +00:00
|
|
|
//===-- llvm/MC/MCValue.h - MCValue class -----------------------*- C++ -*-===//
|
2009-06-23 18:58:00 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2009-06-23 23:31:52 +00:00
|
|
|
// This file contains the declaration of the MCValue class.
|
2009-06-23 18:58:00 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2009-06-23 23:31:52 +00:00
|
|
|
#ifndef LLVM_MC_MCVALUE_H
|
|
|
|
#define LLVM_MC_MCVALUE_H
|
2009-06-23 18:58:00 +00:00
|
|
|
|
2009-06-23 20:02:00 +00:00
|
|
|
#include "llvm/Support/DataTypes.h"
|
|
|
|
|
2009-06-23 18:58:00 +00:00
|
|
|
namespace llvm {
|
|
|
|
class MCSymbol;
|
|
|
|
|
2009-06-23 23:31:52 +00:00
|
|
|
/// MCValue - This represents an "assembler immediate". In its most general
|
|
|
|
/// form, this can hold "SymbolA - SymbolB + imm64". Not all targets supports
|
2009-06-23 18:58:00 +00:00
|
|
|
/// relocations of this general form, but we need to represent this anyway.
|
2009-06-23 23:31:52 +00:00
|
|
|
///
|
|
|
|
/// Note that this class must remain a simple POD value class, because we need
|
|
|
|
/// it to live in unions etc.
|
|
|
|
class MCValue {
|
2009-06-23 18:58:00 +00:00
|
|
|
MCSymbol *SymA, *SymB;
|
|
|
|
int64_t Cst;
|
|
|
|
public:
|
|
|
|
|
|
|
|
int64_t getCst() const { return Cst; }
|
|
|
|
MCSymbol *getSymA() const { return SymA; }
|
|
|
|
MCSymbol *getSymB() const { return SymB; }
|
|
|
|
|
|
|
|
|
2009-06-23 23:31:52 +00:00
|
|
|
static MCValue get(MCSymbol *SymA, MCSymbol *SymB = 0, int64_t Val = 0) {
|
|
|
|
MCValue R;
|
2009-06-23 18:58:00 +00:00
|
|
|
R.Cst = Val;
|
|
|
|
R.SymA = SymA;
|
|
|
|
R.SymB = SymB;
|
|
|
|
return R;
|
|
|
|
}
|
|
|
|
|
2009-06-23 23:31:52 +00:00
|
|
|
static MCValue get(int64_t Val) {
|
|
|
|
MCValue R;
|
2009-06-23 18:58:00 +00:00
|
|
|
R.Cst = Val;
|
|
|
|
R.SymA = 0;
|
|
|
|
R.SymB = 0;
|
|
|
|
return R;
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|