From 4fbd796a1251a27e6590765a0a34876f436a0af9 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 12 Sep 2008 18:08:03 +0000 Subject: Change ConstantSDNode and ConstantFPSDNode to use ConstantInt* and ConstantFP* instead of APInt and APFloat directly. This reduces the amount of time to create ConstantSDNode and ConstantFPSDNode nodes when ConstantInt* and ConstantFP* respectively are already available, as is the case in SelectionDAGBuild.cpp. Also, it reduces the amount of time to legalize constants into constant pools, and the amount of time to add ConstantFP operands to MachineInstrs, due to eliminating ConstantInt::get and ConstantFP::get calls. It increases the amount of work needed to create new constants in cases where the client doesn't already have a ConstantInt* or ConstantFP*, such as legalize expanding 64-bit integer constants to 32-bit constants. And it adds a layer of indirection for the accessor methods. But these appear to be outweight by the benefits in most cases. It will also make it easier to make ConstantSDNode and ConstantFPNode more consistent with ConstantInt and ConstantFP. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56162 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp') diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp index 51f7a75b6b..a95a50bea7 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp @@ -794,7 +794,7 @@ SDValue SelectionDAGLowering::getValue(const Value *V) { MVT VT = TLI.getValueType(V->getType(), true); if (ConstantInt *CI = dyn_cast(C)) - return N = DAG.getConstant(CI->getValue(), VT); + return N = DAG.getConstant(*CI, VT); if (GlobalValue *GV = dyn_cast(C)) return N = DAG.getGlobalAddress(GV, VT); @@ -803,7 +803,7 @@ SDValue SelectionDAGLowering::getValue(const Value *V) { return N = DAG.getConstant(0, TLI.getPointerTy()); if (ConstantFP *CFP = dyn_cast(C)) - return N = DAG.getConstantFP(CFP->getValueAPF(), VT); + return N = DAG.getConstantFP(*CFP, VT); if (isa(C) && !isa(V->getType()) && !V->getType()->isAggregateType()) -- cgit v1.2.3-18-g5258