[llvm-commits] [llvm] r141557 - in /llvm/trunk: include/llvm/MC/MCAtom.h lib/MC/MCAtom.cpp
Owen Anderson
resistor at mac.com
Mon Oct 10 11:09:38 PDT 2011
Author: resistor
Date: Mon Oct 10 13:09:38 2011
New Revision: 141557
URL: http://llvm.org/viewvc/llvm-project?rev=141557&view=rev
Log:
MCAtom extending methods need to extend the range of the atom as well.
Modified:
llvm/trunk/include/llvm/MC/MCAtom.h
llvm/trunk/lib/MC/MCAtom.cpp
Modified: llvm/trunk/include/llvm/MC/MCAtom.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAtom.h?rev=141557&r1=141556&r2=141557&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAtom.h (original)
+++ llvm/trunk/include/llvm/MC/MCAtom.h Mon Oct 10 13:09:38 2011
@@ -49,15 +49,8 @@
bool isTextAtom() { return Type == TextAtom; }
bool isDataAtom() { return Type == DataAtom; }
- void addInst(const MCInst &I, uint64_t Address) {
- assert(Type == TextAtom && "Trying to add MCInst to a non-text atom!");
- Text.push_back(std::make_pair(Address, I));
- }
-
- void addData(const MCData &D) {
- assert(Type == DataAtom && "Trying to add MCData to a non-data atom!");
- Data.push_back(D);
- }
+ void addInst(const MCInst &I, uint64_t Address, unsigned Size);
+ void addData(const MCData &D);
/// split - Splits the atom in two at a given address, which must align with
/// and instruction boundary if this is a TextAtom. Returns the newly created
Modified: llvm/trunk/lib/MC/MCAtom.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAtom.cpp?rev=141557&r1=141556&r2=141557&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAtom.cpp (original)
+++ llvm/trunk/lib/MC/MCAtom.cpp Mon Oct 10 13:09:38 2011
@@ -13,6 +13,24 @@
using namespace llvm;
+void MCAtom::addInst(const MCInst &I, uint64_t Address, unsigned Size) {
+ assert(Type == TextAtom && "Trying to add MCInst to a non-text atom!");
+
+ assert(Address < End+Size &&
+ "Instruction not contiguous with end of atom!");
+ if (Address > End)
+ Parent->remap(this, Begin, End+Size);
+
+ Text.push_back(std::make_pair(Address, I));
+}
+
+void MCAtom::addData(const MCData &D) {
+ assert(Type == DataAtom && "Trying to add MCData to a non-data atom!");
+ Parent->remap(this, Begin, End+1);
+
+ Data.push_back(D);
+}
+
MCAtom *MCAtom::split(uint64_t SplitPt) {
assert((SplitPt > Begin && SplitPt <= End) &&
"Splitting at point not contained in atom!");
More information about the llvm-commits
mailing list