#include "llvm/DerivedTypes.h"
#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
+#include "llvm/Intrinsics.h"
#include "llvm/Module.h"
#include "llvm/ADT/StringExtras.h"
using namespace llvm;
EightByteConstantSection = "\t.literal8\n";
if (Subtarget->is64Bit())
SixteenByteConstantSection = "\t.literal16\n";
+ ReadOnlySection = "\t.const\n";
LCOMMDirective = "\t.lcomm\t";
COMMDirectiveTakesAlignment = false;
HasDotTypeDotSizeDirective = false;
- StaticCtorsSection = ".mod_init_func";
- StaticDtorsSection = ".mod_term_func";
+ if (TM.getRelocationModel() == Reloc::Static) {
+ StaticCtorsSection = ".constructor";
+ StaticDtorsSection = ".destructor";
+ } else {
+ StaticCtorsSection = ".mod_init_func";
+ StaticDtorsSection = ".mod_term_func";
+ }
InlineAsmStart = "# InlineAsm Start";
InlineAsmEnd = "# InlineAsm End";
SetDirective = "\t.set";
case X86Subtarget::isELF:
// Set up DWARF directives
HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
+ AbsoluteSectionOffsets = true;
// bool HasLEB128; // Defaults to false.
// hasDotLoc - True if target asm supports .loc directives.
// bool HasDotLoc; // Defaults to false.
// HasDotFile - True if target asm supports .file directives.
// bool HasDotFile; // Defaults to false.
+ ReadOnlySection = "\t.section\t.rodata\n";
PrivateGlobalPrefix = ".L";
WeakRefDirective = "\t.weak\t";
DwarfRequiresFrameSection = false;
// Set up DWARF directives
HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
+ AbsoluteSectionOffsets = true;
PrivateGlobalPrefix = "L"; // Prefix for private global symbols
+ WeakRefDirective = "\t.weak\t";
DwarfRequiresFrameSection = false;
+ DwarfSectionOffsetDirective = "\t.secrel32\t";
DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"dr\"";
DwarfInfoSection = "\t.section\t.debug_info,\"dr\"";
DwarfLineSection = "\t.section\t.debug_line,\"dr\"";
!CI->getType()->isInteger())
return false;
- const Type *Ty = CI->getType();
- const char *IntName;
- if (const IntegerType *ITy = dyn_cast<IntegerType>(Ty)) {
- unsigned BitWidth = ITy->getBitWidth();
- if (BitWidth == 16)
- IntName = "llvm.bswap.i16";
- else if (BitWidth == 32)
- IntName = "llvm.bswap.i32";
- else if (BitWidth == 64)
- IntName = "llvm.bswap.i64";
- else
- return false;
- } else
+ const IntegerType *Ty = dyn_cast<IntegerType>(CI->getType());
+ if (!Ty || Ty->getBitWidth() % 16 != 0)
return false;
-
+
// Okay, we can do this xform, do so now.
+ const Type *Tys[] = { Ty, Ty };
Module *M = CI->getParent()->getParent()->getParent();
- Constant *Int = M->getOrInsertFunction(IntName, Ty, Ty, (Type*)0);
+ Constant *Int = Intrinsic::getDeclaration(M, Intrinsic::bswap, Tys, 2);
Value *Op = CI->getOperand(1);
Op = new CallInst(Int, Op, CI->getName(), CI);