1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Break out target asm info into separate files.

llvm-svn: 30161
This commit is contained in:
Jim Laskey 2006-09-07 22:05:02 +00:00
parent 18046380ee
commit a64fe8ccf2
12 changed files with 437 additions and 0 deletions

View File

@ -0,0 +1,26 @@
//===-- ARMTargetAsmInfo.cpp - ARM asm properties ---------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by James M. Laskey and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains the declarations of the ARMTargetAsmInfo properties.
//
//===----------------------------------------------------------------------===//
#include "ARMTargetAsmInfo.h"
using namespace llvm;
ARMTargetAsmInfo::ARMTargetAsmInfo(const ARMTargetMachine &TM) {
Data16bitsDirective = "\t.half\t";
Data32bitsDirective = "\t.word\t";
Data64bitsDirective = 0;
ZeroDirective = "\t.skip\t";
CommentString = "@";
ConstantPoolSection = "\t.text\n";
AlignmentIsInBytes = false;
}

View File

@ -0,0 +1,31 @@
//=====-- ARMTargetAsmInfo.h - ARM asm properties -------------*- C++ -*--====//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by James M. Laskey and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains the declaration of the ARMTargetAsmInfo class.
//
//===----------------------------------------------------------------------===//
#ifndef ARMTARGETASMINFO_H
#define ARMTARGETASMINFO_H
#include "llvm/Target/TargetAsmInfo.h"
namespace llvm {
// Forward declaration.
class ARMTargetMachine;
struct ARMTargetAsmInfo : public TargetAsmInfo {
ARMTargetAsmInfo(const ARMTargetMachine &TM);
};
} // namespace llvm
#endif

View File

@ -0,0 +1,21 @@
//===-- AlphaTargetAsmInfo.cpp - Alpha asm properties -----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by James M. Laskey and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains the declarations of the AlphaTargetAsmInfo properties.
//
//===----------------------------------------------------------------------===//
#include "AlphaTargetAsmInfo.h"
using namespace llvm;
AlphaTargetAsmInfo::AlphaTargetAsmInfo(const AlphaTargetMachine &TM) {
AlignmentIsInBytes = false;
PrivateGlobalPrefix = "$";
}

View File

@ -0,0 +1,30 @@
//=====-- AlphaTargetAsmInfo.h - Alpha asm properties ---------*- C++ -*--====//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by James M. Laskey and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains the declaration of the AlphaTargetAsmInfo class.
//
//===----------------------------------------------------------------------===//
#ifndef ALPHATARGETASMINFO_H
#define ALPHATARGETASMINFO_H
#include "llvm/Target/TargetAsmInfo.h"
namespace llvm {
// Forward declaration.
class AlphaTargetMachine;
struct AlphaTargetAsmInfo : public TargetAsmInfo {
AlphaTargetAsmInfo(const AlphaTargetMachine &TM);
};
} // namespace llvm
#endif

View File

@ -0,0 +1,34 @@
//===-- IA64TargetAsmInfo.cpp - IA64 asm properties -------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by James M. Laskey and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains the declarations of the IA64TargetAsmInfo properties.
//
//===----------------------------------------------------------------------===//
#include "IA64TargetAsmInfo.h"
using namespace llvm;
IA64TargetAsmInfo::IA64TargetAsmInfo(const IA64TargetMachine &TM) {
CommentString = "//";
Data8bitsDirective = "\tdata1\t"; // FIXME: check that we are
Data16bitsDirective = "\tdata2.ua\t"; // disabling auto-alignment
Data32bitsDirective = "\tdata4.ua\t"; // properly
Data64bitsDirective = "\tdata8.ua\t";
ZeroDirective = "\t.skip\t";
AsciiDirective = "\tstring\t";
GlobalVarAddrPrefix="";
GlobalVarAddrSuffix="";
FunctionAddrPrefix="@fptr(";
FunctionAddrSuffix=")";
// FIXME: would be nice to have rodata (no 'w') when appropriate?
ConstantPoolSection = "\n\t.section .data, \"aw\", \"progbits\"\n";
}

View File

