[llvm-dev] Inspecting 'Triple' from arbitrary source files

Martin J. O'Riordan via llvm-dev llvm-dev at lists.llvm.org
Mon Jan 1 04:42:13 PST 2018


Hi LLVM-Devs,

Sometimes when I am experimenting with a change for my out-of-tree target, I
find that to get it working I have to make changes to the target-independent
sources for LLVM.  Generally I do not like to do this, but sometimes I have
not been able to find a pure target-specific solution to the problem I am
working on, and have to make these changes in the target-independent code.

But LLVM can be configured to support code-generation for multiple targets,
so what I would like to do is always make my changes to these files check
the 'Triple' and only implement the change when the target is my
experimental
target.

Is there a general purpose way of accessing the current 'Triple' from any
where in the code so that I can add these checks?  In many places, I can
access it via some argument to a function, or from a member of the class to
which the function belongs, but this is not always possible.

In the longer term, I always strive to find a proper target-specific
solution
to this, but during prototyping and exploring, making temporary changes to
the target-independent code is the best way until I understand how to best
implement the final version.

Thanks and welcome to 2018,

	MartinO





More information about the llvm-dev mailing list