summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-08 19:41:07 +0000
committerChris Lattner <sabre@nondot.org>2010-02-08 19:41:07 +0000
commit38d022efe91243d4f716a21656d156dbe002420f (patch)
tree6793dddc83c66e3288a18efbfde1f59e70b698cf /llvm/lib/MC
parente77bebc4ba7fe56fce418f170d1e130f77621aa0 (diff)
downloadbcm5719-llvm-38d022efe91243d4f716a21656d156dbe002420f.tar.gz
bcm5719-llvm-38d022efe91243d4f716a21656d156dbe002420f.zip
add scaffolding for target-specific MCExprs.
llvm-svn: 95559
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r--llvm/lib/MC/MCExpr.cpp6
-rw-r--r--llvm/lib/MC/MCMachOStreamer.cpp1
2 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp
index 1ee1b1bddb7..07546c1b29b 100644
--- a/llvm/lib/MC/MCExpr.cpp
+++ b/llvm/lib/MC/MCExpr.cpp
@@ -17,6 +17,8 @@ using namespace llvm;
void MCExpr::print(raw_ostream &OS) const {
switch (getKind()) {
+ case MCExpr::Target:
+ return cast<MCTargetExpr>(this)->PrintImpl(OS);
case MCExpr::Constant:
OS << cast<MCConstantExpr>(*this).getValue();
return;
@@ -131,6 +133,7 @@ const MCSymbolRefExpr *MCSymbolRefExpr::Create(StringRef Name, MCContext &Ctx) {
return Create(Ctx.GetOrCreateSymbol(Name), Ctx);
}
+MCTargetExpr::~MCTargetExpr() {}
/* *** */
@@ -168,6 +171,9 @@ static bool EvaluateSymbolicAdd(const MCValue &LHS, const MCSymbol *RHS_A,
bool MCExpr::EvaluateAsRelocatable(MCValue &Res) const {
switch (getKind()) {
+ case Target:
+ return cast<MCTargetExpr>(this)->EvaluateAsRelocatableImpl(Res);
+
case Constant:
Res = MCValue::get(cast<MCConstantExpr>(this)->getValue());
return true;
diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp
index 981eb72d14c..40a21ad5dd2 100644
--- a/llvm/lib/MC/MCMachOStreamer.cpp
+++ b/llvm/lib/MC/MCMachOStreamer.cpp
@@ -87,6 +87,7 @@ public:
const MCExpr *AddValueSymbols(const MCExpr *Value) {
switch (Value->getKind()) {
+ case MCExpr::Target: assert(0 && "Can't handle target exprs yet!");
case MCExpr::Constant:
break;
OpenPOWER on IntegriCloud