[llvm-commits] [llvm] r99348 - /llvm/trunk/lib/MC/MCExpr.cpp
Daniel Dunbar
daniel at zuster.org
Tue Mar 23 16:47:07 PDT 2010
Author: ddunbar
Date: Tue Mar 23 18:47:07 2010
New Revision: 99348
URL: http://llvm.org/viewvc/llvm-project?rev=99348&view=rev
Log:
llvm-mc: Fast path EvaluateAbsolute of constants.
Modified:
llvm/trunk/lib/MC/MCExpr.cpp
Modified: llvm/trunk/lib/MC/MCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=99348&r1=99347&r2=99348&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCExpr.cpp (original)
+++ llvm/trunk/lib/MC/MCExpr.cpp Tue Mar 23 18:47:07 2010
@@ -194,6 +194,12 @@
bool MCExpr::EvaluateAsAbsolute(int64_t &Res, const MCAsmLayout *Layout) const {
MCValue Value;
+ // Fast path constants.
+ if (const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(this)) {
+ Res = CE->getValue();
+ return true;
+ }
+
if (!EvaluateAsRelocatable(Value, Layout) || !Value.isAbsolute())
return false;
More information about the llvm-commits
mailing list