@ -0,0 +1,31 @@
//=====-- IA64TargetAsmInfo.h - IA64 asm properties -----------*- C++ -*--====//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by James M. Laskey and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains the declaration of the IA64TargetAsmInfo class.
//
//===----------------------------------------------------------------------===//
#ifndef IA64TARGETASMINFO_H
#define IA64TARGETASMINFO_H
#include "llvm/Target/TargetAsmInfo.h"
namespace llvm {
// Forward declaration.
class IA64TargetMachine;
struct IA64TargetAsmInfo : public TargetAsmInfo {
IA64TargetAsmInfo(const IA64TargetMachine &TM);
};
} // namespace llvm
#endif

View File

@ -0,0 +1,51 @@
//===-- PPCTargetAsmInfo.cpp - PPC asm properties ---------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by James M. Laskey and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains the declarations of the DarwinTargetAsmInfo properties.
//
//===----------------------------------------------------------------------===//
#include "PPCTargetAsmInfo.h"
#include "PPCTargetMachine.h"
using namespace llvm;
DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) {
bool isPPC64 = TM.getSubtargetImpl()->isPPC64();
CommentString = ";";
GlobalPrefix = "_";
PrivateGlobalPrefix = "L";
ZeroDirective = "\t.space\t";
SetDirective = "\t.set";
Data64bitsDirective = isPPC64 ? ".quad\t" : 0;
AlignmentIsInBytes = false;
ConstantPoolSection = "\t.const\t";
JumpTableDataSection = ".const";
JumpTableTextSection = "\t.text";
LCOMMDirective = "\t.lcomm\t";
StaticCtorsSection = ".mod_init_func";
StaticDtorsSection = ".mod_term_func";
InlineAsmStart = "# InlineAsm Start";
InlineAsmEnd = "# InlineAsm End";
NeedsSet = true;
AddressSize = isPPC64 ? 8 : 4;
DwarfAbbrevSection = ".section __DWARF,__debug_abbrev";
DwarfInfoSection = ".section __DWARF,__debug_info";
DwarfLineSection = ".section __DWARF,__debug_line";
DwarfFrameSection = ".section __DWARF,__debug_frame";
DwarfPubNamesSection = ".section __DWARF,__debug_pubnames";
DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes";
DwarfStrSection = ".section __DWARF,__debug_str";
DwarfLocSection = ".section __DWARF,__debug_loc";
DwarfARangesSection = ".section __DWARF,__debug_aranges";
DwarfRangesSection = ".section __DWARF,__debug_ranges";
DwarfMacInfoSection = ".section __DWARF,__debug_macinfo";
}

View File

@ -0,0 +1,31 @@
//=====-- PPCTargetAsmInfo.h - PPC asm properties -------------*- C++ -*--====//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by James M. Laskey and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains the declaration of the DarwinTargetAsmInfo class.
//
//===----------------------------------------------------------------------===//
#ifndef PPCTARGETASMINFO_H
#define PPCTARGETASMINFO_H
#include "llvm/Target/TargetAsmInfo.h"
namespace llvm {
// Forward declaration.
class PPCTargetMachine;
struct DarwinTargetAsmInfo : public TargetAsmInfo {
DarwinTargetAsmInfo(const PPCTargetMachine &TM);
};
} // namespace llvm
#endif

View File

@ -0,0 +1,25 @@
//===-- SparcTargetAsmInfo.cpp - Sparc asm properties -----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by James M. Laskey and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains the declarations of the SparcTargetAsmInfo properties.
//
//===----------------------------------------------------------------------===//
#include "SparcTargetAsmInfo.h"
using namespace llvm;
SparcTargetAsmInfo::SparcTargetAsmInfo(const SparcTargetMachine &TM) {
Data16bitsDirective = "\t.half\t";
Data32bitsDirective = "\t.word\t";
Data64bitsDirective = 0; // .xword is only supported by V9.
ZeroDirective = "\t.skip\t";
CommentString = "!";
ConstantPoolSection = "\t.section \".rodata\",#alloc\n";
}

View File

