mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-22 07:24:47 +00:00
Add const qualifiers to CodeGen's use of LLVM IR constructs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101334 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -87,28 +87,28 @@ public:
|
||||
/// LLVM IR instruction, and append generated machine instructions to
|
||||
/// the current block. Return true if selection was successful.
|
||||
///
|
||||
bool SelectInstruction(Instruction *I);
|
||||
bool SelectInstruction(const Instruction *I);
|
||||
|
||||
/// SelectOperator - Do "fast" instruction selection for the given
|
||||
/// LLVM IR operator (Instruction or ConstantExpr), and append
|
||||
/// generated machine instructions to the current block. Return true
|
||||
/// if selection was successful.
|
||||
///
|
||||
bool SelectOperator(User *I, unsigned Opcode);
|
||||
bool SelectOperator(const User *I, unsigned Opcode);
|
||||
|
||||
/// getRegForValue - Create a virtual register and arrange for it to
|
||||
/// be assigned the value for the given LLVM value.
|
||||
unsigned getRegForValue(Value *V);
|
||||
unsigned getRegForValue(const Value *V);
|
||||
|
||||
/// lookUpRegForValue - Look up the value to see if its value is already
|
||||
/// cached in a register. It may be defined by instructions across blocks or
|
||||
/// defined locally.
|
||||
unsigned lookUpRegForValue(Value *V);
|
||||
unsigned lookUpRegForValue(const Value *V);
|
||||
|
||||
/// getRegForGEPIndex - This is a wrapper around getRegForValue that also
|
||||
/// takes care of truncating or sign-extending the given getelementptr
|
||||
/// index value.
|
||||
unsigned getRegForGEPIndex(Value *V);
|
||||
unsigned getRegForGEPIndex(const Value *V);
|
||||
|
||||
virtual ~FastISel();
|
||||
|
||||
@@ -128,7 +128,7 @@ protected:
|
||||
/// fit into FastISel's framework. It returns true if it was successful.
|
||||
///
|
||||
virtual bool
|
||||
TargetSelectInstruction(Instruction *I) = 0;
|
||||
TargetSelectInstruction(const Instruction *I) = 0;
|
||||
|
||||
/// FastEmit_r - This method is called by target-independent code
|
||||
/// to request that an instruction with the given type and opcode
|
||||
@@ -170,7 +170,7 @@ protected:
|
||||
virtual unsigned FastEmit_rf(MVT VT,
|
||||
MVT RetVT,
|
||||
unsigned Opcode,
|
||||
unsigned Op0, ConstantFP *FPImm);
|
||||
unsigned Op0, const ConstantFP *FPImm);
|
||||
|
||||
/// FastEmit_rri - This method is called by target-independent code
|
||||
/// to request that an instruction with the given type, opcode, and
|
||||
@@ -196,7 +196,7 @@ protected:
|
||||
/// FastEmit_rr instead.
|
||||
unsigned FastEmit_rf_(MVT VT,
|
||||
unsigned Opcode,
|
||||
unsigned Op0, ConstantFP *FPImm,
|
||||
unsigned Op0, const ConstantFP *FPImm,
|
||||
MVT ImmType);
|
||||
|
||||
/// FastEmit_i - This method is called by target-independent code
|
||||
@@ -213,7 +213,7 @@ protected:
|
||||
virtual unsigned FastEmit_f(MVT VT,
|
||||
MVT RetVT,
|
||||
unsigned Opcode,
|
||||
ConstantFP *FPImm);
|
||||
const ConstantFP *FPImm);
|
||||
|
||||
/// FastEmitInst_ - Emit a MachineInstr with no operands and a
|
||||
/// result register in the given register class.
|
||||
@@ -247,7 +247,7 @@ protected:
|
||||
///
|
||||
unsigned FastEmitInst_rf(unsigned MachineInstOpcode,
|
||||
const TargetRegisterClass *RC,
|
||||
unsigned Op0, ConstantFP *FPImm);
|
||||
unsigned Op0, const ConstantFP *FPImm);
|
||||
|
||||
/// FastEmitInst_rri - Emit a MachineInstr with two register operands,
|
||||
/// an immediate, and a result register in the given register class.
|
||||
@@ -277,34 +277,34 @@ protected:
|
||||
/// the CFG.
|
||||
void FastEmitBranch(MachineBasicBlock *MBB);
|
||||
|
||||
unsigned UpdateValueMap(Value* I, unsigned Reg);
|
||||
unsigned UpdateValueMap(const Value* I, unsigned Reg);
|
||||
|
||||
unsigned createResultReg(const TargetRegisterClass *RC);
|
||||
|
||||
/// TargetMaterializeConstant - Emit a constant in a register using
|
||||
/// target-specific logic, such as constant pool loads.
|
||||
virtual unsigned TargetMaterializeConstant(Constant* C) {
|
||||
virtual unsigned TargetMaterializeConstant(const Constant* C) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// TargetMaterializeAlloca - Emit an alloca address in a register using
|
||||
/// target-specific logic.
|
||||
virtual unsigned TargetMaterializeAlloca(AllocaInst* C) {
|
||||
virtual unsigned TargetMaterializeAlloca(const AllocaInst* C) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
bool SelectBinaryOp(User *I, unsigned ISDOpcode);
|
||||
bool SelectBinaryOp(const User *I, unsigned ISDOpcode);
|
||||
|
||||
bool SelectFNeg(User *I);
|
||||
bool SelectFNeg(const User *I);
|
||||
|
||||
bool SelectGetElementPtr(User *I);
|
||||
bool SelectGetElementPtr(const User *I);
|
||||
|
||||
bool SelectCall(User *I);
|
||||
bool SelectCall(const User *I);
|
||||
|
||||
bool SelectBitCast(User *I);
|
||||
bool SelectBitCast(const User *I);
|
||||
|
||||
bool SelectCast(User *I, unsigned Opcode);
|
||||
bool SelectCast(const User *I, unsigned Opcode);
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -68,9 +68,9 @@ namespace llvm {
|
||||
struct GCRoot {
|
||||
int Num; //< Usually a frame index.
|
||||
int StackOffset; //< Offset from the stack pointer.
|
||||
Constant *Metadata; //< Metadata straight from the call to llvm.gcroot.
|
||||
const Constant *Metadata;//< Metadata straight from the call to llvm.gcroot.
|
||||
|
||||
GCRoot(int N, Constant *MD) : Num(N), StackOffset(-1), Metadata(MD) {}
|
||||
GCRoot(int N, const Constant *MD) : Num(N), StackOffset(-1), Metadata(MD) {}
|
||||
};
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace llvm {
|
||||
/// addStackRoot - Registers a root that lives on the stack. Num is the
|
||||
/// stack object ID for the alloca (if the code generator is
|
||||
// using MachineFrameInfo).
|
||||
void addStackRoot(int Num, Constant *Metadata) {
|
||||
void addStackRoot(int Num, const Constant *Metadata) {
|
||||
Roots.push_back(GCRoot(Num, Metadata));
|
||||
}
|
||||
|
||||
|
@@ -74,7 +74,7 @@ class MachineConstantPoolEntry {
|
||||
public:
|
||||
/// The constant itself.
|
||||
union {
|
||||
Constant *ConstVal;
|
||||
const Constant *ConstVal;
|
||||
MachineConstantPoolValue *MachineCPVal;
|
||||
} Val;
|
||||
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
/// a MachineConstantPoolValue.
|
||||
unsigned Alignment;
|
||||
|
||||
MachineConstantPoolEntry(Constant *V, unsigned A)
|
||||
MachineConstantPoolEntry(const Constant *V, unsigned A)
|
||||
: Alignment(A) {
|
||||
Val.ConstVal = V;
|
||||
}
|
||||
@@ -143,7 +143,7 @@ public:
|
||||
/// getConstantPoolIndex - Create a new entry in the constant pool or return
|
||||
/// an existing one. User must specify the minimum required alignment for
|
||||
/// the object.
|
||||
unsigned getConstantPoolIndex(Constant *C, unsigned Alignment);
|
||||
unsigned getConstantPoolIndex(const Constant *C, unsigned Alignment);
|
||||
unsigned getConstantPoolIndex(MachineConstantPoolValue *V,unsigned Alignment);
|
||||
|
||||
/// isEmpty - Return true if this constant pool contains no constants.
|
||||
|
@@ -104,7 +104,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
const MachineInstrBuilder &addGlobalAddress(GlobalValue *GV,
|
||||
const MachineInstrBuilder &addGlobalAddress(const GlobalValue *GV,
|
||||
int64_t Offset = 0,
|
||||
unsigned char TargetFlags = 0) const {
|
||||
MI->addOperand(MachineOperand::CreateGA(GV, Offset, TargetFlags));
|
||||
|
@@ -82,7 +82,7 @@ struct LandingPadInfo {
|
||||
SmallVector<MCSymbol*, 1> BeginLabels; // Labels prior to invoke.
|
||||
SmallVector<MCSymbol*, 1> EndLabels; // Labels after invoke.
|
||||
MCSymbol *LandingPadLabel; // Label at beginning of landing pad.
|
||||
Function *Personality; // Personality function.
|
||||
const Function *Personality; // Personality function.
|
||||
std::vector<int> TypeIds; // List of type ids (filters negative)
|
||||
|
||||
explicit LandingPadInfo(MachineBasicBlock *MBB)
|
||||
@@ -101,7 +101,7 @@ class MachineModuleInfo : public ImmutablePass {
|
||||
MCContext Context;
|
||||
|
||||
/// TheModule - This is the LLVM Module being worked on.
|
||||
Module *TheModule;
|
||||
const Module *TheModule;
|
||||
|
||||
/// ObjFileMMI - This is the object-file-format-specific implementation of
|
||||
/// MachineModuleInfoImpl, which lets targets accumulate whatever info they
|
||||
@@ -125,7 +125,7 @@ class MachineModuleInfo : public ImmutablePass {
|
||||
|
||||
// TypeInfos - List of C++ TypeInfo used in the current function.
|
||||
//
|
||||
std::vector<GlobalVariable *> TypeInfos;
|
||||
std::vector<const GlobalVariable *> TypeInfos;
|
||||
|
||||
// FilterIds - List of typeids encoding filters used in the current function.
|
||||
//
|
||||
@@ -138,7 +138,7 @@ class MachineModuleInfo : public ImmutablePass {
|
||||
|
||||
// Personalities - Vector of all personality functions ever seen. Used to emit
|
||||
// common EH frames.
|
||||
std::vector<Function *> Personalities;
|
||||
std::vector<const Function *> Personalities;
|
||||
|
||||
/// UsedFunctions - The functions in the @llvm.used list in a more easily
|
||||
/// searchable format. This does not include the functions in
|
||||
@@ -179,8 +179,8 @@ public:
|
||||
const MCContext &getContext() const { return Context; }
|
||||
MCContext &getContext() { return Context; }
|
||||
|
||||
void setModule(Module *M) { TheModule = M; }
|
||||
Module *getModule() const { return TheModule; }
|
||||
void setModule(const Module *M) { TheModule = M; }
|
||||
const Module *getModule() const { return TheModule; }
|
||||
|
||||
/// getInfo - Keep track of various per-function pieces of information for
|
||||
/// backends that would like to do so.
|
||||
@@ -199,7 +199,7 @@ public:
|
||||
|
||||
/// AnalyzeModule - Scan the module for global debug information.
|
||||
///
|
||||
void AnalyzeModule(Module &M);
|
||||
void AnalyzeModule(const Module &M);
|
||||
|
||||
/// hasDebugInfo - Returns true if valid debug info is present.
|
||||
///
|
||||
@@ -252,14 +252,15 @@ public:
|
||||
|
||||
/// addPersonality - Provide the personality function for the exception
|
||||
/// information.
|
||||
void addPersonality(MachineBasicBlock *LandingPad, Function *Personality);
|
||||
void addPersonality(MachineBasicBlock *LandingPad,
|
||||
const Function *Personality);
|
||||
|
||||
/// getPersonalityIndex - Get index of the current personality function inside
|
||||
/// Personalitites array
|
||||
unsigned getPersonalityIndex() const;
|
||||
|
||||
/// getPersonalities - Return array of personality functions ever seen.
|
||||
const std::vector<Function *>& getPersonalities() const {
|
||||
const std::vector<const Function *>& getPersonalities() const {
|
||||
return Personalities;
|
||||
}
|
||||
|
||||
@@ -273,12 +274,12 @@ public:
|
||||
/// addCatchTypeInfo - Provide the catch typeinfo for a landing pad.
|
||||
///
|
||||
void addCatchTypeInfo(MachineBasicBlock *LandingPad,
|
||||
std::vector<GlobalVariable *> &TyInfo);
|
||||
std::vector<const GlobalVariable *> &TyInfo);
|
||||
|
||||
/// addFilterTypeInfo - Provide the filter typeinfo for a landing pad.
|
||||
///
|
||||
void addFilterTypeInfo(MachineBasicBlock *LandingPad,
|
||||
std::vector<GlobalVariable *> &TyInfo);
|
||||
std::vector<const GlobalVariable *> &TyInfo);
|
||||
|
||||
/// addCleanup - Add a cleanup action for a landing pad.
|
||||
///
|
||||
@@ -286,7 +287,7 @@ public:
|
||||
|
||||
/// getTypeIDFor - Return the type id for the specified typeinfo. This is
|
||||
/// function wide.
|
||||
unsigned getTypeIDFor(GlobalVariable *TI);
|
||||
unsigned getTypeIDFor(const GlobalVariable *TI);
|
||||
|
||||
/// getFilterIDFor - Return the id of the filter encoded by TyIds. This is
|
||||
/// function wide.
|
||||
@@ -323,7 +324,7 @@ public:
|
||||
|
||||
/// getTypeInfos - Return a reference to the C++ typeinfo for the current
|
||||
/// function.
|
||||
const std::vector<GlobalVariable *> &getTypeInfos() const {
|
||||
const std::vector<const GlobalVariable *> &getTypeInfos() const {
|
||||
return TypeInfos;
|
||||
}
|
||||
|
||||
@@ -335,7 +336,7 @@ public:
|
||||
|
||||
/// getPersonality - Return a personality function if available. The presence
|
||||
/// of one is required to emit exception handling info.
|
||||
Function *getPersonality() const;
|
||||
const Function *getPersonality() const;
|
||||
|
||||
/// setVariableDbgInfo - Collect information used to emit debugging
|
||||
/// information of a variable.
|
||||
|
@@ -117,8 +117,8 @@ private:
|
||||
union {
|
||||
int Index; // For MO_*Index - The index itself.
|
||||
const char *SymbolName; // For MO_ExternalSymbol.
|
||||
GlobalValue *GV; // For MO_GlobalAddress.
|
||||
BlockAddress *BA; // For MO_BlockAddress.
|
||||
const GlobalValue *GV; // For MO_GlobalAddress.
|
||||
const BlockAddress *BA; // For MO_BlockAddress.
|
||||
} Val;
|
||||
int64_t Offset; // An offset from the object.
|
||||
} OffsetedInfo;
|
||||
@@ -315,12 +315,12 @@ public:
|
||||
return Contents.OffsetedInfo.Val.Index;
|
||||
}
|
||||
|
||||
GlobalValue *getGlobal() const {
|
||||
const GlobalValue *getGlobal() const {
|
||||
assert(isGlobal() && "Wrong MachineOperand accessor");
|
||||
return Contents.OffsetedInfo.Val.GV;
|
||||
}
|
||||
|
||||
BlockAddress *getBlockAddress() const {
|
||||
const BlockAddress *getBlockAddress() const {
|
||||
assert(isBlockAddress() && "Wrong MachineOperand accessor");
|
||||
return Contents.OffsetedInfo.Val.BA;
|
||||
}
|
||||
@@ -457,7 +457,7 @@ public:
|
||||
Op.setTargetFlags(TargetFlags);
|
||||
return Op;
|
||||
}
|
||||
static MachineOperand CreateGA(GlobalValue *GV, int64_t Offset,
|
||||
static MachineOperand CreateGA(const GlobalValue *GV, int64_t Offset,
|
||||
unsigned char TargetFlags = 0) {
|
||||
MachineOperand Op(MachineOperand::MO_GlobalAddress);
|
||||
Op.Contents.OffsetedInfo.Val.GV = GV;
|
||||
@@ -473,7 +473,7 @@ public:
|
||||
Op.setTargetFlags(TargetFlags);
|
||||
return Op;
|
||||
}
|
||||
static MachineOperand CreateBA(BlockAddress *BA,
|
||||
static MachineOperand CreateBA(const BlockAddress *BA,
|
||||
unsigned char TargetFlags = 0) {
|
||||
MachineOperand Op(MachineOperand::MO_BlockAddress);
|
||||
Op.Contents.OffsetedInfo.Val.BA = BA;
|
||||
|
@@ -350,10 +350,10 @@ public:
|
||||
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned char TargetFlags = 0) {
|
||||
return getJumpTable(JTI, VT, true, TargetFlags);
|
||||
}
|
||||
SDValue getConstantPool(Constant *C, EVT VT,
|
||||
SDValue getConstantPool(const Constant *C, EVT VT,
|
||||
unsigned Align = 0, int Offs = 0, bool isT=false,
|
||||
unsigned char TargetFlags = 0);
|
||||
SDValue getTargetConstantPool(Constant *C, EVT VT,
|
||||
SDValue getTargetConstantPool(const Constant *C, EVT VT,
|
||||
unsigned Align = 0, int Offset = 0,
|
||||
unsigned char TargetFlags = 0) {
|
||||
return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
|
||||
@@ -377,7 +377,7 @@ public:
|
||||
SDValue getValueType(EVT);
|
||||
SDValue getRegister(unsigned Reg, EVT VT);
|
||||
SDValue getEHLabel(DebugLoc dl, SDValue Root, MCSymbol *Label);
|
||||
SDValue getBlockAddress(BlockAddress *BA, EVT VT,
|
||||
SDValue getBlockAddress(const BlockAddress *BA, EVT VT,
|
||||
bool isTarget = false, unsigned char TargetFlags = 0);
|
||||
|
||||
SDValue getCopyToReg(SDValue Chain, DebugLoc dl, unsigned Reg, SDValue N) {
|
||||
@@ -767,7 +767,7 @@ public:
|
||||
///
|
||||
SDDbgValue *getDbgValue(MDNode *MDPtr, SDNode *N, unsigned R, uint64_t Off,
|
||||
DebugLoc DL, unsigned O);
|
||||
SDDbgValue *getDbgValue(MDNode *MDPtr, Value *C, uint64_t Off,
|
||||
SDDbgValue *getDbgValue(MDNode *MDPtr, const Value *C, uint64_t Off,
|
||||
DebugLoc DL, unsigned O);
|
||||
SDDbgValue *getDbgValue(MDNode *MDPtr, unsigned FI, uint64_t Off,
|
||||
DebugLoc DL, unsigned O);
|
||||
|
@@ -279,22 +279,23 @@ private:
|
||||
const SDValue *Ops, unsigned NumOps, unsigned EmitNodeInfo);
|
||||
|
||||
void PrepareEHLandingPad(MachineBasicBlock *BB);
|
||||
void SelectAllBasicBlocks(Function &Fn);
|
||||
void SelectAllBasicBlocks(const Function &Fn);
|
||||
void FinishBasicBlock();
|
||||
|
||||
void SelectBasicBlock(BasicBlock *LLVMBB,
|
||||
BasicBlock::iterator Begin,
|
||||
BasicBlock::iterator End,
|
||||
void SelectBasicBlock(const BasicBlock *LLVMBB,
|
||||
BasicBlock::const_iterator Begin,
|
||||
BasicBlock::const_iterator End,
|
||||
bool &HadTailCall);
|
||||
void CodeGenAndEmitDAG();
|
||||
void LowerArguments(BasicBlock *BB);
|
||||
void LowerArguments(const BasicBlock *BB);
|
||||
|
||||
void ShrinkDemandedOps();
|
||||
void ComputeLiveOutVRegInfo();
|
||||
|
||||
void HandlePHINodesInSuccessorBlocks(BasicBlock *LLVMBB);
|
||||
void HandlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB);
|
||||
|
||||
bool HandlePHINodesInSuccessorBlocksFast(BasicBlock *LLVMBB, FastISel *F);
|
||||
bool HandlePHINodesInSuccessorBlocksFast(const BasicBlock *LLVMBB,
|
||||
FastISel *F);
|
||||
|
||||
/// Create the scheduler. If a specific scheduler was specified
|
||||
/// via the SchedulerRegistry, use it, otherwise select the
|
||||
|
@@ -1140,7 +1140,7 @@ public:
|
||||
};
|
||||
|
||||
class GlobalAddressSDNode : public SDNode {
|
||||
GlobalValue *TheGlobal;
|
||||
const GlobalValue *TheGlobal;
|
||||
int64_t Offset;
|
||||
unsigned char TargetFlags;
|
||||
friend class SelectionDAG;
|
||||
@@ -1148,7 +1148,7 @@ class GlobalAddressSDNode : public SDNode {
|
||||
int64_t o, unsigned char TargetFlags);
|
||||
public:
|
||||
|
||||
GlobalValue *getGlobal() const { return TheGlobal; }
|
||||
const GlobalValue *getGlobal() const { return TheGlobal; }
|
||||
int64_t getOffset() const { return Offset; }
|
||||
unsigned char getTargetFlags() const { return TargetFlags; }
|
||||
// Return the address space this GlobalAddress belongs to.
|
||||
@@ -1203,15 +1203,15 @@ public:
|
||||
|
||||
class ConstantPoolSDNode : public SDNode {
|
||||
union {
|
||||
Constant *ConstVal;
|
||||
const Constant *ConstVal;
|
||||
MachineConstantPoolValue *MachineCPVal;
|
||||
} Val;
|
||||
int Offset; // It's a MachineConstantPoolValue if top bit is set.
|
||||
unsigned Alignment; // Minimum alignment requirement of CP (not log2 value).
|
||||
unsigned char TargetFlags;
|
||||
friend class SelectionDAG;
|
||||
ConstantPoolSDNode(bool isTarget, Constant *c, EVT VT, int o, unsigned Align,
|
||||
unsigned char TF)
|
||||
ConstantPoolSDNode(bool isTarget, const Constant *c, EVT VT, int o,
|
||||
unsigned Align, unsigned char TF)
|
||||
: SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool,
|
||||
DebugLoc(),
|
||||
getSDVTList(VT)), Offset(o), Alignment(Align), TargetFlags(TF) {
|
||||
@@ -1234,7 +1234,7 @@ public:
|
||||
return (int)Offset < 0;
|
||||
}
|
||||
|
||||
Constant *getConstVal() const {
|
||||
const Constant *getConstVal() const {
|
||||
assert(!isMachineConstantPoolEntry() && "Wrong constantpool type");
|
||||
return Val.ConstVal;
|
||||
}
|
||||
@@ -1360,16 +1360,16 @@ public:
|
||||
};
|
||||
|
||||
class BlockAddressSDNode : public SDNode {
|
||||
BlockAddress *BA;
|
||||
const BlockAddress *BA;
|
||||
unsigned char TargetFlags;
|
||||
friend class SelectionDAG;
|
||||
BlockAddressSDNode(unsigned NodeTy, EVT VT, BlockAddress *ba,
|
||||
BlockAddressSDNode(unsigned NodeTy, EVT VT, const BlockAddress *ba,
|
||||
unsigned char Flags)
|
||||
: SDNode(NodeTy, DebugLoc(), getSDVTList(VT)),
|
||||
BA(ba), TargetFlags(Flags) {
|
||||
}
|
||||
public:
|
||||
BlockAddress *getBlockAddress() const { return BA; }
|
||||
const BlockAddress *getBlockAddress() const { return BA; }
|
||||
unsigned char getTargetFlags() const { return TargetFlags; }
|
||||
|
||||
static bool classof(const BlockAddressSDNode *) { return true; }
|
||||
|
Reference in New Issue
Block a user