[llvm-commits] [llvm] r79652 - in /llvm/trunk: include/llvm/MC/MCAssembler.h lib/MC/MCAssembler.cpp lib/MC/MCMachOStreamer.cpp test/MC/MachO/data.s
Chris Lattner
clattner at apple.com
Sat Aug 22 12:32:03 PDT 2009
On Aug 21, 2009, at 11:29 AM, Daniel Dunbar wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=79652&view=rev
> Log:
> llvm-mc/Mach-O: Support byte and fill value emission.
> +++ llvm/trunk/include/llvm/MC/MCAssembler.h Fri Aug 21 13:29:01
> 2009@@ -63,26 +275,44 @@
> MCSectionData();
> MCSectionData(const MCSection &Section, MCAssembler *A = 0);
>
> const MCSection &getSection() const { return Section; }
>
> unsigned getAlignment() const { return Alignment; }
> void setAlignment(unsigned Value) { Alignment = Value; }
>
> +
> + /// @name Section List Access
> + /// @{
> +
> + const FragmentListType &getFragmentList() const { return
> Fragments; }
> + FragmentListType &getFragmentList() { return Fragments; }
> +
> + iterator begin() { return Fragments.begin(); }
> + const_iterator begin() const { return Fragments.begin(); }
frag_begin/frag_size, etc please.
> + unsigned getFileSize() const {
> + assert(FileSize != ~UINT64_C(0) && "File size not set!");
You can just use "!= ~0ULL" which we do all over the code base.
>
> +/// WriteFileData - Write the \arg F data to the output file.
> +static void WriteFileData(raw_ostream &OS, const MCFragment &F,
> + MachObjectWriter &MOW) {
> + uint64_t Start = OS.tell();
> + (void) Start;
> +
> + // FIXME: Embed in fragments instead?
I think it could make sense for this to be a virtual method on
fragment. I can see targets wanting to be able to define their own
target-specific Fragment types, so making Fragment be "really virtual"
and avoiding switch statements is probably best.
> void MCMachOStreamer::EmitValue(const MCValue &Value, unsigned Size) {
> - llvm_unreachable("FIXME: Not yet implemented!");
> + new MCFillFragment(Value, Size, 1, CurSectionData);
Silly optimization idea, if the fill size is small it might be better
to append this to a data fragment if active
-Chris
More information about the llvm-commits
mailing list