Adding function "lookupGCCName" to MBlazeIntrinsicInfo
authorWesley Peck <peckw@wesleypeck.com>
Wed, 24 Feb 2010 20:16:27 +0000 (20:16 +0000)
committerWesley Peck <peckw@wesleypeck.com>
Wed, 24 Feb 2010 20:16:27 +0000 (20:16 +0000)
Adding the function "lookupGCCName" to the MBlazeIntrinsicInfo
class to support the Clang MicroBlaze target.

Additionally, minor fixes which remove some unused PIC code
(PIC is not supported yet in the MicroBlaze backend) and
removed some unused variables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97054 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/MBlaze/MBlazeISelLowering.cpp
lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp
lib/Target/MBlaze/MBlazeIntrinsicInfo.h
lib/Target/MBlaze/MBlazeMachineFunction.h
lib/Target/MBlaze/MBlazeRegisterInfo.cpp

index 0acbe3fec6e822fd17b90071990f6d58cf381134..7790248669f89ab5e6b6be9cc583822da22292f0 100644 (file)
@@ -470,7 +470,6 @@ LowerCall(SDValue Chain, SDValue Callee, CallingConv::ID CallConv,
           SmallVectorImpl<SDValue> &InVals) {
   MachineFunction &MF = DAG.getMachineFunction();
   MachineFrameInfo *MFI = MF.getFrameInfo();
-  bool IsPIC = getTargetMachine().getRelocationModel() == Reloc::PIC_;
 
   // Analyze operands of the call, assigning locations to each operand.
   SmallVector<CCValAssign, 16> ArgLocs;
@@ -556,7 +555,7 @@ LowerCall(SDValue Chain, SDValue Callee, CallingConv::ID CallConv,
   // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every
   // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol
   // node so that legalize doesn't hack it.
-  unsigned char OpFlag = IsPIC ? MBlazeII::MO_GOT_CALL : MBlazeII::MO_NO_FLAG;
+  unsigned char OpFlag = MBlazeII::MO_NO_FLAG;
   if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
     Callee = DAG.getTargetGlobalAddress(G->getGlobal(),
                                 getPointerTy(), 0, OpFlag);
index a01c76b367c69ed557ebbe308cc8a8d35d85c4d8..c8faffc84527365025351a717329fd67b00a3cb0 100644 (file)
@@ -32,6 +32,9 @@ namespace mblazeIntrinsic {
     , num_mblaze_intrinsics
   };
 
+#define GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN
+#include "MBlazeGenIntrinsics.inc"
+#undef GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN
 }
 
 std::string MBlazeIntrinsicInfo::getName(unsigned IntrID, const Type **Tys,
@@ -60,6 +63,11 @@ lookupName(const char *Name, unsigned Len) const {
   return 0;
 }
 
+unsigned MBlazeIntrinsicInfo::
+lookupGCCName(const char *Name) const {
+    return mblazeIntrinsic::getIntrinsicForGCCBuiltin("mblaze",Name);
+}
+
 bool MBlazeIntrinsicInfo::isOverloaded(unsigned IntrID) const {
   // Overload Table
   const bool OTable[] = {
index f40d4258273a8d88b8bd9ba8a43bcf3e37f056e2..9804c7723bee2fbd53ebf383dd1044ea41588ae9 100644 (file)
@@ -22,6 +22,7 @@ namespace llvm {
     std::string getName(unsigned IntrID, const Type **Tys = 0,
                         unsigned numTys = 0) const;
     unsigned lookupName(const char *Name, unsigned Len) const;
+    unsigned lookupGCCName(const char *Name) const;
     bool isOverloaded(unsigned IID) const;
     Function *getDeclaration(Module *M, unsigned ID, const Type **Tys = 0,
                              unsigned numTys = 0) const;
index a89ba13f720ebec01f6df72a3e789e568c1130b4..08d4dcad6e3ff4f256dc0ec34c8d2dd4089d8a56 100644 (file)
@@ -34,12 +34,11 @@ private:
   /// saved. This is used on Prologue and Epilogue to emit RA save/restore
   int RAStackOffset;
 
-  /// At each function entry, two special bitmask directives must be emitted
-  /// to help debugging, for CPU and FPU callee saved registers. Both need
-  /// the negative offset from the final stack size and its higher registers
-  /// location on the stack.
+  /// At each function entry a special bitmask directive must be emitted
+  /// to help in debugging CPU callee saved registers. It needs a negative
+  /// offset from the final stack size and its higher register location on
+  /// the stack.
   int CPUTopSavedRegOff;
-  int FPUTopSavedRegOff;
 
   /// MBlazeFIHolder - Holds a FrameIndex and it's Stack Pointer Offset
   struct MBlazeFIHolder {
@@ -83,8 +82,8 @@ private:
 public:
   MBlazeFunctionInfo(MachineFunction& MF) 
   : FPStackOffset(0), RAStackOffset(0), CPUTopSavedRegOff(0), 
-    FPUTopSavedRegOff(0), GPHolder(-1,-1), HasLoadArgs(false), 
-    HasStoreVarArgs(false), SRetReturnReg(0), GlobalBaseReg(0)
+    GPHolder(-1,-1), HasLoadArgs(false), HasStoreVarArgs(false),
+    SRetReturnReg(0), GlobalBaseReg(0)
   {}
 
   int getFPStackOffset() const { return FPStackOffset; }
@@ -96,9 +95,6 @@ public:
   int getCPUTopSavedRegOff() const { return CPUTopSavedRegOff; }
   void setCPUTopSavedRegOff(int Off) { CPUTopSavedRegOff = Off; }
 
-  int getFPUTopSavedRegOff() const { return FPUTopSavedRegOff; }
-  void setFPUTopSavedRegOff(int Off) { FPUTopSavedRegOff = Off; }
-
   int getGPStackOffset() const { return GPHolder.SPOffset; }
   int getGPFI() const { return GPHolder.FI; }
   void setGPStackOffset(int Off) { GPHolder.SPOffset = Off; }
index b8d23493334e8f5e179b1bde19cd9cbdf8d317e5..9067f8b35739cefac9af8b8382f76e6cad645271 100644 (file)
@@ -96,7 +96,7 @@ unsigned MBlazeRegisterInfo::getPICCallReg() {
 /// MBlaze Callee Saved Registers
 const unsigned* MBlazeRegisterInfo::
 getCalleeSavedRegs(const MachineFunction *MF) const {
-  // MBlaze callee-save register range is R19 - R31
+  // MBlaze callee-save register range is R20 - R31
   static const unsigned CalleeSavedRegs[] = {
     MBlaze::R20, MBlaze::R21, MBlaze::R22, MBlaze::R23,
     MBlaze::R24, MBlaze::R25, MBlaze::R26, MBlaze::R27,