[llvm-dev] Newbie question on codeine for SmallString

ecwdw 23e3e23e via llvm-dev llvm-dev at lists.llvm.org
Tue Mar 27 16:48:06 PDT 2018


The LLVM Tutorial,

   https://llvm.org/docs/tutorial/LangImpl01.html

provides an excellent introduction to language definition and code generation.

I am looking for a similar example that demonstrates how to use SmallString. Even a small test program,

————
#include <llvm/ADT/SmallString.h>

int main(int argc, char **argv)
{
    llvm::SmallString<32> str("hello world\n");
    printf("%s\n", str.c_str());
    return 0;
}
————

produces  81 lines of IR. In the same way the tutorials generate code over doubles, I’m looking for a way to generate IR code for SmallStrings over typical blocks: declare variable of type SmallString, assign to it, concat to it, and so on.

Thanks


More information about the llvm-dev mailing list