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

Peter Collingbourne via llvm-dev llvm-dev at lists.llvm.org
Wed Oct 12 17:22:35 PDT 2016


On Wed, Oct 12, 2016 at 5:00 PM, Krzysztof Parzyszek via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> 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;
> }
>

Thanks, that got me past that problem.

-- 
-- 
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161012/3e7eb771/attachment.html>


More information about the llvm-dev mailing list