Implement Subtarget support

Implement the X86 Subtarget.

This consolidates the checks for target triple, and setting options based
on target triple into one place.  This allows us to convert the asm printer
and isel over from being littered with "forDarwin", "forCygwin", etc. into
just having the appropriate flags for each subtarget feature controlling
the code for that feature.

This patch also implements indirect external and weak references in the
X86 pattern isel, for darwin.  Next up is to convert over the asm printers
to use this new interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22389 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nate Begeman
2005-07-12 01:41:54 +00:00
parent 73213f6c07
commit fb5792f416
8 changed files with 219 additions and 4 deletions

View File

@@ -19,6 +19,7 @@
namespace llvm {
class TargetSubtarget;
class TargetInstrInfo;
class TargetInstrDescriptor;
class TargetJITInfo;
@@ -97,6 +98,13 @@ public:
virtual const TargetFrameInfo *getFrameInfo() const { return 0; }
const TargetData &getTargetData() const { return DataLayout; }
virtual const TargetSubtarget *getSubtargetImpl() const { return 0; }
template<typename STC> STC *getSubtarget() const {
assert(getSubtargetImpl() && dynamic_cast<STC*>(getSubtargetImpl()) &&
"Not the right kind of subtarget!");
return (STC*)getSubtargetImpl();
}
/// getRegisterInfo - If register information is available, return it. If
/// not, return null. This is kept separate from RegInfo until RegInfo has
/// details of graph coloring register allocation removed from it.