mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-14 17:34:41 +00:00
MC: Constify MCAsmLayout argument to MCExpr::EvaluteAs...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98380 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8315a357e4
commit
a0e36d55c4
@ -28,7 +28,7 @@ public:
|
|||||||
MCAsmLayout(MCAssembler &_Assembler) : Assembler(_Assembler) {}
|
MCAsmLayout(MCAssembler &_Assembler) : Assembler(_Assembler) {}
|
||||||
|
|
||||||
/// Get the assembler object this is a layout for.
|
/// Get the assembler object this is a layout for.
|
||||||
MCAssembler &getAssembler() { return Assembler; }
|
MCAssembler &getAssembler() const { return Assembler; }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
@ -204,7 +204,8 @@ class MCAlignFragment : public MCFragment {
|
|||||||
/// cannot be satisfied in this width then this fragment is ignored.
|
/// cannot be satisfied in this width then this fragment is ignored.
|
||||||
unsigned MaxBytesToEmit;
|
unsigned MaxBytesToEmit;
|
||||||
|
|
||||||
/// EmitNops - true when aligning code and optimal nops to be used for filling
|
/// EmitNops - true when aligning code and optimal nops to be used for
|
||||||
|
/// filling.
|
||||||
bool EmitNops;
|
bool EmitNops;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -704,8 +705,8 @@ public:
|
|||||||
/// @name Backend Data Access
|
/// @name Backend Data Access
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
MCSectionData &getSectionData(const MCSection &Section) {
|
MCSectionData &getSectionData(const MCSection &Section) const {
|
||||||
MCSectionData *&Entry = SectionMap[&Section];
|
MCSectionData *Entry = SectionMap.lookup(&Section);
|
||||||
assert(Entry && "Missing section data!");
|
assert(Entry && "Missing section data!");
|
||||||
return *Entry;
|
return *Entry;
|
||||||
}
|
}
|
||||||
@ -721,8 +722,8 @@ public:
|
|||||||
return *Entry;
|
return *Entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSymbolData &getSymbolData(const MCSymbol &Symbol) {
|
MCSymbolData &getSymbolData(const MCSymbol &Symbol) const {
|
||||||
MCSymbolData *&Entry = SymbolMap[&Symbol];
|
MCSymbolData *Entry = SymbolMap.lookup(&Symbol);
|
||||||
assert(Entry && "Missing symbol data!");
|
assert(Entry && "Missing symbol data!");
|
||||||
return *Entry;
|
return *Entry;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ public:
|
|||||||
/// values. If not given, then only non-symbolic expressions will be
|
/// values. If not given, then only non-symbolic expressions will be
|
||||||
/// evaluated.
|
/// evaluated.
|
||||||
/// @result - True on success.
|
/// @result - True on success.
|
||||||
bool EvaluateAsAbsolute(int64_t &Res, MCAsmLayout *Layout = 0) const;
|
bool EvaluateAsAbsolute(int64_t &Res, const MCAsmLayout *Layout = 0) const;
|
||||||
|
|
||||||
/// EvaluateAsRelocatable - Try to evaluate the expression to a relocatable
|
/// EvaluateAsRelocatable - Try to evaluate the expression to a relocatable
|
||||||
/// value, i.e. an expression of the fixed form (a - b + constant).
|
/// value, i.e. an expression of the fixed form (a - b + constant).
|
||||||
@ -75,13 +75,13 @@ public:
|
|||||||
/// @param Res - The relocatable value, if evaluation succeeds.
|
/// @param Res - The relocatable value, if evaluation succeeds.
|
||||||
/// @param Layout - The assembler layout object to use for evaluating values.
|
/// @param Layout - The assembler layout object to use for evaluating values.
|
||||||
/// @result - True on success.
|
/// @result - True on success.
|
||||||
bool EvaluateAsRelocatable(MCValue &Res, MCAsmLayout *Layout = 0) const;
|
bool EvaluateAsRelocatable(MCValue &Res, const MCAsmLayout *Layout = 0) const;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
static bool classof(const MCExpr *) { return true; }
|
static bool classof(const MCExpr *) { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
inline raw_ostream &operator<<(raw_ostream &OS, const MCExpr &E) {
|
inline raw_ostream &operator<<(raw_ostream &OS, const MCExpr &E) {
|
||||||
E.print(OS);
|
E.print(OS);
|
||||||
return OS;
|
return OS;
|
||||||
@ -351,12 +351,12 @@ protected:
|
|||||||
MCTargetExpr() : MCExpr(Target) {}
|
MCTargetExpr() : MCExpr(Target) {}
|
||||||
virtual ~MCTargetExpr() {}
|
virtual ~MCTargetExpr() {}
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void PrintImpl(raw_ostream &OS) const = 0;
|
virtual void PrintImpl(raw_ostream &OS) const = 0;
|
||||||
virtual bool EvaluateAsRelocatableImpl(MCValue &Res,
|
virtual bool EvaluateAsRelocatableImpl(MCValue &Res,
|
||||||
MCAsmLayout *Layout) const = 0;
|
const MCAsmLayout *Layout) const = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static bool classof(const MCExpr *E) {
|
static bool classof(const MCExpr *E) {
|
||||||
return E->getKind() == MCExpr::Target;
|
return E->getKind() == MCExpr::Target;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ void MCTargetExpr::Anchor() {}
|
|||||||
|
|
||||||
/* *** */
|
/* *** */
|
||||||
|
|
||||||
bool MCExpr::EvaluateAsAbsolute(int64_t &Res, MCAsmLayout *Layout) const {
|
bool MCExpr::EvaluateAsAbsolute(int64_t &Res, const MCAsmLayout *Layout) const {
|
||||||
MCValue Value;
|
MCValue Value;
|
||||||
|
|
||||||
if (!EvaluateAsRelocatable(Value, Layout) || !Value.isAbsolute())
|
if (!EvaluateAsRelocatable(Value, Layout) || !Value.isAbsolute())
|
||||||
@ -177,7 +177,8 @@ static bool EvaluateSymbolicAdd(const MCValue &LHS, const MCSymbol *RHS_A,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCExpr::EvaluateAsRelocatable(MCValue &Res, MCAsmLayout *Layout) const {
|
bool MCExpr::EvaluateAsRelocatable(MCValue &Res,
|
||||||
|
const MCAsmLayout *Layout) const {
|
||||||
switch (getKind()) {
|
switch (getKind()) {
|
||||||
case Target:
|
case Target:
|
||||||
return cast<MCTargetExpr>(this)->EvaluateAsRelocatableImpl(Res, Layout);
|
return cast<MCTargetExpr>(this)->EvaluateAsRelocatableImpl(Res, Layout);
|
||||||
|
@ -37,7 +37,7 @@ void X86MCTargetExpr::PrintImpl(raw_ostream &OS) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool X86MCTargetExpr::EvaluateAsRelocatableImpl(MCValue &Res,
|
bool X86MCTargetExpr::EvaluateAsRelocatableImpl(MCValue &Res,
|
||||||
MCAsmLayout *Layout) const {
|
const MCAsmLayout *Layout) const {
|
||||||
// FIXME: I don't know if this is right, it followed MCSymbolRefExpr.
|
// FIXME: I don't know if this is right, it followed MCSymbolRefExpr.
|
||||||
|
|
||||||
// Evaluate recursively if this is a variable.
|
// Evaluate recursively if this is a variable.
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
MCContext &Ctx);
|
MCContext &Ctx);
|
||||||
|
|
||||||
void PrintImpl(raw_ostream &OS) const;
|
void PrintImpl(raw_ostream &OS) const;
|
||||||
bool EvaluateAsRelocatableImpl(MCValue &Res, MCAsmLayout *Layout) const;
|
bool EvaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
Loading…
x
Reference in New Issue
Block a user