Skip to content

Commit

Permalink
[CallSite removal][Target] Replace CallSite with CallBase. NFC
Browse files Browse the repository at this point in the history
In some cases just delete an unneeded include.
  • Loading branch information
topperc committed Apr 22, 2020
1 parent c12722c commit d22989c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 26 deletions.
37 changes: 17 additions & 20 deletions llvm/lib/Target/ARM/ARMFastISel.cpp
Expand Up @@ -48,7 +48,6 @@
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
Expand Down Expand Up @@ -2298,12 +2297,11 @@ bool ARMFastISel::SelectCall(const Instruction *I,
if (CI->isTailCall()) return false;

// Check the calling convention.
ImmutableCallSite CS(CI);
CallingConv::ID CC = CS.getCallingConv();
CallingConv::ID CC = CI->getCallingConv();

// TODO: Avoid some calling conventions?

FunctionType *FTy = CS.getFunctionType();
FunctionType *FTy = CI->getFunctionType();
bool isVarArg = FTy->isVarArg();

// Handle *simple* calls for now.
Expand All @@ -2330,47 +2328,46 @@ bool ARMFastISel::SelectCall(const Instruction *I,
SmallVector<Register, 8> ArgRegs;
SmallVector<MVT, 8> ArgVTs;
SmallVector<ISD::ArgFlagsTy, 8> ArgFlags;
unsigned arg_size = CS.arg_size();
unsigned arg_size = CI->arg_size();
Args.reserve(arg_size);
ArgRegs.reserve(arg_size);
ArgVTs.reserve(arg_size);
ArgFlags.reserve(arg_size);
for (ImmutableCallSite::arg_iterator i = CS.arg_begin(), e = CS.arg_end();
i != e; ++i) {
for (auto ArgI = CI->arg_begin(), ArgE = CI->arg_end(); ArgI != ArgE; ++ArgI) {
// If we're lowering a memory intrinsic instead of a regular call, skip the
// last argument, which shouldn't be passed to the underlying function.
if (IntrMemName && e - i <= 1)
if (IntrMemName && ArgE - ArgI <= 1)
break;

ISD::ArgFlagsTy Flags;
unsigned ArgIdx = i - CS.arg_begin();
if (CS.paramHasAttr(ArgIdx, Attribute::SExt))
unsigned ArgIdx = ArgI - CI->arg_begin();
if (CI->paramHasAttr(ArgIdx, Attribute::SExt))
Flags.setSExt();
if (CS.paramHasAttr(ArgIdx, Attribute::ZExt))
if (CI->paramHasAttr(ArgIdx, Attribute::ZExt))
Flags.setZExt();

// FIXME: Only handle *easy* calls for now.
if (CS.paramHasAttr(ArgIdx, Attribute::InReg) ||
CS.paramHasAttr(ArgIdx, Attribute::StructRet) ||
CS.paramHasAttr(ArgIdx, Attribute::SwiftSelf) ||
CS.paramHasAttr(ArgIdx, Attribute::SwiftError) ||
CS.paramHasAttr(ArgIdx, Attribute::Nest) ||
CS.paramHasAttr(ArgIdx, Attribute::ByVal))
if (CI->paramHasAttr(ArgIdx, Attribute::InReg) ||
CI->paramHasAttr(ArgIdx, Attribute::StructRet) ||
CI->paramHasAttr(ArgIdx, Attribute::SwiftSelf) ||
CI->paramHasAttr(ArgIdx, Attribute::SwiftError) ||
CI->paramHasAttr(ArgIdx, Attribute::Nest) ||
CI->paramHasAttr(ArgIdx, Attribute::ByVal))
return false;

Type *ArgTy = (*i)->getType();
Type *ArgTy = (*ArgI)->getType();
MVT ArgVT;
if (!isTypeLegal(ArgTy, ArgVT) && ArgVT != MVT::i16 && ArgVT != MVT::i8 &&
ArgVT != MVT::i1)
return false;

Register Arg = getRegForValue(*i);
Register Arg = getRegForValue(*ArgI);
if (!Arg.isValid())
return false;

Flags.setOrigAlign(Align(DL.getABITypeAlignment(ArgTy)));

Args.push_back(*i);
Args.push_back(*ArgI);
ArgRegs.push_back(Arg);
ArgVTs.push_back(ArgVT);
ArgFlags.push_back(Flags);
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
Expand Up @@ -16,7 +16,6 @@
#include "llvm/CodeGen/ISDOpcodes.h"
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Instruction.h"
Expand Down Expand Up @@ -1354,8 +1353,7 @@ void ARMTTIImpl::getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
return;

if (isa<CallInst>(I) || isa<InvokeInst>(I)) {
ImmutableCallSite CS(&I);
if (const Function *F = CS.getCalledFunction()) {
if (const Function *F = cast<CallBase>(I).getCalledFunction()) {
if (!isLoweredToCall(F))
continue;
}
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
Expand Up @@ -31,7 +31,6 @@
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/Target/PowerPC/PPCISelLowering.cpp
Expand Up @@ -55,7 +55,6 @@
#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
Expand Down
Expand Up @@ -208,7 +208,6 @@
///===----------------------------------------------------------------------===//

#include "WebAssembly.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/IRBuilder.h"
Expand Down

0 comments on commit d22989c

Please sign in to comment.