@ -0,0 +1,31 @@
//=====-- SparcTargetAsmInfo.h - Sparc asm properties ---------*- C++ -*--====//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by James M. Laskey and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains the declaration of the SparcTargetAsmInfo class.
//
//===----------------------------------------------------------------------===//
#ifndef SPARCTARGETASMINFO_H
#define SPARCTARGETASMINFO_H
#include "llvm/Target/TargetAsmInfo.h"
namespace llvm {
// Forward declaration.
class SparcTargetMachine;
struct SparcTargetAsmInfo : public TargetAsmInfo {
SparcTargetAsmInfo(const SparcTargetMachine &TM);
};
} // namespace llvm
#endif

View File

@ -0,0 +1,95 @@
//===-- X86TargetAsmInfo.cpp - X86 asm properties ---------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by James M. Laskey and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains the declarations of the X86TargetAsmInfo properties.
//
//===----------------------------------------------------------------------===//
#include "X86TargetAsmInfo.h"
#include "X86TargetMachine.h"
#include "X86Subtarget.h"
using namespace llvm;
X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>();
//FIXME - Should to be simplified.
switch (Subtarget->TargetType) {
case X86Subtarget::isDarwin:
AlignmentIsInBytes = false;
GlobalPrefix = "_";
Data64bitsDirective = 0; // we can't emit a 64-bit unit
ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
PrivateGlobalPrefix = "L"; // Marker for constant pool idxs
ConstantPoolSection = "\t.const\n";
JumpTableDataSection = "\t.const\n"; // FIXME: depends on PIC mode
FourByteConstantSection = "\t.literal4\n";
EightByteConstantSection = "\t.literal8\n";
LCOMMDirective = "\t.lcomm\t";
COMMDirectiveTakesAlignment = false;
HasDotTypeDotSizeDirective = false;
StaticCtorsSection = ".mod_init_func";
StaticDtorsSection = ".mod_term_func";
InlineAsmStart = "# InlineAsm Start";
InlineAsmEnd = "# InlineAsm End";
SetDirective = "\t.set";
NeedsSet = true;
DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug";
DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug";
DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug";
DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
break;
case X86Subtarget::isCygwin:
GlobalPrefix = "_";
COMMDirectiveTakesAlignment = false;
HasDotTypeDotSizeDirective = false;
StaticCtorsSection = "\t.section .ctors,\"aw\"";
StaticDtorsSection = "\t.section .dtors,\"aw\"";
break;
case X86Subtarget::isWindows:
GlobalPrefix = "_";
HasDotTypeDotSizeDirective = false;
break;
default: break;
}
if (Subtarget->isFlavorIntel()) {
GlobalPrefix = "_";
CommentString = ";";
PrivateGlobalPrefix = "$";
AlignDirective = "\talign\t";
ZeroDirective = "\tdb\t";
ZeroDirectiveSuffix = " dup(0)";
AsciiDirective = "\tdb\t";
AscizDirective = 0;
Data8bitsDirective = "\tdb\t";
Data16bitsDirective = "\tdw\t";
Data32bitsDirective = "\tdd\t";
Data64bitsDirective = "\tdq\t";
HasDotTypeDotSizeDirective = false;
TextSection = "_text";
DataSection = "_data";
SwitchToSectionDirective = "";
TextSectionStartSuffix = "\tsegment 'CODE'";
DataSectionStartSuffix = "\tsegment 'DATA'";
SectionEndDirectiveSuffix = "\tends\n";
}
}

View File

@ -0,0 +1,31 @@
//=====-- X86TargetAsmInfo.h - X86 asm properties -------------*- C++ -*--====//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by James M. Laskey and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains the declaration of the X86TargetAsmInfo class.
//
//===----------------------------------------------------------------------===//
#ifndef X86TARGETASMINFO_H
#define X86TARGETASMINFO_H
#include "llvm/Target/TargetAsmInfo.h"
namespace llvm {
// Forward declaration.
class X86TargetMachine;
struct X86TargetAsmInfo : public TargetAsmInfo {
X86TargetAsmInfo(const X86TargetMachine &TM);
};
} // namespace llvm
#endif