mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 06:33:24 +00:00
allow the address of a global to be used with the "i" constraint when in
-static mode. This implements PR882. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31326 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0d92499455
commit
22aaf1d61c
@ -5466,6 +5466,36 @@ X86TargetLowering::getConstraintType(char ConstraintLetter) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// isOperandValidForConstraint - Return the specified operand (possibly
|
||||||
|
/// modified) if the specified SDOperand is valid for the specified target
|
||||||
|
/// constraint letter, otherwise return null.
|
||||||
|
SDOperand X86TargetLowering::
|
||||||
|
isOperandValidForConstraint(SDOperand Op, char Constraint, SelectionDAG &DAG) {
|
||||||
|
switch (Constraint) {
|
||||||
|
default: break;
|
||||||
|
case 'i':
|
||||||
|
// Literal immediates are always ok.
|
||||||
|
if (isa<ConstantSDNode>(Op)) return Op;
|
||||||
|
|
||||||
|
// If we are in non-pic codegen mode, we allow the address of a global to
|
||||||
|
// be used with 'i'.
|
||||||
|
if (GlobalAddressSDNode *GA = dyn_cast<GlobalAddressSDNode>(Op)) {
|
||||||
|
if (getTargetMachine().getRelocationModel() == Reloc::PIC_)
|
||||||
|
return SDOperand(0, 0);
|
||||||
|
|
||||||
|
if (GA->getOpcode() != ISD::TargetGlobalAddress)
|
||||||
|
Op = DAG.getTargetGlobalAddress(GA->getGlobal(), GA->getValueType(0),
|
||||||
|
GA->getOffset());
|
||||||
|
return Op;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, not valid for this mode.
|
||||||
|
return SDOperand(0, 0);
|
||||||
|
}
|
||||||
|
return TargetLowering::isOperandValidForConstraint(Op, Constraint, DAG);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<unsigned> X86TargetLowering::
|
std::vector<unsigned> X86TargetLowering::
|
||||||
getRegClassForInlineAsmConstraint(const std::string &Constraint,
|
getRegClassForInlineAsmConstraint(const std::string &Constraint,
|
||||||
MVT::ValueType VT) const {
|
MVT::ValueType VT) const {
|
||||||
|
@ -300,6 +300,11 @@ namespace llvm {
|
|||||||
std::vector<unsigned>
|
std::vector<unsigned>
|
||||||
getRegClassForInlineAsmConstraint(const std::string &Constraint,
|
getRegClassForInlineAsmConstraint(const std::string &Constraint,
|
||||||
MVT::ValueType VT) const;
|
MVT::ValueType VT) const;
|
||||||
|
/// isOperandValidForConstraint - Return the specified operand (possibly
|
||||||
|
/// modified) if the specified SDOperand is valid for the specified target
|
||||||
|
/// constraint letter, otherwise return null.
|
||||||
|
SDOperand isOperandValidForConstraint(SDOperand Op, char ConstraintLetter,
|
||||||
|
SelectionDAG &DAG);
|
||||||
|
|
||||||
/// getRegForInlineAsmConstraint - Given a physical register constraint
|
/// getRegForInlineAsmConstraint - Given a physical register constraint
|
||||||
/// (e.g. {edx}), return the register number and the register class for the
|
/// (e.g. {edx}), return the register number and the register class for the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user