<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div><div>On Sep 19, 2010, at 10:36 PM, Jason Kim wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Double oops.<br>I somehow missed a compile breaking typo.<br>Apologies for the noise.<br>Tested against clean build dir.<br><span><arm-mc-elf-s01.patch4></span></div></blockquote></div><br><div><br></div><div><blockquote type="cite"><div><font class="Apple-style-span" color="#000000">Index: lib/Target/X86/X86TargetMachine.cpp</font></div><div><font class="Apple-style-span" color="#000000">===================================================================</font></div><div><font class="Apple-style-span" color="#000000">--- lib/Target/X86/X86TargetMachine.cpp</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">        </font></span><font class="Apple-style-span" color="#000000">(revision 114214)</font></div><div><font class="Apple-style-span" color="#000000">+++ lib/Target/X86/X86TargetMachine.cpp</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">   </font></span><font class="Apple-style-span" color="#000000">(working copy)</font></div><div><font class="Apple-style-span" color="#000000">@@ -39,11 +39,11 @@</font></div><div><font class="Apple-style-span" color="#000000">   }</font></div><div><font class="Apple-style-span" color="#000000"> }</font></div><div><font class="Apple-style-span" color="#000000"><br></font></div><div><font class="Apple-style-span" color="#000000">-static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,</font></div><div><font class="Apple-style-span" color="#000000">-                                    MCContext &Ctx, TargetAsmBackend &TAB,</font></div><div><font class="Apple-style-span" color="#000000">-                                    raw_ostream &_OS,</font></div><div><font class="Apple-style-span" color="#000000">-                                    MCCodeEmitter *_Emitter,</font></div><div><font class="Apple-style-span" color="#000000">-                                    bool RelaxAll) {</font></div><div><font class="Apple-style-span" color="#000000">+static MCStreamer *createX86MCStreamer(const Target &T, const std::string &TT,</font></div><div><font class="Apple-style-span" color="#000000">+                                       MCContext &Ctx, TargetAsmBackend &TAB,</font></div><div><font class="Apple-style-span" color="#000000">+                                       raw_ostream &_OS,</font></div><div><font class="Apple-style-span" color="#000000">+                                       MCCodeEmitter *_Emitter,</font></div><div><font class="Apple-style-span" color="#000000">+                                       bool RelaxAll) {</font></div></blockquote><div><br></div><div>Why is this rename necessary? It's a static function, so there's no namespace collision with anything in another target.</div><br><blockquote type="cite"><div><font class="Apple-style-span" color="#000000">   Triple TheTriple(TT);</font></div><div><font class="Apple-style-span" color="#000000">   switch (TheTriple.getOS()) {</font></div><div><font class="Apple-style-span" color="#000000">   case Triple::Darwin:</font></div><div><font class="Apple-style-span" color="#000000">@@ -58,7 +58,7 @@</font></div><div><font class="Apple-style-span" color="#000000">   }</font></div><div><font class="Apple-style-span" color="#000000"> }</font></div><div><font class="Apple-style-span" color="#000000"><br></font></div><div><font class="Apple-style-span" color="#000000">-extern "C" void LLVMInitializeX86Target() {</font></div><div><font class="Apple-style-span" color="#000000">+extern "C" void LLVMInitializeX86Target() {</font></div><div><font class="Apple-style-span" color="#000000">   // Register the target.</font></div><div><font class="Apple-style-span" color="#000000">   RegisterTargetMachine<X86_32TargetMachine> X(TheX86_32Target);</font></div><div><font class="Apple-style-span" color="#000000">   RegisterTargetMachine<X86_64TargetMachine> Y(TheX86_64Target);</font></div><div><font class="Apple-style-span" color="#000000">@@ -81,9 +81,9 @@</font></div><div><font class="Apple-style-span" color="#000000"><br></font></div><div><font class="Apple-style-span" color="#000000">   // Register the object streamer.</font></div><div><font class="Apple-style-span" color="#000000">   TargetRegistry::RegisterObjectStreamer(TheX86_32Target,</font></div><div><font class="Apple-style-span" color="#000000">-                                         createMCStreamer);</font></div><div><font class="Apple-style-span" color="#000000">+                                         createX86MCStreamer);</font></div><div><font class="Apple-style-span" color="#000000">   TargetRegistry::RegisterObjectStreamer(TheX86_64Target,</font></div><div><font class="Apple-style-span" color="#000000">-                                         createMCStreamer);</font></div><div><font class="Apple-style-span" color="#000000">+                                         createX86MCStreamer);</font></div><div><font class="Apple-style-span" color="#000000"> }</font></div><div><font class="Apple-style-span" color="#000000"><br></font></div><div><font class="Apple-style-span" color="#000000"><br></font></div><div><font class="Apple-style-span" color="#000000">@@ -100,9 +100,9 @@</font></div><div><font class="Apple-style-span" color="#000000"><br></font></div><div><font class="Apple-style-span" color="#000000"> /// X86TargetMachine ctor - Create an X86 target.</font></div><div><font class="Apple-style-span" color="#000000"> ///</font></div><div><font class="Apple-style-span" color="#000000">-X86TargetMachine::X86TargetMachine(const Target &T, const std::string &TT,</font></div><div><font class="Apple-style-span" color="#000000">+X86TargetMachine::X86TargetMachine(const Target &T, const std::string &TT,</font></div><div><font class="Apple-style-span" color="#000000">                                    const std::string &FS, bool is64Bit)</font></div><div><font class="Apple-style-span" color="#000000">-  : LLVMTargetMachine(T, TT),</font></div><div><font class="Apple-style-span" color="#000000">+  : LLVMTargetMachine(T, TT),</font></div><div><font class="Apple-style-span" color="#000000">     Subtarget(TT, FS, is64Bit),</font></div><div><font class="Apple-style-span" color="#000000">     DataLayout(Subtarget.getDataLayout()),</font></div><div><font class="Apple-style-span" color="#000000">     FrameInfo(TargetFrameInfo::StackGrowsDown,</font></div><div><font class="Apple-style-span" color="#000000">@@ -217,13 +217,13 @@</font></div><div><font class="Apple-style-span" color="#000000">                                       JITCodeEmitter &JCE) {</font></div><div><font class="Apple-style-span" color="#000000">   // FIXME: Move this to TargetJITInfo!</font></div><div><font class="Apple-style-span" color="#000000">   // On Darwin, do not override 64-bit setting made in X86TargetMachine().</font></div><div><font class="Apple-style-span" color="#000000">-  if (DefRelocModel == Reloc::Default &&</font></div><div><font class="Apple-style-span" color="#000000">+  if (DefRelocModel == Reloc::Default &&</font></div><div><font class="Apple-style-span" color="#000000">       (!Subtarget.isTargetDarwin() || !Subtarget.is64Bit())) {</font></div><div><font class="Apple-style-span" color="#000000">     setRelocationModel(Reloc::Static);</font></div><div><font class="Apple-style-span" color="#000000">     Subtarget.setPICStyle(PICStyles::None);</font></div><div><font class="Apple-style-span" color="#000000">   }</font></div><div><font class="Apple-style-span" color="#000000">-</font></div><div><font class="Apple-style-span" color="#000000"><br></font></div><div><font class="Apple-style-span" color="#000000">+</font></div></blockquote><div><br></div><div>Looks like a few whitespace only changes slipped into the patch. It's best if cosmetic changes and functional changes are done in separate patches to make it easier to track which revisions are making "real" changes to the code.</div><br><blockquote type="cite"><div><font class="Apple-style-span" color="#000000">   PM.add(createX86JITCodeEmitterPass(*this, JCE));</font></div><div><font class="Apple-style-span" color="#000000"><br></font></div><div><font class="Apple-style-span" color="#000000">   return false;</font></div><div><font class="Apple-style-span" color="#000000">Index: lib/Target/ARM/ARMTargetMachine.cpp</font></div><div><font class="Apple-style-span" color="#000000">===================================================================</font></div><div><font class="Apple-style-span" color="#000000">--- lib/Target/ARM/ARMTargetMachine.cpp</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">    </font></span><font class="Apple-style-span" color="#000000">(revision 114214)</font></div><div><font class="Apple-style-span" color="#000000">+++ lib/Target/ARM/ARMTargetMachine.cpp</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">   </font></span><font class="Apple-style-span" color="#000000">(working copy)</font></div><div><font class="Apple-style-span" color="#000000">@@ -31,6 +31,27 @@</font></div><div><font class="Apple-style-span" color="#000000">   }</font></div><div><font class="Apple-style-span" color="#000000"> }</font></div><div><font class="Apple-style-span" color="#000000"><br></font></div><div><font class="Apple-style-span" color="#000000">+// TODO(jasonwkim): [2010/09/19 10:31:16 PDT (Sunday)]</font></div><div><font class="Apple-style-span" color="#000000">+// This is duplicated code. Refactor this.</font></div><div><font class="Apple-style-span" color="#000000">+static MCStreamer *createARMMCStreamer(const Target &T, const std::string &TT,</font></div></blockquote><div><br></div><div>It's static, so it doesn't technically need the "ARM" bit in the name. Not really a big deal, but I'd prefer changing things here to be consistent with X86 for now, then adjusting both later if it's more appropriate to include the prefix. That is, add new bits in a manner consistent with what's already there, then do the cleanup, or vice versa, but not both in the same patch. Same basic idea as above in that it keeps the patches small and single purpose, which makes them easier to test and review.</div><div><br></div><br><blockquote type="cite"><div><font class="Apple-style-span" color="#000000">+                                       MCContext &Ctx, TargetAsmBackend &TAB,</font></div><div><font class="Apple-style-span" color="#000000">+                                       raw_ostream &_OS,</font></div><div><font class="Apple-style-span" color="#000000">+                                       MCCodeEmitter *_Emitter,</font></div><div><font class="Apple-style-span" color="#000000">+                                       bool RelaxAll) {</font></div><div><font class="Apple-style-span" color="#000000">+  Triple TheTriple(TT);</font></div><div><font class="Apple-style-span" color="#000000">+  switch (TheTriple.getOS()) {</font></div><div><font class="Apple-style-span" color="#000000">+  case Triple::Darwin:</font></div><div><font class="Apple-style-span" color="#000000">+    return createMachOStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll);</font></div><div><font class="Apple-style-span" color="#000000">+  case Triple::MinGW32:</font></div><div><font class="Apple-style-span" color="#000000">+  case Triple::MinGW64:</font></div><div><font class="Apple-style-span" color="#000000">+  case Triple::Cygwin:</font></div><div><font class="Apple-style-span" color="#000000">+  case Triple::Win32:</font></div><div><font class="Apple-style-span" color="#000000">+    return createWinCOFFStreamer(Ctx, TAB, *_Emitter, _OS, RelaxAll);</font></div></blockquote><div><br></div><div>ARM doesn't currently have any intention of supporting any of the Windows targets, so these should be omitted here, or possibly trigger an assert.</div><br><blockquote type="cite"><div><font class="Apple-style-span" color="#000000">+  default:</font></div><div><font class="Apple-style-span" color="#000000">+    return createELFStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll);</font></div><div><font class="Apple-style-span" color="#000000">+  }</font></div><div><font class="Apple-style-span" color="#000000">+}</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000"> extern "C" void LLVMInitializeARMTarget() {</font></div><div><font class="Apple-style-span" color="#000000">   // Register the target.</font></div><div><font class="Apple-style-span" color="#000000">   RegisterTargetMachine<ARMTargetMachine> X(TheARMTarget);</font></div><div><font class="Apple-style-span" color="#000000">@@ -39,6 +60,19 @@</font></div><div><font class="Apple-style-span" color="#000000">   // Register the target asm info.</font></div><div><font class="Apple-style-span" color="#000000">   RegisterAsmInfoFn A(TheARMTarget, createMCAsmInfo);</font></div><div><font class="Apple-style-span" color="#000000">   RegisterAsmInfoFn B(TheThumbTarget, createMCAsmInfo);</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+  // Register the MC Code Emitter</font></div><div><font class="Apple-style-span" color="#000000">+  TargetRegistry::RegisterCodeEmitter(TheARMTarget,</font></div><div><font class="Apple-style-span" color="#000000">+                                      createARMMCCodeEmitter);</font></div><div><font class="Apple-style-span" color="#000000">+  TargetRegistry::RegisterCodeEmitter(TheThumbTarget,</font></div><div><font class="Apple-style-span" color="#000000">+                                      createARMMCCodeEmitter);</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+  // Register the object streamer.</font></div><div><font class="Apple-style-span" color="#000000">+  TargetRegistry::RegisterObjectStreamer(TheARMTarget,</font></div><div><font class="Apple-style-span" color="#000000">+                                         createARMMCStreamer);</font></div><div><font class="Apple-style-span" color="#000000">+  TargetRegistry::RegisterObjectStreamer(TheThumbTarget,</font></div><div><font class="Apple-style-span" color="#000000">+                                         createARMMCStreamer);</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000"> }</font></div><div><font class="Apple-style-span" color="#000000"><br></font></div><div><font class="Apple-style-span" color="#000000"> /// TargetMachine ctor - Create an ARM architecture model.</font></div><div><font class="Apple-style-span" color="#000000">@@ -46,23 +80,28 @@</font></div><div><font class="Apple-style-span" color="#000000"> ARMBaseTargetMachine::ARMBaseTargetMachine(const Target &T,</font></div><div><font class="Apple-style-span" color="#000000">                                            const std::string &TT,</font></div><div><font class="Apple-style-span" color="#000000">                                            const std::string &FS,</font></div><div><font class="Apple-style-span" color="#000000">+                                           StringRef TargetDescription,</font></div><div><font class="Apple-style-span" color="#000000">                                            bool isThumb)</font></div><div><font class="Apple-style-span" color="#000000">   : LLVMTargetMachine(T, TT),</font></div><div><font class="Apple-style-span" color="#000000">     Subtarget(TT, FS, isThumb),</font></div><div><font class="Apple-style-span" color="#000000">     FrameInfo(Subtarget),</font></div><div><font class="Apple-style-span" color="#000000">     JITInfo(),</font></div><div><font class="Apple-style-span" color="#000000">-    InstrItins(Subtarget.getInstrItineraryData()) {</font></div><div><font class="Apple-style-span" color="#000000">+    InstrItins(Subtarget.getInstrItineraryData()),</font></div><div><font class="Apple-style-span" color="#000000">+    DataLayout(TargetDescription),</font></div><div></div></blockquote><div><br></div><div> The TargetData is accessible from the TargetMachine instance via the getTargetData() accessor function. Is that not sufficient for what you're looking to accomplish?</div><br><blockquote type="cite"><div><font class="Apple-style-span" color="#000000">+    ELFWriterInfo(*this)</font></div><div></div></blockquote><div><br></div><div>This creates an ELFWriter() even when the target doesn't need or want one. That doesn't seem right. I see X86 does the same thing, though. Doesn't seem right there, either, but perhaps I'm missing something and someone familiar with that area can comment.</div><div><br></div><blockquote type="cite"><font class="Apple-style-span" color="#000000"><snip><br></font></blockquote><br><blockquote type="cite"><div><font class="Apple-style-span" color="#000000">Index: lib/Target/ARM/ARMELFWriterInfo.h</font></div><div><font class="Apple-style-span" color="#000000">===================================================================</font></div><div><font class="Apple-style-span" color="#000000">--- lib/Target/ARM/ARMELFWriterInfo.h</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">     </font></span><font class="Apple-style-span" color="#000000">(revision 0)</font></div><div><font class="Apple-style-span" color="#000000">+++ lib/Target/ARM/ARMELFWriterInfo.h</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">  </font></span><font class="Apple-style-span" color="#000000">(revision 0)</font></div><div><font class="Apple-style-span" color="#000000">@@ -0,0 +1,66 @@</font></div><div><font class="Apple-style-span" color="#000000">+//===-- ARMELFWriterInfo.h - ELF Writer Info for ARM ------------*- C++ -*-===//</font></div><div><font class="Apple-style-span" color="#000000">+//</font></div><div><font class="Apple-style-span" color="#000000">+//                     The LLVM Compiler Infrastructure</font></div><div><font class="Apple-style-span" color="#000000">+//</font></div><div><font class="Apple-style-span" color="#000000">+// This file is distributed under the University of Illinois Open Source</font></div><div><font class="Apple-style-span" color="#000000">+// License. See LICENSE.TXT for details.</font></div><div><font class="Apple-style-span" color="#000000">+//</font></div><div><font class="Apple-style-span" color="#000000">+//===----------------------------------------------------------------------===//</font></div><div><font class="Apple-style-span" color="#000000">+//</font></div><div><font class="Apple-style-span" color="#000000">+// This file implements ELF writer information for the ARM backend.</font></div><div><font class="Apple-style-span" color="#000000">+//</font></div><div><font class="Apple-style-span" color="#000000">+//===----------------------------------------------------------------------===//</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+#ifndef ARM_ELF_WRITER_INFO_H</font></div><div><font class="Apple-style-span" color="#000000">+#define ARM_ELF_WRITER_INFO_H</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+#include "llvm/Target/TargetELFWriterInfo.h"</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+namespace llvm {</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+  class ARMELFWriterInfo : public TargetELFWriterInfo {</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+    // ELF Relocation types for ARM</font></div><div><font class="Apple-style-span" color="#000000">+    // FIXME: TODO(jasonwkim): [2010/09/17 14:52:25 PDT (Friday)]</font></div></blockquote><div><br></div><div>FIXME's don't need name/date info. "svn annotate" does the trick for that information.</div><br><blockquote type="cite"><div><font class="Apple-style-span" color="#000000">+    // Come up with a better way to orgnize the 100+ ARM reloc types.</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+    enum ARMRelocationType {</font></div><div><font class="Apple-style-span" color="#000000">+    };</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+  public:</font></div><div><font class="Apple-style-span" color="#000000">+    ARMELFWriterInfo(TargetMachine &TM);</font></div><div><font class="Apple-style-span" color="#000000">+    virtual ~ARMELFWriterInfo();</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+    /// getRelocationType - Returns the target specific ELF Relocation type.</font></div><div><font class="Apple-style-span" color="#000000">+    /// 'MachineRelTy' contains the object code independent relocation type</font></div><div><font class="Apple-style-span" color="#000000">+    virtual unsigned getRelocationType(unsigned MachineRelTy) const;</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+    /// hasRelocationAddend - True if the target uses an addend in the</font></div><div><font class="Apple-style-span" color="#000000">+    /// ELF relocation entry.</font></div><div><font class="Apple-style-span" color="#000000">+    virtual bool hasRelocationAddend() const { return is64Bit ? true : false; }</font></div></blockquote><div><br></div><div>There's no 64-bit here. Should this always return 'false' for ARM? Probably shouldn't reference 64Bit in any case, I'd think.</div><div><br></div><blockquote type="cite"><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+    /// getDefaultAddendForRelTy - Gets the default addend value for a</font></div><div><font class="Apple-style-span" color="#000000">+    /// relocation entry based on the target ELF relocation type.</font></div><div><font class="Apple-style-span" color="#000000">+    virtual long int getDefaultAddendForRelTy(unsigned RelTy,</font></div><div><font class="Apple-style-span" color="#000000">+                                              long int Modifier = 0) const;</font></div><div></div></blockquote><div><br></div><blockquote type="cite"><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+    /// isPCRelativeRel - True if the relocation type is pc relative</font></div><div><font class="Apple-style-span" color="#000000">+    virtual bool isPCRelativeRel(unsigned RelTy) const;</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+    /// getJumpTableRelocationTy - Returns the machine relocation type used</font></div><div><font class="Apple-style-span" color="#000000">+    /// to reference a jumptable.</font></div><div><font class="Apple-style-span" color="#000000">+    virtual unsigned getAbsoluteLabelMachineRelTy() const;</font></div><div></div></blockquote><div><br></div><div>Advance warning: ARM does jump tables with custom handling. This may be an "interesting" bit.</div><div><br></div><br><blockquote type="cite"><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+    /// computeRelocation - Some relocatable fields could be relocated</font></div><div><font class="Apple-style-span" color="#000000">+    /// directly, avoiding the relocation symbol emission, compute the</font></div><div><font class="Apple-style-span" color="#000000">+    /// final relocation value for this symbol.</font></div><div><font class="Apple-style-span" color="#000000">+    virtual long int computeRelocation(unsigned SymOffset, unsigned RelOffset,</font></div><div><font class="Apple-style-span" color="#000000">+                                       unsigned RelTy) const;</font></div><div><font class="Apple-style-span" color="#000000">+  };</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+} // end llvm namespace</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+#endif // ARM_ELF_WRITER_INFO_H</font></div><div><font class="Apple-style-span" color="#000000">Index: lib/Target/ARM/ARMELFWriterInfo.cpp</font></div><div><font class="Apple-style-span" color="#000000">===================================================================</font></div><div><font class="Apple-style-span" color="#000000">--- lib/Target/ARM/ARMELFWriterInfo.cpp</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">        </font></span><font class="Apple-style-span" color="#000000">(revision 0)</font></div><div><font class="Apple-style-span" color="#000000">+++ lib/Target/ARM/ARMELFWriterInfo.cpp</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">        </font></span><font class="Apple-style-span" color="#000000">(revision 0)</font></div><div><font class="Apple-style-span" color="#000000">@@ -0,0 +1,65 @@</font></div><div><font class="Apple-style-span" color="#000000">+//===-- ARMELFWriterInfo.cpp - ELF Writer Info for the ARM backend --------===//</font></div><div><font class="Apple-style-span" color="#000000">+//</font></div><div><font class="Apple-style-span" color="#000000">+//                     The LLVM Compiler Infrastructure</font></div><div><font class="Apple-style-span" color="#000000">+//</font></div><div><font class="Apple-style-span" color="#000000">+// This file is distributed under the University of Illinois Open Source</font></div><div><font class="Apple-style-span" color="#000000">+// License. See LICENSE.TXT for details.</font></div><div><font class="Apple-style-span" color="#000000">+//</font></div><div><font class="Apple-style-span" color="#000000">+//===----------------------------------------------------------------------===//</font></div><div><font class="Apple-style-span" color="#000000">+//</font></div><div><font class="Apple-style-span" color="#000000">+// This file implements ELF writer information for the ARM backend.</font></div><div><font class="Apple-style-span" color="#000000">+//</font></div><div><font class="Apple-style-span" color="#000000">+//===----------------------------------------------------------------------===//</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+#include "ARMELFWriterInfo.h"</font></div><div><font class="Apple-style-span" color="#000000">+#include "ARMRelocations.h"</font></div><div><font class="Apple-style-span" color="#000000">+#include "llvm/Function.h"</font></div><div><font class="Apple-style-span" color="#000000">+#include "llvm/Support/ErrorHandling.h"</font></div><div><font class="Apple-style-span" color="#000000">+#include "llvm/Target/TargetData.h"</font></div><div><font class="Apple-style-span" color="#000000">+#include "llvm/Target/TargetMachine.h"</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+using namespace llvm;</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+//===----------------------------------------------------------------------===//</font></div><div><font class="Apple-style-span" color="#000000">+//  Implementation of the ARMELFWriterInfo class</font></div><div><font class="Apple-style-span" color="#000000">+//===----------------------------------------------------------------------===//</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+ARMELFWriterInfo::ARMELFWriterInfo(TargetMachine &TM)</font></div><div><font class="Apple-style-span" color="#000000">+  : TargetELFWriterInfo(TM) {</font></div><div><font class="Apple-style-span" color="#000000">+  // silently OK construction</font></div><div><font class="Apple-style-span" color="#000000">+}</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+ARMELFWriterInfo::~ARMELFWriterInfo() {}</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+unsigned ARMELFWriterInfo::getRelocationType(unsigned MachineRelTy) const {</font></div><div><font class="Apple-style-span" color="#000000">+  assert(0 && "ARMELFWriterInfo::getRelocationType() not implemented");</font></div><div><font class="Apple-style-span" color="#000000">+  return 0;</font></div><div><font class="Apple-style-span" color="#000000">+}</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+long int ARMELFWriterInfo::getDefaultAddendForRelTy(unsigned RelTy,</font></div><div><font class="Apple-style-span" color="#000000">+                                                    long int Modifier) const {</font></div><div><font class="Apple-style-span" color="#000000">+  assert(0 && "ARMELFWriterInfo::getDefaultAddendForRelTy() not implemented");</font></div><div><font class="Apple-style-span" color="#000000">+  return 0;</font></div><div><font class="Apple-style-span" color="#000000">+}</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+unsigned ARMELFWriterInfo::getRelocationTySize(unsigned RelTy) const {</font></div><div><font class="Apple-style-span" color="#000000">+  assert(0 && "ARMELFWriterInfo::getRelocationTySize() not implemented");</font></div><div><font class="Apple-style-span" color="#000000">+  return 0;</font></div><div><font class="Apple-style-span" color="#000000">+}</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+bool ARMELFWriterInfo::isPCRelativeRel(unsigned RelTy) const {</font></div><div><font class="Apple-style-span" color="#000000">+  assert(0 && "ARMELFWriterInfo::isPCRelativeRel() not implemented");</font></div><div><font class="Apple-style-span" color="#000000">+  return 1;</font></div><div><font class="Apple-style-span" color="#000000">+}</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+unsigned ARMELFWriterInfo::getAbsoluteLabelMachineRelTy() const {</font></div><div><font class="Apple-style-span" color="#000000">+  assert(0 && "ARMELFWriterInfo::getAbsoluteLabelMachineRelTy() not implemented");</font></div><div><font class="Apple-style-span" color="#000000">+  return 0;</font></div><div><font class="Apple-style-span" color="#000000">+}</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">+long int ARMELFWriterInfo::computeRelocation(unsigned SymOffset,</font></div><div><font class="Apple-style-span" color="#000000">+                                             unsigned RelOffset,</font></div><div><font class="Apple-style-span" color="#000000">+                                             unsigned RelTy) const {</font></div><div><font class="Apple-style-span" color="#000000">+  assert(0 && "ARMELFWriterInfo::getAbsoluteLabelMachineRelTy() not implemented");</font></div><div><font class="Apple-style-span" color="#000000">+  return 0;</font></div><div><font class="Apple-style-span" color="#000000">+}</font></div><div><font class="Apple-style-span" color="#000000">Index: lib/Target/ARM/CMakeLists.txt</font></div><div><font class="Apple-style-span" color="#000000">===================================================================</font></div><div><font class="Apple-style-span" color="#000000">--- lib/Target/ARM/CMakeLists.txt</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">    </font></span><font class="Apple-style-span" color="#000000">(revision 114214)</font></div><div><font class="Apple-style-span" color="#000000">+++ lib/Target/ARM/CMakeLists.txt</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000"> </font></span><font class="Apple-style-span" color="#000000">(working copy)</font></div><div><font class="Apple-style-span" color="#000000">@@ -21,6 +21,7 @@</font></div><div><font class="Apple-style-span" color="#000000">   ARMCodeEmitter.cpp</font></div><div><font class="Apple-style-span" color="#000000">   ARMConstantIslandPass.cpp</font></div><div><font class="Apple-style-span" color="#000000">   ARMConstantPoolValue.cpp</font></div><div><font class="Apple-style-span" color="#000000">+  ARMELFWriterInfo.cpp</font></div><div><font class="Apple-style-span" color="#000000">   ARMExpandPseudoInsts.cpp</font></div><div><font class="Apple-style-span" color="#000000">   ARMFastISel.cpp</font></div><div><font class="Apple-style-span" color="#000000">   ARMGlobalMerge.cpp</font></div><div><font class="Apple-style-span" color="#000000">Index: lib/Target/ARM/ARMTargetMachine.h</font></div><div><font class="Apple-style-span" color="#000000">===================================================================</font></div><div><font class="Apple-style-span" color="#000000">--- lib/Target/ARM/ARMTargetMachine.h</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">    </font></span><font class="Apple-style-span" color="#000000">(revision 114214)</font></div><div><font class="Apple-style-span" color="#000000">+++ lib/Target/ARM/ARMTargetMachine.h</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">     </font></span><font class="Apple-style-span" color="#000000">(working copy)</font></div><div><font class="Apple-style-span" color="#000000">@@ -16,7 +16,9 @@</font></div><div><font class="Apple-style-span" color="#000000"><br></font></div><div><font class="Apple-style-span" color="#000000"> #include "llvm/Target/TargetMachine.h"</font></div><div><font class="Apple-style-span" color="#000000"> #include "llvm/Target/TargetData.h"</font></div><div><font class="Apple-style-span" color="#000000">+#include "llvm/MC/MCStreamer.h"</font></div><div><font class="Apple-style-span" color="#000000"> #include "ARMInstrInfo.h"</font></div><div><font class="Apple-style-span" color="#000000">+#include "ARMELFWriterInfo.h"</font></div><div><font class="Apple-style-span" color="#000000"> #include "ARMFrameInfo.h"</font></div><div><font class="Apple-style-span" color="#000000"> #include "ARMJITInfo.h"</font></div><div><font class="Apple-style-span" color="#000000"> #include "ARMSubtarget.h"</font></div><div><font class="Apple-style-span" color="#000000">@@ -38,10 +40,21 @@</font></div><div><font class="Apple-style-span" color="#000000">   InstrItineraryData  InstrItins;</font></div><div><font class="Apple-style-span" color="#000000">   Reloc::Model        DefRelocModel;    // Reloc model before it's overridden.</font></div><div><font class="Apple-style-span" color="#000000"><br></font></div><div><font class="Apple-style-span" color="#000000">+protected:</font></div><div><font class="Apple-style-span" color="#000000">+  const TargetData    DataLayout;       // Calculates type size & alignment</font></div><div><font class="Apple-style-span" color="#000000">+  ARMELFWriterInfo    ELFWriterInfo;</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000"> public:</font></div><div><font class="Apple-style-span" color="#000000">   ARMBaseTargetMachine(const Target &T, const std::string &TT,</font></div><div><font class="Apple-style-span" color="#000000">-                       const std::string &FS, bool isThumb);</font></div><div><font class="Apple-style-span" color="#000000">+                       const std::string &FS,</font></div><div><font class="Apple-style-span" color="#000000">+                       StringRef Target,</font></div><div><font class="Apple-style-span" color="#000000">+                       bool isThumb);</font></div><div><font class="Apple-style-span" color="#000000"><br></font></div><div><font class="Apple-style-span" color="#000000">+  virtual const TargetData       *getTargetData() const { return &DataLayout; }</font></div><div><font class="Apple-style-span" color="#000000">+  virtual const ARMELFWriterInfo *getELFWriterInfo() const {</font></div><div><font class="Apple-style-span" color="#000000">+    return Subtarget.isTargetELF() ? &ELFWriterInfo : 0;</font></div><div><font class="Apple-style-span" color="#000000">+  };</font></div><div><font class="Apple-style-span" color="#000000">+</font></div><div><font class="Apple-style-span" color="#000000">   virtual const ARMFrameInfo     *getFrameInfo() const { return &FrameInfo; }</font></div><div><font class="Apple-style-span" color="#000000">   virtual       ARMJITInfo       *getJITInfo()         { return &JITInfo; }</font></div><div><font class="Apple-style-span" color="#000000">   virtual const ARMSubtarget  *getSubtargetImpl() const { return &Subtarget; }</font></div><div><font class="Apple-style-span" color="#000000">@@ -63,7 +76,6 @@</font></div><div><font class="Apple-style-span" color="#000000"> ///</font></div><div><font class="Apple-style-span" color="#000000"> class ARMTargetMachine : public ARMBaseTargetMachine {</font></div><div><font class="Apple-style-span" color="#000000">   ARMInstrInfo        InstrInfo;</font></div><div><font class="Apple-style-span" color="#000000">-  const TargetData    DataLayout;       // Calculates type size & alignment</font></div><div><font class="Apple-style-span" color="#000000">   ARMTargetLowering   TLInfo;</font></div><div><font class="Apple-style-span" color="#000000">   ARMSelectionDAGInfo TSInfo;</font></div><div><font class="Apple-style-span" color="#000000"> public:</font></div><div><font class="Apple-style-span" color="#000000">@@ -93,7 +105,6 @@</font></div><div><font class="Apple-style-span" color="#000000"> class ThumbTargetMachine : public ARMBaseTargetMachine {</font></div><div><font class="Apple-style-span" color="#000000">   // Either Thumb1InstrInfo or Thumb2InstrInfo.</font></div><div><font class="Apple-style-span" color="#000000">   OwningPtr<ARMBaseInstrInfo> InstrInfo;</font></div><div><font class="Apple-style-span" color="#000000">-  const TargetData    DataLayout;   // Calculates type size & alignment</font></div><div><font class="Apple-style-span" color="#000000">   ARMTargetLowering   TLInfo;</font></div><div><font class="Apple-style-span" color="#000000">   ARMSelectionDAGInfo TSInfo;</font></div><div><font class="Apple-style-span" color="#000000"> public:</font></div><div><font class="Apple-style-span" color="#000000">Index: lib/Target/TargetELFWriterInfo.cpp</font></div><div><font class="Apple-style-span" color="#000000">===================================================================</font></div><div><font class="Apple-style-span" color="#000000">--- lib/Target/TargetELFWriterInfo.cpp</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000"> </font></span><font class="Apple-style-span" color="#000000">(revision 114214)</font></div><div><font class="Apple-style-span" color="#000000">+++ lib/Target/TargetELFWriterInfo.cpp</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">    </font></span><font class="Apple-style-span" color="#000000">(working copy)</font></div><div><font class="Apple-style-span" color="#000000">@@ -18,6 +18,8 @@</font></div><div><font class="Apple-style-span" color="#000000"> using namespace llvm;</font></div><div><font class="Apple-style-span" color="#000000"><br></font></div><div><font class="Apple-style-span" color="#000000"> TargetELFWriterInfo::TargetELFWriterInfo(TargetMachine &tm) : TM(tm) {</font></div><div><font class="Apple-style-span" color="#000000">+  // TODO(jasonwkim): [2010/09/18 09:57:44 PDT (Saturday)]</font></div><div><font class="Apple-style-span" color="#000000">+  // Fixme: NaCl 64bit has 32bit pointers. Need a better test.</font></div><div><font class="Apple-style-span" color="#000000">   is64Bit = TM.getTargetData()->getPointerSizeInBits() == 64;</font></div><div><font class="Apple-style-span" color="#000000">   isLittleEndian = TM.getTargetData()->isLittleEndian();</font></div><div><font class="Apple-style-span" color="#000000"> }</font></div></blockquote></div><div><div><br></div></div></body></html>