llvm-mc: Fast path EvaluateAbsolute of constants.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99348 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2010-03-23 23:47:07 +00:00
parent 9972aff7da
commit ef6e96f91f

View File

@ -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;