diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2010-03-23 23:47:07 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2010-03-23 23:47:07 +0000 |
| commit | 5cfb58719d56ed7769a179b7a75438983c73e624 (patch) | |
| tree | 6ca778f8ff55fe6f8474d6b63de8130a278a6b7e /llvm/lib/MC | |
| parent | b424faa09cf7900f056d70a4cbe99e2ddfacecd4 (diff) | |
| download | bcm5719-llvm-5cfb58719d56ed7769a179b7a75438983c73e624.tar.gz bcm5719-llvm-5cfb58719d56ed7769a179b7a75438983c73e624.zip | |
llvm-mc: Fast path EvaluateAbsolute of constants.
llvm-svn: 99348
Diffstat (limited to 'llvm/lib/MC')
| -rw-r--r-- | llvm/lib/MC/MCExpr.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp index 275994431ee..d0025f3f3f6 100644 --- a/llvm/lib/MC/MCExpr.cpp +++ b/llvm/lib/MC/MCExpr.cpp @@ -194,6 +194,12 @@ void MCTargetExpr::Anchor() {} 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; |

