[Mips] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 309993
diff --git a/llvm/lib/Target/Mips/Mips16HardFloat.cpp b/llvm/lib/Target/Mips/Mips16HardFloat.cpp
index 3c24261..682ea5c 100644
--- a/llvm/lib/Target/Mips/Mips16HardFloat.cpp
+++ b/llvm/lib/Target/Mips/Mips16HardFloat.cpp
@@ -1,4 +1,4 @@
-//===---- Mips16HardFloat.cpp for Mips16 Hard Float               --------===//
+//===- Mips16HardFloat.cpp for Mips16 Hard Float --------------------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -25,6 +25,7 @@
 #define DEBUG_TYPE "mips16-hard-float"
 
 namespace {
+
   class Mips16HardFloat : public ModulePass {
   public:
     static char ID;
@@ -41,21 +42,21 @@
     bool runOnModule(Module &M) override;
   };
 
-  static void EmitInlineAsm(LLVMContext &C, BasicBlock *BB, StringRef AsmText) {
-    std::vector<llvm::Type *> AsmArgTypes;
-    std::vector<llvm::Value *> AsmArgs;
+} // end anonymous namespace
 
-    llvm::FunctionType *AsmFTy =
-        llvm::FunctionType::get(Type::getVoidTy(C), AsmArgTypes, false);
-    llvm::InlineAsm *IA =
-        llvm::InlineAsm::get(AsmFTy, AsmText, "", true,
-                             /* IsAlignStack */ false, llvm::InlineAsm::AD_ATT);
-    CallInst::Create(IA, AsmArgs, "", BB);
-  }
+static void EmitInlineAsm(LLVMContext &C, BasicBlock *BB, StringRef AsmText) {
+  std::vector<Type *> AsmArgTypes;
+  std::vector<Value *> AsmArgs;
 
-  char Mips16HardFloat::ID = 0;
+  FunctionType *AsmFTy =
+      FunctionType::get(Type::getVoidTy(C), AsmArgTypes, false);
+  InlineAsm *IA = InlineAsm::get(AsmFTy, AsmText, "", true,
+                                 /* IsAlignStack */ false, InlineAsm::AD_ATT);
+  CallInst::Create(IA, AsmArgs, "", BB);
 }
 
+char Mips16HardFloat::ID = 0;
+
 //
 // Return types that matter for hard float are:
 // float, double, complex float, and complex double
@@ -89,18 +90,15 @@
   return NoFPRet;
 }
 
-//
 // Parameter type that matter are float, (float, float), (float, double),
 // double, (double, double), (double, float)
-//
 enum FPParamVariant {
   FSig, FFSig, FDSig,
   DSig, DDSig, DFSig, NoSig
 };
 
 // which floating point parameter signature variant we are dealing with
-//
-typedef Type::TypeID TypeID;
+using TypeID = Type::TypeID;
 const Type::TypeID FloatTyID = Type::FloatTyID;
 const Type::TypeID DoubleTyID = Type::DoubleTyID;
 
@@ -154,7 +152,6 @@
 // Figure out if we need float point based on the function parameters.
 // We need to move variables in and/or out of floating point
 // registers because of the ABI
-//
 static bool needsFPStubFromParams(Function &F) {
   if (F.arg_size() >=1) {
     Type *ArgType = F.getFunctionType()->getParamType(0);
@@ -183,10 +180,8 @@
   return needsFPStubFromParams(F) || needsFPReturnHelper(F);
 }
 
-//
 // We swap between FP and Integer registers to allow Mips16 and Mips32 to
 // interoperate
-//
 static std::string swapFPIntParams(FPParamVariant PV, Module *M, bool LE,
                                    bool ToFP) {
   std::string MI = ToFP ? "mtc1 ": "mfc1 ";
@@ -255,10 +250,8 @@
   return AsmText;
 }
 
-//
 // Make sure that we know we already need a stub for this function.
 // Having called needsFPHelperFromSig
-//
 static void assureFPCallStub(Function &F, Module *M,
                              const MipsTargetMachine &TM) {
   // for now we only need them for static relocation
@@ -277,9 +270,9 @@
   FStub = Function::Create(F.getFunctionType(),
                            Function::InternalLinkage, StubName, M);
   FStub->addFnAttr("mips16_fp_stub");
-  FStub->addFnAttr(llvm::Attribute::Naked);
-  FStub->addFnAttr(llvm::Attribute::NoInline);
-  FStub->addFnAttr(llvm::Attribute::NoUnwind);
+  FStub->addFnAttr(Attribute::Naked);
+  FStub->addFnAttr(Attribute::NoInline);
+  FStub->addFnAttr(Attribute::NoUnwind);
   FStub->addFnAttr("nomips16");
   FStub->setSection(SectionName);
   BasicBlock *BB = BasicBlock::Create(Context, "entry", FStub);
@@ -350,9 +343,7 @@
   new UnreachableInst(Context, BB);
 }
 
-//
 // Functions that are llvm intrinsics and don't need helpers.
-//
 static const char *const IntrinsicInline[] = {
   "fabs", "fabsf",
   "llvm.ceil.f32", "llvm.ceil.f64",
@@ -379,10 +370,9 @@
   return std::binary_search(std::begin(IntrinsicInline),
                             std::end(IntrinsicInline), F->getName());
 }
-//
+
 // Returns of float, double and complex need to be handled with a helper
 // function.
-//
 static bool fixupFPReturnAndCall(Function &F, Module *M,
                                  const MipsTargetMachine &TM) {
   bool Modified = false;
@@ -465,9 +455,9 @@
     (F->getFunctionType(),
      Function::InternalLinkage, StubName, M);
   FStub->addFnAttr("mips16_fp_stub");
-  FStub->addFnAttr(llvm::Attribute::Naked);
-  FStub->addFnAttr(llvm::Attribute::NoUnwind);
-  FStub->addFnAttr(llvm::Attribute::NoInline);
+  FStub->addFnAttr(Attribute::Naked);
+  FStub->addFnAttr(Attribute::NoUnwind);
+  FStub->addFnAttr(Attribute::NoInline);
   FStub->addFnAttr("nomips16");
   FStub->setSection(SectionName);
   BasicBlock *BB = BasicBlock::Create(Context, "entry", FStub);
@@ -489,9 +479,7 @@
   new UnreachableInst(FStub->getContext(), BB);
 }
 
-//
 // remove the use-soft-float attribute
-//
 static void removeUseSoftFloat(Function &F) {
   AttrBuilder B;
   DEBUG(errs() << "removing -use-soft-float\n");
@@ -503,8 +491,6 @@
   F.addAttributes(AttributeList::FunctionIndex, B);
 }
 
-
-//
 // This pass only makes sense when the underlying chip has floating point but
 // we are compiling as mips16.
 // For all mips16 functions (that are not stubs we have already generated), or
@@ -521,7 +507,6 @@
 //    4) TBD. For pic, calls to extern functions of unknown type are handled by
 //       predefined helper functions in libc but this work is currently done
 //       during call lowering but it should be moved here in the future.
-//
 bool Mips16HardFloat::runOnModule(Module &M) {
   auto &TM = static_cast<const MipsTargetMachine &>(
       getAnalysis<TargetPassConfig>().getTM<TargetMachine>());
@@ -545,7 +530,6 @@
   return Modified;
 }
 
-
 ModulePass *llvm::createMips16HardFloatPass() {
   return new Mips16HardFloat();
 }