简体   繁体   中英

LLVM C++ API How to create a constant f128

how can I create a constant f128 (quad) using the LLVM C*+ API. Usually you do it like this (as per the tutorial):

ConstantFP::get(*TheContext, APFloat(Val))

But APFloat has no constructor that can take a long double or a StringRef where I can pass in the string repr of the quad. So how do I create a long double with the LLVM C++ API? As per the documentation of the IR language I know that a f128 type exists.

Try using this method instead with an f128 type gotten from this llvm::Type static member

Looks like APFloat has a constructor that takes a String and another that takes an abitrary precision integer (presumably containing the bits of the IEEE754 representation). The fp128 Type object has getFltSemantics() which both constructors need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM