[llvm-dev] RFC: Absolute or "fixed address" symbols as immediate operands

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Wed Oct 12 17:00:09 PDT 2016


On 10/11/2016 10:13 PM, Peter Collingbourne via llvm-dev wrote:
> +    bool SelectFancyImm(SDValue N, SDValue &Op) {
> +      if (isa<ConstantSDNode>(N)) {
> +        Op = N;
> +        return true;
> +      } else {
> +        return false;
> +      }
> +    }

The result should be a TargetConstant.  Something like

bool SelectFancyImm(SDValue N, SDValue &Op) {
   auto *CN = dyn_cast<ConstantSDNode>(N);
   if (!CN)
     return false;
   Op = CurDAG->getTargetConstant(CN->getZExtValue(), MVT::i32);
   return true;
}

-Krzysztof



More information about the llvm-dev mailing list