[llvm-commits] [llvm] r98380 - in /llvm/trunk: include/llvm/MC/MCAsmLayout.h include/llvm/MC/MCAssembler.h include/llvm/MC/MCExpr.h lib/MC/MCExpr.cpp lib/Target/X86/X86MCTargetExpr.cpp lib/Target/X86/X86MCTargetExpr.h
Daniel Dunbar
daniel at zuster.org
Fri Mar 12 13:00:45 PST 2010
Author: ddunbar
Date: Fri Mar 12 15:00:45 2010
New Revision: 98380
URL: http://llvm.org/viewvc/llvm-project?rev=98380&view=rev
Log:
MC: Constify MCAsmLayout argument to MCExpr::EvaluteAs...
Modified:
llvm/trunk/include/llvm/MC/MCAsmLayout.h
llvm/trunk/include/llvm/MC/MCAssembler.h
llvm/trunk/include/llvm/MC/MCExpr.h
llvm/trunk/lib/MC/MCExpr.cpp
llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp
llvm/trunk/lib/Target/X86/X86MCTargetExpr.h
Modified: llvm/trunk/include/llvm/MC/MCAsmLayout.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmLayout.h?rev=98380&r1=98379&r2=98380&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmLayout.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmLayout.h Fri Mar 12 15:00:45 2010
@@ -28,7 +28,7 @@
MCAsmLayout(MCAssembler &_Assembler) : Assembler(_Assembler) {}
/// Get the assembler object this is a layout for.
- MCAssembler &getAssembler() { return Assembler; }
+ MCAssembler &getAssembler() const { return Assembler; }
};
} // end namespace llvm
Modified: llvm/trunk/include/llvm/MC/MCAssembler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAssembler.h?rev=98380&r1=98379&r2=98380&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAssembler.h (original)
+++ llvm/trunk/include/llvm/MC/MCAssembler.h Fri Mar 12 15:00:45 2010
@@ -204,7 +204,8 @@
/// cannot be satisfied in this width then this fragment is ignored.
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;
public:
@@ -704,8 +705,8 @@
/// @name Backend Data Access
/// @{
- MCSectionData &getSectionData(const MCSection &Section) {
- MCSectionData *&Entry = SectionMap[&Section];
+ MCSectionData &getSectionData(const MCSection &Section) const {
+ MCSectionData *Entry = SectionMap.lookup(&Section);
assert(Entry && "Missing section data!");
return *Entry;
}
@@ -721,8 +722,8 @@
return *Entry;
}
- MCSymbolData &getSymbolData(const MCSymbol &Symbol) {
- MCSymbolData *&Entry = SymbolMap[&Symbol];
+ MCSymbolData &getSymbolData(const MCSymbol &Symbol) const {
+ MCSymbolData *Entry = SymbolMap.lookup(&Symbol);
assert(Entry && "Missing symbol data!");
return *Entry;
}
Modified: llvm/trunk/include/llvm/MC/MCExpr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCExpr.h?rev=98380&r1=98379&r2=98380&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCExpr.h (original)
+++ llvm/trunk/include/llvm/MC/MCExpr.h Fri Mar 12 15:00:45 2010
@@ -67,7 +67,7 @@
/// values. If not given, then only non-symbolic expressions will be
/// evaluated.
/// @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
/// value, i.e. an expression of the fixed form (a - b + constant).
@@ -75,13 +75,13 @@
/// @param Res - The relocatable value, if evaluation succeeds.
/// @param Layout - The assembler layout object to use for evaluating values.
/// @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; }
};
-
+
inline raw_ostream &operator<<(raw_ostream &OS, const MCExpr &E) {
E.print(OS);
return OS;
@@ -351,12 +351,12 @@
MCTargetExpr() : MCExpr(Target) {}
virtual ~MCTargetExpr() {}
public:
-
+
virtual void PrintImpl(raw_ostream &OS) const = 0;
virtual bool EvaluateAsRelocatableImpl(MCValue &Res,
- MCAsmLayout *Layout) const = 0;
+ const MCAsmLayout *Layout) const = 0;
+
-
static bool classof(const MCExpr *E) {
return E->getKind() == MCExpr::Target;
}
Modified: llvm/trunk/lib/MC/MCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=98380&r1=98379&r2=98380&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCExpr.cpp (original)
+++ llvm/trunk/lib/MC/MCExpr.cpp Fri Mar 12 15:00:45 2010
@@ -145,7 +145,7 @@
/* *** */
-bool MCExpr::EvaluateAsAbsolute(int64_t &Res, MCAsmLayout *Layout) const {
+bool MCExpr::EvaluateAsAbsolute(int64_t &Res, const MCAsmLayout *Layout) const {
MCValue Value;
if (!EvaluateAsRelocatable(Value, Layout) || !Value.isAbsolute())
@@ -177,7 +177,8 @@
return true;
}
-bool MCExpr::EvaluateAsRelocatable(MCValue &Res, MCAsmLayout *Layout) const {
+bool MCExpr::EvaluateAsRelocatable(MCValue &Res,
+ const MCAsmLayout *Layout) const {
switch (getKind()) {
case Target:
return cast<MCTargetExpr>(this)->EvaluateAsRelocatableImpl(Res, Layout);
Modified: llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp?rev=98380&r1=98379&r2=98380&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp Fri Mar 12 15:00:45 2010
@@ -37,7 +37,7 @@
}
bool X86MCTargetExpr::EvaluateAsRelocatableImpl(MCValue &Res,
- MCAsmLayout *Layout) const {
+ const MCAsmLayout *Layout) const {
// FIXME: I don't know if this is right, it followed MCSymbolRefExpr.
// Evaluate recursively if this is a variable.
Modified: llvm/trunk/lib/Target/X86/X86MCTargetExpr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCTargetExpr.h?rev=98380&r1=98379&r2=98380&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86MCTargetExpr.h (original)
+++ llvm/trunk/lib/Target/X86/X86MCTargetExpr.h Fri Mar 12 15:00:45 2010
@@ -41,7 +41,7 @@
MCContext &Ctx);
void PrintImpl(raw_ostream &OS) const;
- bool EvaluateAsRelocatableImpl(MCValue &Res, MCAsmLayout *Layout) const;
+ bool EvaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout) const;
};
} // end namespace llvm
More information about the llvm-commits
mailing list