diff options
-rw-r--r-- | include/llvm/MC/MCValue.h | 3 | ||||
-rw-r--r-- | tools/llvm-mc/AsmExpr.cpp | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/include/llvm/MC/MCValue.h b/include/llvm/MC/MCValue.h index 174992ebe0..d032f170c3 100644 --- a/include/llvm/MC/MCValue.h +++ b/include/llvm/MC/MCValue.h @@ -40,7 +40,8 @@ public: MCSymbol *getSymA() const { return SymA; } MCSymbol *getSymB() const { return SymB; } - bool isConstant() const { return !SymA && !SymB; } + /// isAbsolute - Is this an absolute (as opposed to relocatable) value. + bool isAbsolute() const { return !SymA && !SymB; } /// getAssociatedSection - For relocatable values, return the section the /// value is associated with. diff --git a/tools/llvm-mc/AsmExpr.cpp b/tools/llvm-mc/AsmExpr.cpp index 4b32b92293..c3362e4268 100644 --- a/tools/llvm-mc/AsmExpr.cpp +++ b/tools/llvm-mc/AsmExpr.cpp @@ -19,7 +19,7 @@ AsmExpr::~AsmExpr() { bool AsmExpr::EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const { MCValue Value; - if (!EvaluateAsRelocatable(Ctx, Value) || !Value.isConstant()) + if (!EvaluateAsRelocatable(Ctx, Value) || !Value.isAbsolute()) return false; Res = Value.getConstant(); @@ -75,7 +75,7 @@ bool AsmExpr::EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const { switch (AUE->getOpcode()) { case AsmUnaryExpr::LNot: - if (!Value.isConstant()) + if (!Value.isAbsolute()) return false; Res = MCValue::get(!Value.getConstant()); break; @@ -87,7 +87,7 @@ bool AsmExpr::EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const { -Value.getConstant()); break; case AsmUnaryExpr::Not: - if (!Value.isConstant()) + if (!Value.isAbsolute()) return false; Res = MCValue::get(~Value.getConstant()); break; @@ -109,7 +109,7 @@ bool AsmExpr::EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const { // We only support a few operations on non-constant expressions, handle // those first. - if (!LHSValue.isConstant() || !RHSValue.isConstant()) { + if (!LHSValue.isAbsolute() || !RHSValue.isAbsolute()) { switch (ABE->getOpcode()) { default: return false; |