llvm-mc/Mach-O: Support byte and fill value emission.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79652 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/MC/MCMachOStreamer.cpp b/lib/MC/MCMachOStreamer.cpp
index f34fcd9..0ad0327 100644
--- a/lib/MC/MCMachOStreamer.cpp
+++ b/lib/MC/MCMachOStreamer.cpp
@@ -139,22 +139,28 @@
}
void MCMachOStreamer::EmitBytes(const StringRef &Data) {
- llvm_unreachable("FIXME: Not yet implemented!");
+ MCDataFragment *DF = new MCDataFragment(CurSectionData);
+ DF->getContents().append(Data.begin(), Data.end());
}
void MCMachOStreamer::EmitValue(const MCValue &Value, unsigned Size) {
- llvm_unreachable("FIXME: Not yet implemented!");
+ new MCFillFragment(Value, Size, 1, CurSectionData);
}
void MCMachOStreamer::EmitValueToAlignment(unsigned ByteAlignment,
int64_t Value, unsigned ValueSize,
unsigned MaxBytesToEmit) {
- llvm_unreachable("FIXME: Not yet implemented!");
+ new MCAlignFragment(ByteAlignment, Value, ValueSize, MaxBytesToEmit,
+ CurSectionData);
+
+ // Update the maximum alignment on the current section if necessary
+ if (ByteAlignment > CurSectionData->getAlignment())
+ CurSectionData->setAlignment(ByteAlignment);
}
void MCMachOStreamer::EmitValueToOffset(const MCValue &Offset,
unsigned char Value) {
- llvm_unreachable("FIXME: Not yet implemented!");
+ new MCOrgFragment(Offset, Value, 1, CurSectionData);
}
void MCMachOStreamer::EmitInstruction(const MCInst &Inst) {