aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MC
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-03-23 03:13:05 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-03-23 03:13:05 +0000
commit337055e62f28f18a9a8c4a090633cae1c2256ae1 (patch)
tree18a00928afa5902aa07967f5e3f2492e6f59b97c /lib/MC
parent8f9b80e5df12779a56d763ebf20864dad2bc72da (diff)
downloadexternal_llvm-337055e62f28f18a9a8c4a090633cae1c2256ae1.zip
external_llvm-337055e62f28f18a9a8c4a090633cae1c2256ae1.tar.gz
external_llvm-337055e62f28f18a9a8c4a090633cae1c2256ae1.tar.bz2
MC: Add TargetAsmBackend::MayNeedRelaxation, for checking whether a particular instruction + fixups might need relaxation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99249 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r--lib/MC/MCAssembler.cpp2
-rw-r--r--lib/MC/MCMachOStreamer.cpp15
2 files changed, 12 insertions, 5 deletions
diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp
index 7672528..031820d 100644
--- a/lib/MC/MCAssembler.cpp
+++ b/lib/MC/MCAssembler.cpp
@@ -715,7 +715,7 @@ void MCAssembler::FinishLayout(MCAsmLayout &Layout) {
// Create a new data fragment for the instruction.
//
- // FIXME: Reuse previous data fragment if possible.
+ // FIXME-PERF: Reuse previous data fragment if possible.
MCDataFragment *DF = new MCDataFragment();
SD.getFragmentList().insert(it2, DF);
diff --git a/lib/MC/MCMachOStreamer.cpp b/lib/MC/MCMachOStreamer.cpp
index a52d962..2a1aa27 100644
--- a/lib/MC/MCMachOStreamer.cpp
+++ b/lib/MC/MCMachOStreamer.cpp
@@ -383,12 +383,19 @@ void MCMachOStreamer::EmitInstruction(const MCInst &Inst) {
Assembler.getEmitter().EncodeInstruction(Inst, VecOS, Fixups);
VecOS.flush();
- // Add the fixups and data.
- MCDataFragment *DF = getOrCreateDataFragment();
+ // FIXME: Eliminate this copy.
+ SmallVector<MCAsmFixup, 4> AsmFixups;
for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
MCFixup &F = Fixups[i];
- DF->addFixup(MCAsmFixup(DF->getContents().size()+F.getOffset(),
- *F.getValue(), F.getKind()));
+ AsmFixups.push_back(MCAsmFixup(F.getOffset(), *F.getValue(),
+ F.getKind()));
+ }
+
+ // Add the fixups and data.
+ MCDataFragment *DF = getOrCreateDataFragment();
+ for (unsigned i = 0, e = AsmFixups.size(); i != e; ++i) {
+ AsmFixups[i].Offset += DF->getContents().size();
+ DF->addFixup(AsmFixups[i]);
}
DF->getContents().append(Code.begin(), Code.end());
}