LLVM API Documentation

ARMSubtarget.cpp

Go to the documentation of this file.
00001 //===-- ARMSubtarget.cpp - ARM Subtarget Information ------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file implements the ARM specific subclass of TargetSubtarget.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #include "ARMSubtarget.h"
00015 #include "ARMGenSubtarget.inc"
00016 #include "llvm/Module.h"
00017 using namespace llvm;
00018 
00019 ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS, bool thumb)
00020   : ARMArchVersion(V4T)
00021   , HasVFP2(false)
00022   , IsThumb(thumb)
00023   , UseThumbBacktraces(false)
00024   , IsR9Reserved(false)
00025   , stackAlignment(4)
00026   , TargetType(isELF) // Default to ELF unless otherwise specified.
00027   , TargetABI(ARM_ABI_APCS) {
00028 
00029   // Determine default and user specified characteristics
00030   std::string CPU = "generic";
00031 
00032   // Parse features string.
00033   ParseSubtargetFeatures(FS, CPU);
00034 
00035   // Set the boolean corresponding to the current target triple, or the default
00036   // if one cannot be determined, to true.
00037   const std::string& TT = M.getTargetTriple();
00038   if (TT.length() > 5) {
00039     if (TT.find("-darwin") != std::string::npos)
00040       TargetType = isDarwin;
00041   } else if (TT.empty()) {
00042 #if defined(__APPLE__)
00043     TargetType = isDarwin;
00044 #endif
00045   }
00046 
00047   if (TT.find("eabi") != std::string::npos)
00048     TargetABI = ARM_ABI_AAPCS;
00049 
00050   if (isAAPCS_ABI())
00051     stackAlignment = 8;
00052 
00053   if (isTargetDarwin()) {
00054     UseThumbBacktraces = true;
00055     IsR9Reserved = true;
00056   }
00057 }