mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-24 23:19:03 +00:00
Use MCSymbols for FastISel.
The summary is that it moves the mangling earlier and replaces a few calls to .addExternalSymbol with addSym. I originally wanted to replace all the uses of addExternalSymbol with addSym, but noticed it was a lot of work and doesn't need to be done all at once. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240395 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -69,7 +69,7 @@ public:
|
||||
unsigned NumFixedArgs;
|
||||
CallingConv::ID CallConv;
|
||||
const Value *Callee;
|
||||
const char *SymName;
|
||||
MCSymbol *Symbol;
|
||||
ArgListTy Args;
|
||||
ImmutableCallSite *CS;
|
||||
MachineInstr *Call;
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
: RetTy(nullptr), RetSExt(false), RetZExt(false), IsVarArg(false),
|
||||
IsInReg(false), DoesNotReturn(false), IsReturnValueUsed(true),
|
||||
IsTailCall(false), NumFixedArgs(-1), CallConv(CallingConv::C),
|
||||
Callee(nullptr), SymName(nullptr), CS(nullptr), Call(nullptr),
|
||||
Callee(nullptr), Symbol(nullptr), CS(nullptr), Call(nullptr),
|
||||
ResultReg(0), NumResultRegs(0), IsPatchPoint(false) {}
|
||||
|
||||
CallLoweringInfo &setCallee(Type *ResultTy, FunctionType *FuncTy,
|
||||
@@ -114,12 +114,12 @@ public:
|
||||
}
|
||||
|
||||
CallLoweringInfo &setCallee(Type *ResultTy, FunctionType *FuncTy,
|
||||
const char *Target, ArgListTy &&ArgsList,
|
||||
MCSymbol *Target, ArgListTy &&ArgsList,
|
||||
ImmutableCallSite &Call,
|
||||
unsigned FixedArgs = ~0U) {
|
||||
RetTy = ResultTy;
|
||||
Callee = Call.getCalledValue();
|
||||
SymName = Target;
|
||||
Symbol = Target;
|
||||
|
||||
IsInReg = Call.paramHasAttr(0, Attribute::InReg);
|
||||
DoesNotReturn = Call.doesNotReturn();
|
||||
@@ -148,11 +148,16 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
CallLoweringInfo &setCallee(CallingConv::ID CC, Type *ResultTy,
|
||||
CallLoweringInfo &setCallee(const DataLayout &DL, MCContext &Ctx,
|
||||
CallingConv::ID CC, Type *ResultTy,
|
||||
const char *Target, ArgListTy &&ArgsList,
|
||||
unsigned FixedArgs = ~0U);
|
||||
|
||||
CallLoweringInfo &setCallee(CallingConv::ID CC, Type *ResultTy,
|
||||
MCSymbol *Target, ArgListTy &&ArgsList,
|
||||
unsigned FixedArgs = ~0U) {
|
||||
RetTy = ResultTy;
|
||||
SymName = Target;
|
||||
Symbol = Target;
|
||||
CallConv = CC;
|
||||
Args = std::move(ArgsList);
|
||||
NumFixedArgs = (FixedArgs == ~0U) ? Args.size() : FixedArgs;
|
||||
@@ -504,7 +509,9 @@ protected:
|
||||
|
||||
CmpInst::Predicate optimizeCmpPredicate(const CmpInst *CI) const;
|
||||
|
||||
bool lowerCallTo(const CallInst *CI, const char *SymName, unsigned NumArgs);
|
||||
bool lowerCallTo(const CallInst *CI, MCSymbol *Symbol, unsigned NumArgs);
|
||||
bool lowerCallTo(const CallInst *CI, const char *SymbolName,
|
||||
unsigned NumArgs);
|
||||
bool lowerCallTo(CallLoweringInfo &CLI);
|
||||
|
||||
bool isCommutativeIntrinsic(IntrinsicInst const *II) {
|
||||
|
||||
@@ -185,8 +185,9 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
const MachineInstrBuilder &addSym(MCSymbol *Sym) const {
|
||||
MI->addOperand(*MF, MachineOperand::CreateMCSymbol(Sym));
|
||||
const MachineInstrBuilder &addSym(MCSymbol *Sym,
|
||||
unsigned char TargetFlags = 0) const {
|
||||
MI->addOperand(*MF, MachineOperand::CreateMCSymbol(Sym, TargetFlags));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -705,10 +705,12 @@ public:
|
||||
return Op;
|
||||
}
|
||||
|
||||
static MachineOperand CreateMCSymbol(MCSymbol *Sym) {
|
||||
static MachineOperand CreateMCSymbol(MCSymbol *Sym,
|
||||
unsigned char TargetFlags = 0) {
|
||||
MachineOperand Op(MachineOperand::MO_MCSymbol);
|
||||
Op.Contents.Sym = Sym;
|
||||
Op.setOffset(0);
|
||||
Op.setTargetFlags(TargetFlags);
|
||||
return Op;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,10 @@ public:
|
||||
/// Print the appropriate prefix and the specified global variable's name.
|
||||
/// If the global variable doesn't have a name, this fills in a unique name
|
||||
/// for the global.
|
||||
|
||||
static void getNameWithPrefix(SmallVectorImpl<char> &OutName,
|
||||
const Twine &GVName, const DataLayout &DL);
|
||||
|
||||
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
|
||||
bool CannotUsePrivateLabel) const;
|
||||
void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
|
||||
|
||||
Reference in New Issue
Block a user