mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-10 16:24:04 +00:00
Added interface to allow clients to create a MemIntrinsicNode for
target intrinsics that touches memory git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58548 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
de5b06b3e1
commit
3efcd4a65c
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
#include "llvm/InlineAsm.h"
|
#include "llvm/InlineAsm.h"
|
||||||
|
#include "llvm/Instructions.h"
|
||||||
#include "llvm/CodeGen/SelectionDAGNodes.h"
|
#include "llvm/CodeGen/SelectionDAGNodes.h"
|
||||||
#include "llvm/CodeGen/RuntimeLibcalls.h"
|
#include "llvm/CodeGen/RuntimeLibcalls.h"
|
||||||
#include "llvm/ADT/APFloat.h"
|
#include "llvm/ADT/APFloat.h"
|
||||||
@ -264,6 +265,26 @@ public:
|
|||||||
unsigned &NumIntermediates,
|
unsigned &NumIntermediates,
|
||||||
MVT &RegisterVT) const;
|
MVT &RegisterVT) const;
|
||||||
|
|
||||||
|
/// getTgtMemIntrinsic: Given an intrinsic, checks if on the target the
|
||||||
|
/// intrinsic will need to map to a MemIntrinsicNode (touches memory). If
|
||||||
|
/// this is the case, it returns true and store the intrinsic
|
||||||
|
/// information into the IntrinsicInfo that was passed to the function.
|
||||||
|
typedef struct IntrinsicInfo {
|
||||||
|
unsigned opc; // target opcode
|
||||||
|
MVT memVT; // memory VT
|
||||||
|
const Value* ptrVal; // value representing memory location
|
||||||
|
int offset; // offset off of ptrVal
|
||||||
|
unsigned align; // alignment
|
||||||
|
bool vol; // is volatile?
|
||||||
|
bool readMem; // reads memory?
|
||||||
|
bool writeMem; // writes memory?
|
||||||
|
} IntrinisicInfo;
|
||||||
|
|
||||||
|
virtual bool getTgtMemIntrinsic(IntrinsicInfo& Info,
|
||||||
|
CallInst &I, unsigned Intrinsic) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// getWidenVectorType: given a vector type, returns the type to widen to
|
/// getWidenVectorType: given a vector type, returns the type to widen to
|
||||||
/// (e.g., v7i8 to v8i8). If the vector type is legal, it returns itself.
|
/// (e.g., v7i8 to v8i8). If the vector type is legal, it returns itself.
|
||||||
/// If there is no vector type that we want to widen to, returns MVT::Other
|
/// If there is no vector type that we want to widen to, returns MVT::Other
|
||||||
|
@ -2578,7 +2578,12 @@ void SelectionDAGLowering::visitTargetIntrinsic(CallInst &I,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the intrinsic ID as an integer operand.
|
// Info is set by getTgtMemInstrinsic
|
||||||
|
TargetLowering::IntrinsicInfo Info;
|
||||||
|
bool IsTgtIntrinsic = TLI.getTgtMemIntrinsic(Info, I, Intrinsic);
|
||||||
|
|
||||||
|
// Add the intrinsic ID as an integer operand if it's not a target intrinsic.
|
||||||
|
if (!IsTgtIntrinsic)
|
||||||
Ops.push_back(DAG.getConstant(Intrinsic, TLI.getPointerTy()));
|
Ops.push_back(DAG.getConstant(Intrinsic, TLI.getPointerTy()));
|
||||||
|
|
||||||
// Add all operands of the call to the operand list.
|
// Add all operands of the call to the operand list.
|
||||||
@ -2610,7 +2615,15 @@ void SelectionDAGLowering::visitTargetIntrinsic(CallInst &I,
|
|||||||
|
|
||||||
// Create the node.
|
// Create the node.
|
||||||
SDValue Result;
|
SDValue Result;
|
||||||
if (!HasChain)
|
if (IsTgtIntrinsic) {
|
||||||
|
// This is target intrinsic that touches memory
|
||||||
|
Result = DAG.getMemIntrinsicNode(Info.opc, VTList, VTs.size(),
|
||||||
|
&Ops[0], Ops.size(),
|
||||||
|
Info.memVT, Info.ptrVal, Info.offset,
|
||||||
|
Info.align, Info.vol,
|
||||||
|
Info.readMem, Info.writeMem);
|
||||||
|
}
|
||||||
|
else if (!HasChain)
|
||||||
Result = DAG.getNode(ISD::INTRINSIC_WO_CHAIN, VTList, VTs.size(),
|
Result = DAG.getNode(ISD::INTRINSIC_WO_CHAIN, VTList, VTs.size(),
|
||||||
&Ops[0], Ops.size());
|
&Ops[0], Ops.size());
|
||||||
else if (I.getType() != Type::VoidTy)
|
else if (I.getType() != Type::VoidTy)
|
||||||
|
Loading…
Reference in New Issue
Block a user