- // Avoid fixups when possible.
- int64_t AbsValue;
- if (AddValueSymbols(Value)->EvaluateAsAbsolute(AbsValue)) {
- // FIXME: Endianness assumption.
- for (unsigned i = 0; i != Size; ++i)
- DF->getContents().push_back(uint8_t(AbsValue >> (i * 8)));
- } else {
- DF->addFixup(MCAsmFixup(DF->getContents().size(), *AddValueSymbols(Value),
- MCFixup::getKindForSize(Size)));
- DF->getContents().resize(DF->getContents().size() + Size, 0);
- }
-}
-
-void MCMachOStreamer::EmitValueToAlignment(unsigned ByteAlignment,
- int64_t Value, unsigned ValueSize,
- unsigned MaxBytesToEmit) {
- if (MaxBytesToEmit == 0)
- MaxBytesToEmit = ByteAlignment;
- MCFragment *F = new MCAlignFragment(ByteAlignment, Value, ValueSize,
- MaxBytesToEmit, /*EmitNops=*/false,
- CurSectionData);
- F->setAtom(CurrentAtomMap.lookup(CurSectionData));
-
- // Update the maximum alignment on the current section if necessary.
- if (ByteAlignment > CurSectionData->getAlignment())
- CurSectionData->setAlignment(ByteAlignment);
-}
-
-void MCMachOStreamer::EmitCodeAlignment(unsigned ByteAlignment,
- unsigned MaxBytesToEmit) {
- if (MaxBytesToEmit == 0)
- MaxBytesToEmit = ByteAlignment;
- MCFragment *F = new MCAlignFragment(ByteAlignment, 0, 1, MaxBytesToEmit,
- /*EmitNops=*/true, CurSectionData);
- F->setAtom(CurrentAtomMap.lookup(CurSectionData));
-
- // Update the maximum alignment on the current section if necessary.
- if (ByteAlignment > CurSectionData->getAlignment())
- CurSectionData->setAlignment(ByteAlignment);
-}
-
-void MCMachOStreamer::EmitValueToOffset(const MCExpr *Offset,
- unsigned char Value) {
- MCFragment *F = new MCOrgFragment(*Offset, Value, CurSectionData);
- F->setAtom(CurrentAtomMap.lookup(CurSectionData));
-}
-
-void MCMachOStreamer::EmitInstruction(const MCInst &Inst) {
- // Scan for values.
- for (unsigned i = 0; i != Inst.getNumOperands(); ++i)
- if (Inst.getOperand(i).isExpr())
- AddValueSymbols(Inst.getOperand(i).getExpr());
-
- CurSectionData->setHasInstructions(true);
-
- // FIXME-PERF: Common case is that we don't need to relax, encode directly
- // onto the data fragments buffers.
-