runtime: Factor out basic layout from getTupleTypeMetadata.
runtime: Factor out basic layout from getTupleTypeMetadata.

We'll want to use the same logic to lay out generic struct fields at runtime. While we're here, fix a bug where we weren't aligning field offsets prior to storing them in the tuple metadata.

Swift SVN r9117

apple/swift,sschiau/swift,kperryua/swift,sdulal/swift,SwiftAndroid/swift,gmilos/swift,gregomni/swift,sschiau/swift,danielmartin/swift,kusl/swift,codestergit/swift,return/swift,xedin/swift,milseman/swift,return/swift,johnno1962d/swift,bitjammer/swift,johnno1962d/swift,IngmarStein/swift,shahmishal/swift,emilstahl/swift,johnno1962d/swift,jtbandes/swift,kperryua/swift,LeoShimonaka/swift,frootloops/swift,hughbe/swift,huonw/swift,CodaFi/swift,xwu/swift,hughbe/swift,Ivacker/swift,therealbnut/swift,hughbe/swift,JaSpa/swift,tardieu/swift,kusl/swift,calebd/swift,cbrentharris/swift,JaSpa/swift,allevato/swift,amraboelela/swift,CodaFi/swift,arvedviehweger/swift,russbishop/swift,uasys/swift,devincoughlin/swift,practicalswift/swift,atrick/swift,manavgabhawala/swift,adrfer/swift,nathawes/swift,airspeedswift/swift,tardieu/swift,return/swift,devincoughlin/swift,uasys/swift,SwiftAndroid/swift,ben-ng/swift,calebd/swift,gribozavr/swift,lorentey/swift,apple/swift,tjw/swift,gribozavr/swift,stephentyrone/swift,zisko/swift,SwiftAndroid/swift,JGiola/swift,mightydeveloper/swift,sschiau/swift,OscarSwanros/swift,kusl/swift,JGiola/swift,amraboelela/swift,SwiftAndroid/swift,brentdax/swift,huonw/swift,glessard/swift,frootloops/swift,JaSpa/swift,MukeshKumarS/Swift,shajrawi/swift,tardieu/swift,tjw/swift,xedin/swift,shajrawi/swift,shahmishal/swift,alblue/swift,mightydeveloper/swift,gribozavr/swift,kperryua/swift,aschwaighofer/swift,hughbe/swift,apple/swift,kperryua/swift,parkera/swift,karwa/swift,allevato/swift,sschiau/swift,practicalswift/swift,natecook1000/swift,allevato/swift,lorentey/swift,tkremenek/swift,shajrawi/swift,xedin/swift,codestergit/swift,danielmartin/swift,felix91gr/swift,LeoShimonaka/swift,gmilos/swift,LeoShimonaka/swift,SwiftAndroid/swift,adrfer/swift,KrishMunot/swift,harlanhaskins/swift,djwbrown/swift,modocache/swift,JGiola/swift,adrfer/swift,sdulal/swift,cbrentharris/swift,ken0nek/swift,frootloops/swift,OscarSwanros/swift,apple/swift,dduan/swift,djwbrown/swift,emilstahl/swift,xedin/swift,deyton/swift,Jnosh/swift,kstaring/swift,russbishop/swift,devincoughlin/swift,practicalswift/swift,dduan/swift,rudkx/swift,calebd/swift,hooman/swift,practicalswift/swift,kstaring/swift,swiftix/swift,swiftix/swift,arvedviehweger/swift,zisko/swift,codestergit/swift,stephentyrone/swift,sschiau/swift,calebd/swift,aschwaighofer/swift,swiftix/swift.old,danielmartin/swift,jopamer/swift,modocache/swift,airspeedswift/swift,uasys/swift,Jnosh/swift,tkremenek/swift,KrishMunot/swift,jckarter/swift,gmilos/swift,kstaring/swift,tkremenek/swift,amraboelela/swift,mightydeveloper/swift,hooman/swift,dduan/swift,djwbrown/swift,KrishMunot/swift,cbrentharris/swift,kstaring/swift,johnno1962d/swift,jmgc/swift,shahmishal/swift,CodaFi/swift,tjw/swift,huonw/swift,return/swift,shahmishal/swift,tinysun212/swift-windows,KrishMunot/swift,alblue/swift,glessard/swift,milseman/swift,danielmartin/swift,codestergit/swift,devincoughlin/swift,IngmarStein/swift,therealbnut/swift,ken0nek/swift,hooman/swift,Ivacker/swift,KrishMunot/swift,austinzheng/swift,kusl/swift,harlanhaskins/swift,return/swift,jmgc/swift,djwbrown/swift,codestergit/swift,OscarSwanros/swift,tkremenek/swift,shahmishal/swift,dduan/swift,tardieu/swift,deyton/swift,jmgc/swift,felix91gr/swift,parkera/swift,johnno1962d/swift,khizkhiz/swift,modocache/swift,kusl/swift,adrfer/swift,benlangmuir/swift,parkera/swift,jtbandes/swift,emilstahl/swift,zisko/swift,stephentyrone/swift,glessard/swift,emilstahl/swift,gribozavr/swift,jtbandes/swift,gmilos/swift,gregomni/swift,swiftix/swift.old,frootloops/swift,atrick/swift,swiftix/swift,devincoughlin/swift,khizkhiz/swift,roambotics/swift,nathawes/swift,parkera/swift,jckarter/swift,sschiau/swift,kperryua/swift,Ivacker/swift,Jnosh/swift,austinzheng/swift,dreamsxin/swift,arvedviehweger/swift,hooman/swift,karwa/swift,tjw/swift,CodaFi/swift,shajrawi/swift,alblue/swift,parkera/swift,kperryua/swift,djwbrown/swift,xwu/swift,swiftix/swift,slavapestov/swift,zisko/swift,xwu/swift,JaSpa/swift,slavapestov/swift,therealbnut/swift,tkremenek/swift,jckarter/swift,tinysun212/swift-windows,manavgabhawala/swift,MukeshKumarS/Swift,jtbandes/swift,karwa/swift,shahmishal/swift,allevato/swift,emilstahl/swift,kentya6/swift,therealbnut/swift,LeoShimonaka/swift,cbrentharris/swift,slavapestov/swift,shajrawi/swift,aschwaighofer/swift,rudkx/swift,jmgc/swift,russbishop/swift,slavapestov/swift,hooman/swift,karwa/swift,tjw/swift,shajrawi/swift,tkremenek/swift,kentya6/swift,shajrawi/swift,slavapestov/swift,airspeedswift/swift,huonw/swift,brentdax/swift,swiftix/swift.old,sdulal/swift,brentdax/swift,ken0nek/swift,nathawes/swift,manavgabhawala/swift,roambotics/swift,bitjammer/swift,Ivacker/swift,sdulal/swift,sdulal/swift,kperryua/swift,emilstahl/swift,austinzheng/swift,swiftix/swift.old,IngmarStein/swift,aschwaighofer/swift,jopamer/swift,MukeshKumarS/Swift,atrick/swift,MukeshKumarS/Swift,allevato/swift,tinysun212/swift-windows,swiftix/swift.old,sschiau/swift,nathawes/swift,djwbrown/swift,ahoppen/swift,uasys/swift,lorentey/swift,johnno1962d/swift,amraboelela/swift,mightydeveloper/swift,brentdax/swift,gottesmm/swift,OscarSwanros/swift,ben-ng/swift,karwa/swift,roambotics/swift,danielmartin/swift,alblue/swift,shahmishal/swift,hughbe/swift,sschiau/swift,tjw/swift,atrick/swift,devincoughlin/swift,karwa/swift,Ivacker/swift,CodaFi/swift,kusl/swift,deyton/swift,gribozavr/swift,tkremenek/swift,jtbandes/swift,swiftix/swift,natecook1000/swift,felix91gr/swift,arvedviehweger/swift,danielmartin/swift,hooman/swift,milseman/swift,xwu/swift,russbishop/swift,airspeedswift/swift,aschwaighofer/swift,huonw/swift,amraboelela/swift,swiftix/swift.old,ahoppen/swift,harlanhaskins/swift,manavgabhawala/swift,rudkx/swift,stephentyrone/swift,gottesmm/swift,natecook1000/swift,kentya6/swift,allevato/swift,kentya6/swift,ahoppen/swift,glessard/swift,therealbnut/swift,arvedviehweger/swift,mightydeveloper/swift,hughbe/swift,CodaFi/swift,cbrentharris/swift,felix91gr/swift,OscarSwanros/swift,amraboelela/swift,modocache/swift,cbrentharris/swift,slavapestov/swift,return/swift,apple/swift,ken0nek/swift,milseman/swift,benlangmuir/swift,lorentey/swift,tinysun212/swift-windows,austinzheng/swift,devincoughlin/swift,modocache/swift,russbishop/swift,Ivacker/swift,jckarter/swift,sdulal/swift,JGiola/swift,kstaring/swift,shahmishal/swift,kentya6/swift,OscarSwanros/swift,roambotics/swift,jmgc/swift,LeoShimonaka/swift,JaSpa/swift,kentya6/swift,gmilos/swift,nathawes/swift,kusl/swift,jopamer/swift,felix91gr/swift,natecook1000/swift,gregomni/swift,kusl/swift,gmilos/swift,jopamer/swift,deyton/swift,slavapestov/swift,gribozavr/swift,khizkhiz/swift,russbishop/swift,therealbnut/swift,codestergit/swift,hooman/swift,xedin/swift,bitjammer/swift,dduan/swift,zisko/swift,SwiftAndroid/swift,swiftix/swift.old,felix91gr/swift,ken0nek/swift,milseman/swift,gottesmm/swift,jopamer/swift,bitjammer/swift,harlanhaskins/swift,calebd/swift,kentya6/swift,austinzheng/swift,hughbe/swift,dduan/swift,devincoughlin/swift,JGiola/swift,SwiftAndroid/swift,roambotics/swift,uasys/swift,CodaFi/swift,MukeshKumarS/Swift,calebd/swift,manavgabhawala/swift,emilstahl/swift,IngmarStein/swift,kstaring/swift,khizkhiz/swift,OscarSwanros/swift,jopamer/swift,LeoShimonaka/swift,austinzheng/swift,xedin/swift,lorentey/swift,arvedviehweger/swift,tardieu/swift,uasys/swift,mightydeveloper/swift,LeoShimonaka/swift,bitjammer/swift,lorentey/swift,xwu/swift,tinysun212/swift-windows,natecook1000/swift,tjw/swift,gregomni/swift,danielmartin/swift,glessard/swift,jmgc/swift,natecook1000/swift,ahoppen/swift,ben-ng/swift,stephentyrone/swift,frootloops/swift,xedin/swift,jtbandes/swift,mightydeveloper/swift,ahoppen/swift,airspeedswift/swift,IngmarStein/swift,airspeedswift/swift,huonw/swift,kstaring/swift,Jnosh/swift,ben-ng/swift,nathawes/swift,parkera/swift,gottesmm/swift,KrishMunot/swift,nathawes/swift,adrfer/swift,JaSpa/swift,tinysun212/swift-windows,sdulal/swift,frootloops/swift,adrfer/swift,Jnosh/swift,khizkhiz/swift,alblue/swift,airspeedswift/swift,rudkx/swift,frootloops/swift,Ivacker/swift,khizkhiz/swift,rudkx/swift,MukeshKumarS/Swift,jckarter/swift,parkera/swift,zisko/swift,practicalswift/swift,bitjammer/swift,atrick/swift,gottesmm/swift,manavgabhawala/swift,parkera/swift,austinzheng/swift,swiftix/swift,mightydeveloper/swift,bitjammer/swift,swiftix/swift,practicalswift/swift,brentdax/swift,ben-ng/swift,apple/swift,karwa/swift,emilstahl/swift,lorentey/swift,amraboelela/swift,sdulal/swift,return/swift,swiftix/swift.old,arvedviehweger/swift,gmilos/swift,alblue/swift,Jnosh/swift,johnno1962d/swift,rudkx/swift,huonw/swift,IngmarStein/swift,cbrentharris/swift,stephentyrone/swift,stephentyrone/swift,kentya6/swift,dreamsxin/swift,tinysun212/swift-windows,benlangmuir/swift,brentdax/swift,gregomni/swift,allevato/swift,JaSpa/swift,jmgc/swift,therealbnut/swift,practicalswift/swift,felix91gr/swift,gregomni/swift,MukeshKumarS/Swift,shajrawi/swift,karwa/swift,zisko/swift,JGiola/swift,milseman/swift,tardieu/swift,xedin/swift,harlanhaskins/swift,dduan/swift,benlangmuir/swift,gribozavr/swift,LeoShimonaka/swift,aschwaighofer/swift,benlangmuir/swift,aschwaighofer/swift,milseman/swift,adrfer/swift,glessard/swift,jckarter/swift,IngmarStein/swift,manavgabhawala/swift,roambotics/swift,deyton/swift,gottesmm/swift,harlanhaskins/swift,jckarter/swift,jopamer/swift,cbrentharris/swift,natecook1000/swift,deyton/swift,alblue/swift,practicalswift/swift,xwu/swift,djwbrown/swift,brentdax/swift,Ivacker/swift,ken0nek/swift,ken0nek/swift,gottesmm/swift,benlangmuir/swift,russbishop/swift,codestergit/swift,ben-ng/swift,deyton/swift,jtbandes/swift,ben-ng/swift,lorentey/swift,calebd/swift,tardieu/swift,xwu/swift,modocache/swift,Jnosh/swift,uasys/swift,gribozavr/swift,ahoppen/swift,modocache/swift,harlanhaskins/swift,atrick/swift,khizkhiz/swift,KrishMunot/swift