Function temporaries can not overlap with retval or args.See the comment in source...
[oota-llvm.git] / lib / Target / PowerPC / PPCTargetAsmInfo.h
index 4884628b2e773c3434090ed32e28cf8497c178f1..edf40c9346cf792d306f1860b2fd3f6ffe99b63e 100644 (file)
 #ifndef PPCTARGETASMINFO_H
 #define PPCTARGETASMINFO_H
 
+#include "PPCTargetMachine.h"
 #include "llvm/Target/TargetAsmInfo.h"
+#include "llvm/Target/DarwinTargetAsmInfo.h"
+#include "llvm/Target/ELFTargetAsmInfo.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
-  // Forward declaration.
-  class PPCTargetMachine;
-  
-  struct PPCTargetAsmInfo : public TargetAsmInfo {
-    explicit PPCTargetAsmInfo(const PPCTargetMachine &TM);
+  template <class BaseTAI>
+  struct PPCTargetAsmInfo : public BaseTAI {
+    explicit PPCTargetAsmInfo(const PPCTargetMachine &TM):
+      BaseTAI(TM) {
+      const PPCSubtarget *Subtarget = &TM.getSubtarget<PPCSubtarget>();
+      bool isPPC64 = Subtarget->isPPC64();
+
+      BaseTAI::ZeroDirective = "\t.space\t";
+      BaseTAI::SetDirective = "\t.set";
+      BaseTAI::Data64bitsDirective = isPPC64 ? "\t.quad\t" : 0;
+      BaseTAI::AlignmentIsInBytes = false;
+      BaseTAI::LCOMMDirective = "\t.lcomm\t";
+      BaseTAI::InlineAsmStart = "# InlineAsm Start";
+      BaseTAI::InlineAsmEnd = "# InlineAsm End";
+      BaseTAI::AssemblerDialect = Subtarget->getAsmFlavor();
+    }
   };
 
-  struct DarwinTargetAsmInfo : public PPCTargetAsmInfo {
-    explicit DarwinTargetAsmInfo(const PPCTargetMachine &TM);
+  typedef PPCTargetAsmInfo<TargetAsmInfo> PPCGenericTargetAsmInfo;
+
+  EXTERN_TEMPLATE_INSTANTIATION(class PPCTargetAsmInfo<TargetAsmInfo>);
+
+  struct PPCDarwinTargetAsmInfo : public PPCTargetAsmInfo<DarwinTargetAsmInfo> {
+    explicit PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM);
     virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
                                            bool Global) const;
+    virtual const char *getEHGlobalPrefix() const;
   };
 
-  struct LinuxTargetAsmInfo : public PPCTargetAsmInfo {
-    explicit LinuxTargetAsmInfo(const PPCTargetMachine &TM);
+  struct PPCLinuxTargetAsmInfo : public PPCTargetAsmInfo<ELFTargetAsmInfo> {
+    explicit PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM);
     virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
                                            bool Global) const;
   };