Skip to content

Commit 869c2a9

Browse files
committed
[PowerPC] Simplify evaluateAsRelocatableImpl
In addition, rename *MCExpr::getKind, which confusingly shadows the base class getKind.
1 parent f81e3f2 commit 869c2a9

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static PPCMCExpr::Specifier getAccessVariant(const MCValue &Target,
4444

4545
if (Expr->getKind() != MCExpr::Target)
4646
return PPCMCExpr::Specifier(Target.getAccessVariant());
47-
return cast<PPCMCExpr>(Expr)->getKind();
47+
return cast<PPCMCExpr>(Expr)->getSpecifier();
4848
}
4949

5050
unsigned PPCELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target,

llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ bool PPCMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
8585
if (Res.isAbsolute() && MaybeInt) {
8686
Res = MCValue::get(*MaybeInt);
8787
} else {
88-
Res = MCValue::get(Res.getSymA(), Res.getSymB(), Res.getConstant(),
89-
getKind());
88+
Res.setSpecifier(specifier);
9089
}
9190

9291
return true;

llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,7 @@ class PPCMCExpr : public MCTargetExpr {
131131
/// @name Accessors
132132
/// @{
133133

134-
Specifier getKind() const { return specifier; }
135-
136-
/// getSubExpr - Get the child of this expression.
134+
Specifier getSpecifier() const { return specifier; }
137135
const MCExpr *getSubExpr() const { return Expr; }
138136

139137
/// @}

0 commit comments

Comments
 (0)